aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2003-07-22 20:57:17 +0000
committerjhugunin <jhugunin>2003-07-22 20:57:17 +0000
commit026b2728aef846823419ebffceb57fe8161e3d15 (patch)
tree4388f34ab63d11eccb6a89917f0a07713f70ea61 /weaver
parent27ad07f5c1a4ad27fab06e1ebb91874355d90546 (diff)
downloadaspectj-026b2728aef846823419ebffceb57fe8161e3d15.tar.gz
aspectj-026b2728aef846823419ebffceb57fe8161e3d15.zip
tests and fix for Bugzilla Bug 39993
ajc stack trace on declaring hashcode() method in aspect added extra error-test for using super inside an inter-type declaration on an interface with multiple parents -- the correct parent is either hard or impossible to determine in that case
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java47
1 files changed, 31 insertions, 16 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java
index 9c1b28a0c..d75d94efe 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java
@@ -339,21 +339,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
// XXX make sure to check that we set exceptions properly on this guy.
weaver.addLazyMethodGen(mg);
- Set neededSuperCalls = munger.getSuperMethodsCalled();
-
- for (Iterator iter = neededSuperCalls.iterator(); iter.hasNext(); ) {
- ResolvedMember superMethod = (ResolvedMember) iter.next();
- if (weaver.addDispatchTarget(superMethod)) {
- //System.err.println("super type: " + superMethod.getDeclaringType() + ", " + gen.getType());
- boolean isSuper = !superMethod.getDeclaringType().equals(gen.getType());
- String dispatchName;
- if (isSuper) dispatchName = NameMangler.superDispatchMethod(onType, superMethod.getName());
- else dispatchName = NameMangler.protectedDispatchMethod(onType, superMethod.getName());
- LazyMethodGen dispatcher = makeDispatcher(gen, dispatchName, superMethod, weaver.getWorld(), isSuper);
-
- weaver.addLazyMethodGen(dispatcher);
- }
- }
+ addNeededSuperCallMethods(weaver, onType, munger.getSuperMethodsCalled());
return true;
} else if (onInterface && gen.getType().isTopmostImplementor(onType) &&
@@ -388,12 +374,36 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
weaver.addOrReplaceLazyMethodGen(mg);
+ addNeededSuperCallMethods(weaver, onType, munger.getSuperMethodsCalled());
+
return true;
} else {
return false;
}
}
+ private void addNeededSuperCallMethods(
+ BcelClassWeaver weaver,
+ ResolvedTypeX onType,
+ Set neededSuperCalls)
+ {
+ LazyClassGen gen = weaver.getLazyClassGen();
+
+ for (Iterator iter = neededSuperCalls.iterator(); iter.hasNext(); ) {
+ ResolvedMember superMethod = (ResolvedMember) iter.next();
+ if (weaver.addDispatchTarget(superMethod)) {
+ //System.err.println("super type: " + superMethod.getDeclaringType() + ", " + gen.getType());
+ boolean isSuper = !superMethod.getDeclaringType().equals(gen.getType());
+ String dispatchName;
+ if (isSuper) dispatchName = NameMangler.superDispatchMethod(onType, superMethod.getName());
+ else dispatchName = NameMangler.protectedDispatchMethod(onType, superMethod.getName());
+ LazyMethodGen dispatcher = makeDispatcher(gen, dispatchName, superMethod, weaver.getWorld(), isSuper);
+
+ weaver.addLazyMethodGen(dispatcher);
+ }
+ }
+ }
+
private boolean mungeNewConstructor(
BcelClassWeaver weaver,
@@ -487,9 +497,12 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
Type[] paramTypes = BcelWorld.makeBcelTypes(superMethod.getParameterTypes());
Type returnType = BcelWorld.makeBcelType(superMethod.getReturnType());
+ int modifiers = Modifier.PUBLIC;
+ if (onGen.isInterface()) modifiers |= Modifier.ABSTRACT;
+
LazyMethodGen mg =
new LazyMethodGen(
- Modifier.PUBLIC,
+ modifiers,
returnType,
dispatchName,
paramTypes,
@@ -497,6 +510,8 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
onGen);
InstructionList body = mg.getBody();
+ if (onGen.isInterface()) return mg;
+
// assert (!superMethod.isStatic())
InstructionFactory fact = onGen.getFactory();
int pos = 0;