Oh, OK. I discovered that things are much more complicated than it seemed.
First, you were right, Comparable<T> is (actually Comparable<T> and
Comarator<T> are) *special* case that *dropped* compareTo() method from
the API description XML. It is to be consistent with the existing AOSP's
API definition.
That have been special (at least, regarded so) and as a result it
becomes *mandatory* to get CompareTo() method.
And altering interface <implements> element by <attr> in Metadata.xml
doesn't work for this case, because unlike binding android.jar
java.lang.Comparable<T> cannot be looked up (it needs more investigation
to know precise situation, but as a general rule generics don't exist in
jar).
Hence, some Metadata.xml fixup has to be done manually, like:
<add-node
path="/api/package[@name='com.lowagie.text']/class[@name='Font']">
<method name="compareTo" return="int" abstract="false"
native="false" synchronized="false" static="false" final="false"
deprecated="not deprecated" visibility="public">
<parameter name="o" type="java.lang.Object" />
</method>
</add-node>
It in general falls to "generics only partially supported" category of
binding limitations, but the recipe to deal with is slightly different,
which we weren't fully aware. So far please take this as a normative
way. Sorry for the missing information.
Apart from that, you will have to rename "harmony.java.lang" to
something different, because it brings conflict between "Java.Lang" and
"Harmony.Java.Lang" which has never been expected. This is hopefully
fixed in the next release but so far this is a limitation.
Thanks,
Atsushi Eno
Jeremy A. Kolb - ARA/NED wrote:
No it definitely implements compateTo(java.lang.Object: "public int compareTo(Object
object)"
-----Original Message-----
From: monodroid-boun...@lists.ximian.com
[mailto:monodroid-boun...@lists.ximian.com] On Behalf Of Atsushi Eno
Sent: Wednesday, October 31, 2012 3:40 PM
To: Discussions related to Mono for Android
Subject: Re: [mono-android] Binding classes don't implement
Java.Lang.IComparable
The implemented class doesn't contain compareTo(java.lang.Object) but
compareTo(SomeSpecificType), whose type don't match and hence not regarded as
implementation.
If that's not about that, it is not likely about Comparable but different issue.
Atsushi Eno
Jeremy A. Kolb - ARA/NED wrote:
That doesn't make sense to me. IComparable.compareTo takes in an Object not
another type so it shouldn't care about generics.
-----Original Message-----
From: monodroid-boun...@lists.ximian.com
[mailto:monodroid-boun...@lists.ximian.com] On Behalf Of Atsushi Eno
Sent: Wednesday, October 31, 2012 3:25 PM
To: Discussions related to Mono for Android
Subject: Re: [mono-android] Binding classes don't implement
Java.Lang.IComparable
Hello,
That is a known limitation. The thing is, *generics don't really exist* in
compiled java classes and we always need to explicitly supply which class the
Comparable compares.
Hence the solution is, you add appropriate instantiated generic interface to
Metadata.xml. This is an example:
<attr
path="/api/package[@name='android.content']/class[@name='ComponentName']/implements[@name='java.lang.Comparable']"
name="name">java.lang.Comparable<android.content.ComponentName><
/attr>
Atsushi Eno
Jeremy A. Kolb - ARA/NED wrote:
I'm trying to bind droidtext (http://code.google.com/p/droidtext) and
having a lot of trouble with classes not implementing
Java.Lang.IComparable.CompareTo. I can look at the java files and see
that the functions are implemented and public but bindings aren't
being generated for them. Has anyone seen this before? I don't see
anything in the logs about why this function isn't being picked up.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid