[Mono-bugs] [Bug 633376] Unable to get Invoker for abstract type 'Android.Widget.AdapterView`1

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Aug 24 16:07:31 EDT 2010


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

https://bugzilla.novell.com/show_bug.cgi?id=633376#c1


Jonathan Pryor <jpryor at novell.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jpryor at novell.com

--- Comment #1 from Jonathan Pryor <jpryor at novell.com> 2010-08-24 20:07:30 UTC ---
This is trickier than I originally thought.

The problem is that we're not generating Invoker subclasses for generic wrapper
types.  These are needed so that Android.Runtime.Extensions.JavaCast<T>() can
create a non-abstract type at runtime of the appropriate target type.  (Thus,
if an instance of the abstract AdapterView<T> is needed, JavaCast<T>() would
create an AdapterViewInvoker<T>.)

The reason why we're not generating it is because it's tricky; we'd need to get
this to compile:

  namespace Java.Util {
    public abstract class Dictionary : Java.Lang.Object {
      public abstract Java.Lang.Object Get (Java.Lang.Object key);
    }

    public abstract class Dictionary<K,V> : Dictionary {
      public abstract V Get (K key);
    }

    internal class DictionaryInvoker<K,V> : Dictionary<K,V> {
      // Ruh-roh!  How do we override both Dictionary.Get() AND
      // Dictionary<K,V>.Get()?
      // ...
      // We don't. :-/
    }
  }

(OK, because of #634125 Get() isn't currently abstract, but it should be.)

Thus is the flaw in trying to mimic Java "raw types" -- it leads to
"impossible" C# code (or at least code in bad form).

One *possible* solution would be to drop the entire idea of exposing raw types
in the first place (e.g. dump Java.Util.Dictionary), only expose generic types
(Java.Util.Dictionary<K,V>), and then things are ~sane.  Then if you REALLY,
REALLY needed to make use of Java's raw type functionality, you could use
Extensions.JavaCast<T>().

Michael: thoughts?

-- 
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