Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 23724 [details]
Jar file to reproduce the bug
Create a binding project from the attached jar file.
When you build you will get 11 errors stating that the JSONObject does not implement interface member IMap....
Many of the missing members are a part of the java.util.HashMap class which is the base class of JSONObject in the Java world.
However the binding generator decided to change the base class to Android.Runtime.JavaDictionary.
I can not find a way to disable this behavior and question if it is even the correct change to make.
Link to the Components project that is actually experiencing the problem.
DropboxCoreApi for Android
I can CONFIRM this behavior:
Here's the api.xml
<class abstract="false" deprecated="not deprecated" extends="java.util.HashMap" extends-generic-aware="java.util.HashMap" final="false" name="JSONObject" static="false" visibility="public">
<implements name="java.util.Map" name-generic-aware="java.util.Map">
<constructor deprecated="not deprecated" final="false" name="JSONObject" static="false" type="com.example.mylibrary56345345.JSONObject" visibility="public">
However the generated class is the following:
public partial class JSONObject : global::Android.Runtime.JavaDictionary, global::Java.Util.IMap
Thus it seems like it should be Java.Util.HashMap instead as per https://bugzilla.xamarin.com/show_bug.cgi?id=58303#c0
This appears to be the "mirror" of Bug #56436: `generator` behavior is dependent on the order of types in an assembly (`Mono.Android.dll` in this case), and if that order changes, weird things happen:
> For example, if an assembly defines `JavaCollection` before
> `ICollection`, then a type lookup for `java.util.Collection` will
> return `ICollection`. If instead the assembly defines `ICollection`
> before `JavaCollection`, then a type lookup for `java.util.Collection`
> will instead return `JavaCollection`.
> This is not necessarily desirable, but I don't see much alternative.
Looks like I'll need to think up an alternative.
In the absence of an alternative, the easier solution is probably fixing up `Mono.Android.dll` to ensure that e.g. `Java.Util.HashMap` is defined *after* `Android.Runtime.JavaDictionary`.