aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoraclement <aclement>2009-04-30 20:29:39 +0000
committeraclement <aclement>2009-04-30 20:29:39 +0000
commita601b9846099424a77480d082db016494e870772 (patch)
treee18b86d58428362d207000e95859c9f9f267fd05 /org.aspectj.ajdt.core
parent1fe559e2babe14a778e200b4efccd380af5bf16b (diff)
downloadaspectj-a601b9846099424a77480d082db016494e870772.tar.gz
aspectj-a601b9846099424a77480d082db016494e870772.zip
272825: test and fix: super method call with generic itds
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/SuperFixerVisitor.java78
1 files changed, 39 insertions, 39 deletions
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 227b5b4d1..92ffd5105 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
@@ -10,7 +10,6 @@
* PARC initial implementation
* ******************************************************************/
-
package org.aspectj.ajdt.internal.compiler.ast;
import java.util.HashSet;
@@ -29,6 +28,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BlockScope;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodScope;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ParameterizedMethodBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
@@ -37,8 +37,8 @@ import org.aspectj.weaver.NameMangler;
import org.aspectj.weaver.ResolvedMember;
/**
- * Takes a method that already has the three extra parameters
- * thisJoinPointStaticPart, thisJoinPoint and thisEnclosingJoinPointStaticPart
+ * Takes a method that already has the three extra parameters thisJoinPointStaticPart, thisJoinPoint and
+ * thisEnclosingJoinPointStaticPart
*/
public class SuperFixerVisitor extends ASTVisitor {
@@ -57,15 +57,16 @@ public class SuperFixerVisitor extends ASTVisitor {
return super.visit(localTypeDeclaration, scope);
}
- public void endVisit(TypeDeclaration localTypeDeclaration,BlockScope scope) {
+ public void endVisit(TypeDeclaration localTypeDeclaration, BlockScope scope) {
depthCounter--;
- }
+ }
public void endVisit(MessageSend call, BlockScope scope) {
- //System.out.println("endVisit: " + call);
+ // System.out.println("endVisit: " + call);
// an error has already occurred
- if (call.codegenBinding == null) return;
-
+ if (call.codegenBinding == null)
+ return;
+
MethodBinding superBinding = call.codegenBinding;
if (superBinding instanceof ProblemMethodBinding) {
return;
@@ -74,62 +75,61 @@ public class SuperFixerVisitor extends ASTVisitor {
// 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;
+ // InterTypeMethodBinding m = (InterTypeMethodBinding)superBinding;
+ // if (m.postDispatchMethod != null) {
+ // call.binding = m.postDispatchMethod;
+ // }
+ // return;
+ }
+ if (superBinding instanceof ParameterizedMethodBinding) {
+ superBinding = ((ParameterizedMethodBinding) superBinding).original();
}
- EclipseFactory factory = ((AjLookupEnvironment)method.scope.environment()).factory;
- if (depthCounter!=0 && targetClass.isInterface()) {// pr198196 - when calling MarkerInterface.super.XXX()
+ EclipseFactory factory = ((AjLookupEnvironment) method.scope.environment()).factory;
+ if (depthCounter != 0 && targetClass.isInterface()) {// pr198196 - when calling MarkerInterface.super.XXX()
if (call.isSuperAccess() && !call.binding.isStatic()) {
MethodScope currentMethodScope = scope.methodScope();
SourceTypeBinding sourceType = currentMethodScope.enclosingSourceType();
FieldBinding field = sourceType.addSyntheticFieldForInnerclass(targetClass);
- call.receiver = new KnownFieldReference(field,call.receiver.sourceStart,call.receiver.sourceEnd);
+ call.receiver = new KnownFieldReference(field, call.receiver.sourceStart, call.receiver.sourceEnd);
} else {
return;
}
- } else if (depthCounter==0) { // Allow case testSuperItds_pr198196_2/3
-
+ } else if (depthCounter == 0) { // Allow case testSuperItds_pr198196_2/3
+
char[] accessName;
if (call.isSuperAccess() && !call.binding.isStatic()) {
call.receiver = new ThisReference(call.receiver.sourceStart, call.receiver.sourceEnd);
- accessName =
- NameMangler.superDispatchMethod(factory.fromBinding(targetClass),
- new String(superBinding.selector)).toCharArray();
+ accessName = NameMangler.superDispatchMethod(factory.fromBinding(targetClass), new String(superBinding.selector))
+ .toCharArray();
} else if (call.receiver.isThis() && call.binding.isProtected() && !call.binding.isStatic()) {
- //XXX this is a hack that violates some binary compatibility rules
+ // XXX this is a hack that violates some binary compatibility rules
ReferenceBinding superBindingDeclaringClass = superBinding.declaringClass;
if (superBindingDeclaringClass.isParameterizedType()) {
- superBindingDeclaringClass = ((ParameterizedTypeBinding)superBindingDeclaringClass).type;
+ superBindingDeclaringClass = ((ParameterizedTypeBinding) superBindingDeclaringClass).type;
}
if (superBindingDeclaringClass.equals(targetClass)) {
- accessName =
- NameMangler.protectedDispatchMethod(factory.fromBinding(targetClass),
- new String(superBinding.selector)).toCharArray();
+ accessName = NameMangler.protectedDispatchMethod(factory.fromBinding(targetClass),
+ new String(superBinding.selector)).toCharArray();
} else {
- accessName =
- NameMangler.superDispatchMethod(factory.fromBinding(targetClass),
- new String(superBinding.selector)).toCharArray();
+ accessName = NameMangler.superDispatchMethod(factory.fromBinding(targetClass),
+ new String(superBinding.selector)).toCharArray();
}
} else {
return;
}
-
- //??? do we want these to be unique
- MethodBinding superAccessBinding =
- new MethodBinding(ClassFileConstants.AccPublic, accessName,
- superBinding.returnType, superBinding.parameters, superBinding.thrownExceptions,
- targetClass);
-
+
+ // ??? do we want these to be unique
+ MethodBinding superAccessBinding = new MethodBinding(ClassFileConstants.AccPublic, accessName, superBinding.returnType,
+ superBinding.parameters, superBinding.thrownExceptions, targetClass);
+
AstUtil.replaceMethodBinding(call, superAccessBinding);
} else {
- return;
+ return;
}
ResolvedMember targetMember = null;
- if (superBinding.declaringClass.isParameterizedType()) { //pr206911
- targetMember = factory.makeResolvedMember(superBinding,((ParameterizedTypeBinding)superBinding.declaringClass).genericType());
+ if (superBinding.declaringClass.isParameterizedType()) { // pr206911
+ targetMember = factory.makeResolvedMember(superBinding, ((ParameterizedTypeBinding) superBinding.declaringClass)
+ .genericType());
} else {
targetMember = factory.makeResolvedMember(superBinding);
}