Bug 17771 - Generic type parameters lead to missing `override` keyword when the binding for the abstract parent class is in another assembly
Summary: Generic type parameters lead to missing `override` keyword when the binding f...
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings ()
Version: 4.12.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2014-02-13 23:24 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2014-04-23 05:13 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test case (91.91 KB, application/zip)
2014-02-13 23:24 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Brendan Zagaeski (Xamarin Team, assistant) 2014-02-13 23:24:52 UTC
Created attachment 6044 [details]
Test case

## Steps to reproduce

Attempt to build the TestAndroidLib2 project in the attached test case.


## Result

obj/Debug/generated/src/TestAndroidLib2.MyChildClass.cs(55,41): error CS0533: `TestAndroidLib2.MyChildClass.Get(Java.Net.URI, string, System.Collections.Generic.IDictionary<string,System.Collections.Generic.IList<string>>)' hides inherited abstract member `TestAndroidLib1.MyParentClass.Get(Java.Net.URI, string, System.Collections.Generic.IDictionary<string,System.Collections.Generic.IList<string>>)'


## One way to avoid the problem: include the MyParentClass in the same assembly

In the TestAndroidLib2 project:
1. Remove the TestAndroidLib1 reference
2. Switch the build action for `testandroidlib1.jar` to EmbeddedJar
3. Rebuild

In this case, the bindings generator will add the `override` keyword as needed, and the project will build successfully.


## Workaround

1. Copy the generated `MyChildClass.Get()` method that causes the error into a partial MyChildClass in the `Additions` folder.
2. Add the `override` keyword to this method.
3. Use a <remove-node> element in the Metadata.xml file to stop automatically generating the `Get()` method.

This is the technique currently used by https://github.com/paulcbetts/OkHttp-Xamarin/ to work around the problem.


## Additional example

This problem also appears when binding the `HttpResponseCache.Get()` method from the OkHttp library [1]. The inherited abstract method in that case is `Java.Net.ResponseCache.Get(URI, String, Map<String,List<String>>)`.

[1] https://github.com/square/okhttp


## Test case

In addition to the two binding projects, the test case also includes the source for both of the small Android libraries that were used to create the .jar files.
Comment 2 Sadik Ali 2014-02-28 02:50:12 UTC
I checked this issue with the help of attached project and noticed the error as mentioned in bug description is raised when I build attached code.
Refer exception log: https://gist.github.com/anonymous/9266950

Checked With:

All Mac
XS 4.2.2 (Build 2)
XA 4.10.1 , 4.12.0
Comment 3 Atsushi Eno 2014-04-23 05:13:07 UTC
I cannot reproduce this issue in master anymore.
It is likely that [master 2abdabb] has fixed the issue (which was meant to fix another issue, but seems to address similar problem). So marking this as FIXED.