Bug 552489 - [otdre] AbstractBoundClass does not find its superClass
diff --git a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/ASMByteCodeAnalyzer.java b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/ASMByteCodeAnalyzer.java
index d55bf4c..92786cb 100644
--- a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/ASMByteCodeAnalyzer.java
+++ b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/ASMByteCodeAnalyzer.java
@@ -1,7 +1,7 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
*
- * Copyright 2008, 2014 Oliver Frank and others.
+ * Copyright 2008, 2019 Oliver Frank and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -42,11 +42,13 @@
public static class ClassInformation {
private int modifiers;
+ private String name;
private String superClassName;
private String[] superInterfaceNames;
ClassInformation(ClassReader classReader) {
this.modifiers = classReader.getAccess();
+ this.name = classReader.getClassName();
this.superClassName = classReader.getSuperName();
this.superInterfaceNames = classReader.getInterfaces();
}
@@ -72,6 +74,12 @@
}
return superInterfaceNames;
}
+
+ public String getName() {
+ if (this.name != null)
+ return this.name.replace('/', '.');
+ return "<no name>";
+ }
}
private Map<String, ClassInformation> classInformationMap =
diff --git a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/DelegatingTransformer.java b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/DelegatingTransformer.java
index df7d543..b340308 100644
--- a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/DelegatingTransformer.java
+++ b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/DelegatingTransformer.java
@@ -27,6 +27,7 @@
import java.util.EnumSet;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.objectteams.internal.osgi.weaving.ASMByteCodeAnalyzer.ClassInformation;
import org.eclipse.objectteams.internal.osgi.weaving.OTWeavingHook.WeavingReason;
import org.eclipse.objectteams.internal.osgi.weaving.OTWeavingHook.WeavingScheme;
import org.eclipse.objectteams.internal.osgi.weaving.Util.ProfileKind;
@@ -125,6 +126,12 @@
// error output during redefinition tends to swallow the stack, print it now:
System.err.println("Error redefining "+clazz.getName());
e.printStackTrace();
+ ClassInformation classInformation = new ASMByteCodeAnalyzer().getClassInformation(bytecode, clazz.getName());
+ if (!classInformation.getName().equals(clazz.getName())) {
+ System.err.println("Name mismatch "+clazz.getName()+" vs "+classInformation.getName());
+ } else if (!classInformation.getSuperClassName().equals(clazz.getSuperclass().getName())) {
+ System.err.println("Superclass mismatch "+clazz.getSuperclass().getName()+" vs "+classInformation.getSuperClassName());
+ }
throw e;
}
}
diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/AbstractBoundClass.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/AbstractBoundClass.java
index 05349fe..81f872c 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/AbstractBoundClass.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/AbstractBoundClass.java
@@ -906,7 +906,7 @@
if (this.hierarchyIsCallinAffected)
return true;
AbstractBoundClass zuper = getSuperclass();
- if (!zuper.isJavaLangObject()) {
+ if (zuper != null && !zuper.isJavaLangObject()) {
if (zuper.hierarchyIsCallinAffected())
return this.hierarchyIsCallinAffected = true;
}