Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfrijters <jfrijters>2014-11-11 18:27:34 +0300
committerjfrijters <jfrijters>2014-11-11 18:27:34 +0300
commitc388ca5ab7f08381096e3164eeaa8e53015117da (patch)
treea3a03e40ae3ab514c26cae00b2c4c713fee142b2
parent818db48acfbb07607efcc03436a135c6e335dfdb (diff)
Add some (level 4) warnings for abstract method errors that can be caused by bugs in default interface method handling.
-rw-r--r--runtime/DynamicTypeWrapper.cs25
1 files changed, 24 insertions, 1 deletions
diff --git a/runtime/DynamicTypeWrapper.cs b/runtime/DynamicTypeWrapper.cs
index 4fe1b8ac..3c100b73 100644
--- a/runtime/DynamicTypeWrapper.cs
+++ b/runtime/DynamicTypeWrapper.cs
@@ -2923,9 +2923,11 @@ namespace IKVM.Internal
AttributeHelper.HideFromReflection(mb);
if ((!wrapper.IsAbstract && mmw.BaseMethod.IsAbstract) || (!wrapper.IsInterface && mmw.Error != null))
{
+ string message = mmw.Error ?? (wrapper.Name + "." + methods[index].Name + methods[index].Signature);
CodeEmitter ilgen = CodeEmitter.Create(mb);
- ilgen.EmitThrow("java.lang.AbstractMethodError", mmw.Error ?? (wrapper.Name + "." + methods[index].Name + methods[index].Signature));
+ ilgen.EmitThrow("java.lang.AbstractMethodError", message);
ilgen.DoEmit();
+ wrapper.EmitLevel4Warning(HardError.AbstractMethodError, message);
}
#if STATIC_COMPILER
if (wrapper.IsInterface && !mmw.IsAbstract)
@@ -4223,6 +4225,7 @@ namespace IKVM.Internal
CodeEmitter ilgen = CodeEmitter.Create(mb);
ilgen.EmitThrow("java.lang.AbstractMethodError", mw.DeclaringType.Name + "." + mw.Name + mw.Signature);
ilgen.DoEmit();
+ wrapper.EmitLevel4Warning(HardError.AbstractMethodError, mw.DeclaringType.Name + "." + mw.Name + mw.Signature);
}
}
}
@@ -4276,6 +4279,7 @@ namespace IKVM.Internal
// NOTE in the JVM it is apparently legal for a non-abstract class to have abstract methods, but
// the CLR doens't allow this, so we have to emit a method that throws an AbstractMethodError
stub = true;
+ wrapper.EmitLevel4Warning(HardError.AbstractMethodError, classFile.Name + "." + m.Name + m.Signature);
}
else if (classFile.IsPublic && !classFile.IsFinal && !(m.IsPublic || m.IsProtected))
{
@@ -5620,6 +5624,7 @@ namespace IKVM.Internal
ilgen.DoEmit();
typeBuilder.DefineMethodOverride(mb, (MethodInfo)ifmethod.GetMethod());
wrapper.SetHasIncompleteInterfaceImplementation();
+ wrapper.EmitLevel4Warning(HardError.AbstractMethodError, wrapper.Name + "." + ifmethod.Name + ifmethod.Signature);
}
}
}
@@ -7143,6 +7148,24 @@ namespace IKVM.Internal
{
return impl.GetFieldRawTypeAnnotations(Array.IndexOf(GetFields(), fw));
}
+
+ [Conditional("STATIC_COMPILER")]
+ internal void EmitLevel4Warning(HardError error, string message)
+ {
+#if STATIC_COMPILER
+ if (GetClassLoader().WarningLevelHigh)
+ {
+ switch (error)
+ {
+ case HardError.AbstractMethodError:
+ GetClassLoader().IssueMessage(Message.EmittedAbstractMethodError, this.Name, message);
+ break;
+ default:
+ throw new InvalidOperationException();
+ }
+ }
+#endif
+ }
}
sealed class DefineMethodHelper