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>2015-03-19 17:59:10 +0300
committerjfrijters <jfrijters>2015-03-19 17:59:10 +0300
commit236cf8fa1cc9199f443470c6ebe774a5ab5b6dcc (patch)
treec1daa2c4b83ad3d123b8ccf8ede144137f1ba1a2
parentef6a8e0c6e0c8f044e6a130e55803fec6efaab13 (diff)
Bug fix. Disallow invokevirtual MH constant to resolve to interface method and disallow invokeinterface MH constant to resolve to non-public method.
-rw-r--r--runtime/openjdk/java.lang.invoke.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/openjdk/java.lang.invoke.cs b/runtime/openjdk/java.lang.invoke.cs
index e1c1f013..b8b64967 100644
--- a/runtime/openjdk/java.lang.invoke.cs
+++ b/runtime/openjdk/java.lang.invoke.cs
@@ -301,6 +301,14 @@ static class Java_java_lang_invoke_MethodHandleNatives
string msg = String.Format(mw.IsStatic ? "Expecting non-static method {0}.{1}{2}" : "Expected static method {0}.{1}{2}", mw.DeclaringType.Name, self.getName(), self.getSignature());
throw new java.lang.IncompatibleClassChangeError(msg);
}
+ if (self.getReferenceKind() == MethodHandleNatives.Constants.REF_invokeVirtual && mw.DeclaringType.IsInterface)
+ {
+ throw new java.lang.IncompatibleClassChangeError("Found interface " + mw.DeclaringType.Name + ", but class was expected");
+ }
+ if (!mw.IsPublic && self.getReferenceKind() == MethodHandleNatives.Constants.REF_invokeInterface)
+ {
+ throw new java.lang.IncompatibleClassChangeError("private interface method requires invokespecial, not invokeinterface: method " + self.getDeclaringClass().getName() + "." + self.getName() + self.getSignature());
+ }
if (mw.IsConstructor && mw.DeclaringType == CoreClasses.java.lang.String.Wrapper)
{
typeof(MemberName).GetField("type", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(self, self.getMethodType().changeReturnType(typeof(string)));