Re: [Ikvm-developers] Type mapping & interface inheritance question
Brought to you by:
jfrijters
|
From: David J. <ju...@or...> - 2004-09-11 17:39:02
|
Jonathan Pierce wrote:
>>Now, in C#, I declare a class C : IB, and then try to pass as instance
>>of C as arg to f(), I get a compile time error from mono's mcs saying
>>
>>
>
>I haven't looked at the generated code, but go ahead and check whether the
>interface is declared internal or not. If it is public, you should not need
>the cast, but if it is an explicit internal interface, you will need a cast
>to the interface when you use the instance.
>
>internal interface IA {}
>internal interface IB : IA { }
>
>class C : IB
>
>{
>}
>
>C theC = new C ();
>
>f ((IB) theC);
>
>-Jonathan
>
>
>
Neither of the super interfaces are internal as far as I can see, they are
public (in java anyway). If I put in the cast, mcs will compile it
fine, but when run
I get the following:
no implementation for interface method
org.eclipse.jface.viewers.IContentProvider::inputChanged(Viewer,object,object)
in class .FileTreeContentProvider
METHOD .ctor()
METHOD getChildren(object)
METHOD getElements(object)
METHOD hasChildren(object)
METHOD getParent(object)
METHOD dispose()
METHOD inputChanged(Viewer,object,object)
** ERROR **: file class.c: line 1104 (mono_class_setup_vtable): should
not be reached
aborting...
Aborted
If, instead of casting, I explicitly qualify the inputChanged()[/f()]
method with the
interface IContentProvider[/IA], then mcs give an error when compiling:
error CS0540: `inputChanged': containing class does not implement
interface `org.eclipse.jface.viewers.IContentProvider'
I'll try a simple test case and see if I get the same result and let you
know.
(I'll try declaring IA & IB in both C# & ikvmc'd-java.)
Thanks btw.
-David.
|