Bug 10123 - Binder bug in Java Bindings Library with android universal image loader library
Summary: Binder bug in Java Bindings Library with android universal image loader library
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings ()
Version: 4.8.x
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2013-02-07 08:28 UTC by Mike
Modified: 2013-02-08 20:28 UTC (History)
1 user (show)

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

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 Mike 2013-02-07 08:28:36 UTC
Also see my discussion here: http://forums.xamarin.com/discussion/comment/3938#Comment_3938

I've been trying to create a java bindings library project with the Android Universal Image Loaderand am getting the following error which is hiding the abstract parent method and putting the override keyword in

/Users/Mike/Projects/AndroidUniversalImage/AndroidUniversalImage/obj/Debug/generated/src/Com.Nostra13.Universalimageloader.Core.Download.URLConnectionImageDownloader.cs(57,57): Error CS0533: `Com.Nostra13.Universalimageloader.Core.Download.URLConnectionImageDownloader.GetStreamFromNetwork(Java.Net.URI)' hides inherited abstract member `Com.Nostra13.Universalimageloader.Core.Download.ImageDownloader.GetStreamFromNetwork(Java.Net.URI)' (CS0533) (AndroidUniversalImage)

I've already added the following to Transforms/Medatadata.xml

<attr path="/api/package[@name='com.nostra13.universalimageloader.cache.memory.impl']/class[@name='FIFOLimitedMemoryCache']/method[@name='removeNext']" name="managedReturn">Java.Lang.Object</attr>
<attr path="/api/package[@name='com.nostra13.universalimageloader.cache.memory.impl']/class[@name='LRULimitedMemoryCache']/method[@name='removeNext']" name="managedReturn">Java.Lang.Object</attr>
<attr path="/api/package[@name='com.nostra13.universalimageloader.cache.memory.impl']/class[@name='LargestLimitedMemoryCache']/method[@name='removeNext']" name="managedReturn">Java.Lang.Object</attr>
<attr path="/api/package[@name='com.nostra13.universalimageloader.cache.memory.impl']/class[@name='UsingFreqLimitedMemoryCache']/method[@name='removeNext']" name="managedReturn">Java.Lang.Object</attr>
Comment 1 Atsushi Eno 2013-02-08 08:24:06 UTC
(copying my forum post)

It is actually not a bug but one kind of Java/C# difference that needs to be taken care: Java allows overrides in wider "visibility" i.e. "protected" method can be overriden as "public", while C# doesn't allow that. Hence you need this:

<attr path="/api/package[@name='com.nostra13.universalimageloader.core.download']/class[@name='URLConnectionImageDownloader']/method[@name='getStreamFromNetwork']" name="visibility">protected</attr>

This adjustment might not always apply (there might be methods that had better be fixed at base to "fake public", not derived to "fake protected"), so we basically leave this to users which to modify.

Though it seems that we had better skip checking visibility to look for overridable members so that you can easily understand that either of them needs to be adjusted. I'll make change to do so, unless it does not cause different kind of issues.
Comment 2 Atsushi Eno 2013-02-08 09:14:49 UTC
Actually it's not really doable without some "surgery" - we have not a few classes that implements some interface that contains "public Object clone()", and have "public Object clone()" overrides of "protected" java.lang.Object#clone(). They used to give only warnings, but with the change above they result in errors.
Comment 3 Atsushi Eno 2013-02-08 20:28:07 UTC
I have resolved this issue as:

- visibility inconsistency on virtual methods - it treats the derived method as *not* an override i.e. it is kept as virtual.
- visibility inconsistency on abstract methods - it treats the derived method as an override, then generate C# source that results in compilation error for inconsistency.

With this new compiler error, it became clearer on what to fix in metadata.

The fix will take effect on "the next to next" release.