[Mono-bugs] [Bug 636465] Monodroid generates incorrect java for subclasses of generic types.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Sep 8 10:22:18 EDT 2010


https://bugzilla.novell.com/show_bug.cgi?id=636465

https://bugzilla.novell.com/show_bug.cgi?id=636465#c4


--- Comment #4 from Jonathan Pryor <jpryor at novell.com> 2010-09-08 14:22:17 UTC ---
Fixed in r7891.

To further elaborate on how (1) and (2) differ, (2) is fixed by replacing '`'
with '_' in the type name, allowing us to have the C# code:

    class A<T> : Java.Lang.Object {}
    class A<T1, T2> : A<T1> {}

This results in the Java Proxy types:

    class A_1 extends java.lang.Object {}
    class A_2 extends A_1 {}

This is good.  Stupendously wonderful, even.

Until we get to the ArrayAdapter<T> use from the original bug report, where
we'd generate:

    class OrderAdapter extends android.widget.ArrayAdapter_1 {}

Er, what?  Since ArrayAdapter has no [Register] attribute, we use the type name
after replacing '`' with '_', resulting in ArrayAdapter_1...which doesn't
exist.

Oops.

*This* is why ArrayAdapter<T> needs [Register]: so we can tell monodroid the
*correct* Java type to use.

FURTHERMORE, the reason why in Comment #1 no constructors were generated was
because ArrayAdapter<T> didn't [Register] any of the constructors, and
monodroid needs [Register] so that it knows the correct Java types to use. 
Thus, not only does ArrayAdapter<T> need a [Register] attribute on the type,
all (or some) of the constructors need [Register] as well!

So for good measure I added [Register] to the type and all public members on
ArrayAdapter<T> and AdapterView<T>, as javadoc-to-mdoc uses [Register] to find
the corresponding documentation, so (bonus!) we'll get docs on our generic
wrappers too.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list