When a dynamic only interface method ends up being "implemented" by a static or non-public method, it should throw the appropriate exception.

This commit is contained in:
jfrijters 2012-01-20 09:59:50 +00:00
Родитель e3d95f6da5
Коммит 93ebbdb473
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -474,10 +474,14 @@ namespace IKVM.Internal
// we can resolve to a real method and call that instead
TypeWrapper tw = TypeWrapper.FromClass(NativeCode.ikvm.runtime.Util.getClassFromObject(obj));
MethodWrapper mw = tw.GetMethodWrapper(this.Name, this.Signature, true);
if (mw == null)
if (mw == null || mw.IsStatic)
{
throw new java.lang.AbstractMethodError(tw.Name + "." + this.Name + this.Signature);
}
if (!mw.IsPublic)
{
throw new java.lang.IllegalAccessError(tw.Name + "." + this.Name + this.Signature);
}
java.lang.reflect.Method m = (java.lang.reflect.Method)mw.ToMethodOrConstructor(true);
m.@override = true;
return m.invoke(obj, args, callerID);