diff options
author | jhugunin <jhugunin> | 2003-02-13 21:00:35 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-02-13 21:00:35 +0000 |
commit | 3e2801ad504e8f6b3fa7b50a42bf2706994e1727 (patch) | |
tree | 012a2d37b1c15c28adaf1990457b670bdc072ab5 /org.aspectj.ajdt.core | |
parent | d49c9fdf6d4c334c2a0e6faa454a115616ea0712 (diff) | |
download | aspectj-3e2801ad504e8f6b3fa7b50a42bf2706994e1727.tar.gz aspectj-3e2801ad504e8f6b3fa7b50a42bf2706994e1727.zip |
fixed Bug 29959: super call in intertype method declaration body causes VerifyError
Diffstat (limited to 'org.aspectj.ajdt.core')
3 files changed, 21 insertions, 34 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java index 55ddb12f6..5abe2ce07 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java @@ -110,7 +110,7 @@ public class InterTypeConstructorDeclaration extends InterTypeDeclaration { if (explicitConstructorCall != null) { explicitConstructor = explicitConstructorCall.binding; if (explicitConstructor.alwaysNeedsAccessMethod()) { - explicitConstructor = explicitConstructor.getAccessMethod(); + explicitConstructor = explicitConstructor.getAccessMethod(true); } } @@ -226,7 +226,7 @@ public class InterTypeConstructorDeclaration extends InterTypeDeclaration { if (explicitConstructorCall != null && !(explicitConstructorCall.binding instanceof ProblemMethodBinding)) { MethodBinding explicitConstructor = explicitConstructorCall.binding; if (explicitConstructor.alwaysNeedsAccessMethod()) { - explicitConstructor = explicitConstructor.getAccessMethod(); + explicitConstructor = explicitConstructor.getAccessMethod(true); } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/SuperFixerVisitor.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/SuperFixerVisitor.java index 00732e4eb..74d071b6c 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/SuperFixerVisitor.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/SuperFixerVisitor.java @@ -16,6 +16,7 @@ package org.aspectj.ajdt.internal.compiler.ast; import java.util.*; import java.util.Arrays; +import org.aspectj.ajdt.internal.compiler.lookup.*; import org.aspectj.ajdt.internal.compiler.lookup.EclipseWorld; import org.aspectj.weaver.*; import org.aspectj.weaver.ShadowMunger; @@ -49,6 +50,17 @@ public class SuperFixerVisitor extends AbstractSyntaxTreeVisitorAdapter { if (superBinding instanceof ProblemMethodBinding) { return; } + // InterTypeMethodBindings are always statically bound, so there's no + // need to treat super calls specially here + if (superBinding instanceof InterTypeMethodBinding) { + return; +// InterTypeMethodBinding m = (InterTypeMethodBinding)superBinding; +// if (m.postDispatchMethod != null) { +// call.binding = m.postDispatchMethod; +// } +// return; + } + char[] accessName; if (call.isSuperAccess() && !call.binding.isStatic()) { call.receiver = new ThisReference(); diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java index 18aea28e4..fac054a2d 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java @@ -18,11 +18,10 @@ import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.jdt.internal.compiler.lookup.*; public class InterTypeMethodBinding extends MethodBinding { - //private ReferenceBinding withinType; private ReferenceBinding targetType; private MethodBinding syntheticMethod; - //public MethodBinding introducedMethod; + public MethodBinding postDispatchMethod; public AbstractMethodDeclaration sourceMethod; @@ -38,42 +37,17 @@ public class InterTypeMethodBinding extends MethodBinding { if (signature.getKind() == Member.METHOD) { syntheticMethod = world.makeMethodBinding(AjcMemberMaker.interMethodDispatcher(signature, withinType)); + postDispatchMethod = + world.makeMethodBinding(AjcMemberMaker.interMethodBody(signature, withinType)); } else { syntheticMethod = world.makeMethodBinding( AjcMemberMaker.interConstructor(world.resolve(signature.getDeclaringType()), signature, withinType)); + postDispatchMethod = syntheticMethod; } } - -// -// this.declaringClass = -// -// -// -// char[] dispatch2Name; -// if (Modifier.isPublic(modifiers)) { -// dispatch2Name = name; -// } else if (Modifier.isPrivate(modifiers)) { -// dispatch2Name = -// AstUtil.makeAjcMangledName("dispatch2".toCharArray(), withinType, selector); -// } else { -// // package visible -// //??? optimize both in same package -// dispatch2Name = -// AstUtil.makeAjcMangledName("dispatch2".toCharArray(), -// withinType.qualifiedPackageName(), selector); -// } -// -// introducedMethod = -// new MethodBinding(AstUtil.makePublic(modifiers), dispatch2Name, -// type, args, exceptions, declaringClass); -// -// this.dispatchMethod = -// new DispatchMethodBinding(introducedMethod, withinType, mangledParams); -// } - //XXX this is identical to InterTypeFieldBinding public boolean canBeSeenBy(TypeBinding receiverType, InvocationSite invocationSite, Scope scope) { @@ -127,8 +101,9 @@ public class InterTypeMethodBinding extends MethodBinding { } - public MethodBinding getAccessMethod() { - return syntheticMethod; + public MethodBinding getAccessMethod(boolean staticReference) { + if (staticReference) return postDispatchMethod; + else return syntheticMethod; } public boolean alwaysNeedsAccessMethod() { return true; } |