Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordwagelaar2014-02-05 07:35:59 -0500
committerdwagelaar2014-02-05 07:35:59 -0500
commitfc128977d1924d932aeb6ed1eb1d15db13938a6e (patch)
treeeaf66b305dbc6144e93481958ffc7ebcf4208112 /plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse
parente8ab74741d156478ff745f129bcdf2150ff3876b (diff)
downloadorg.eclipse.atl-fc128977d1924d932aeb6ed1eb1d15db13938a6e.tar.gz
org.eclipse.atl-fc128977d1924d932aeb6ed1eb1d15db13938a6e.tar.xz
org.eclipse.atl-fc128977d1924d932aeb6ed1eb1d15db13938a6e.zip
Test + fix.
427454: JIT bytecode verification error: Bad access to protected data https://bugs.eclipse.org/bugs/show_bug.cgi?id=427454
Diffstat (limited to 'plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse')
-rw-r--r--plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/jit/ByteCodeSwitch.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/jit/ByteCodeSwitch.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/jit/ByteCodeSwitch.java
index 4fdb11e5..a7a52e8d 100644
--- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/jit/ByteCodeSwitch.java
+++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/jit/ByteCodeSwitch.java
@@ -11,6 +11,7 @@
package org.eclipse.m2m.atl.emftvm.jit;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
@@ -1077,11 +1078,17 @@ public class ByteCodeSwitch extends EmftvmSwitch<MethodVisitor> implements Opcod
if (method == null) {
return null;
}
+ final int methodModifiers = getRelevantModifiers(method);
Class<?> dc = method.getDeclaringClass();
Class<?>[] dis = dc.getInterfaces();
while ((dc = dc.getSuperclass()) != null) {
try {
- method = dc.getDeclaredMethod(method.getName(), method.getParameterTypes());
+ Method superMethod = dc.getDeclaredMethod(method.getName(), method.getParameterTypes());
+ if (getRelevantModifiers(superMethod) == methodModifiers) {
+ method = superMethod;
+ } else {
+ break;
+ }
} catch (SecurityException e) {
break;
} catch (NoSuchMethodException e) {
@@ -1106,6 +1113,16 @@ public class ByteCodeSwitch extends EmftvmSwitch<MethodVisitor> implements Opcod
}
/**
+ * Returns the relevant modifiers (visibility and static) for the given method.
+ * @param method the method for which to return the modifiers
+ * @return the relevant modifiers (visibility and static) for the given method
+ */
+ private int getRelevantModifiers(final Method method) {
+ final int methodModifiers = method.getModifiers();
+ return methodModifiers & (Modifier.PRIVATE + Modifier.PROTECTED + Modifier.PUBLIC + Modifier.STATIC);
+ }
+
+ /**
* {@inheritDoc}
*/
@Override

Back to the top