import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Argument;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.CodeStream;
}
// called by IfPseudoToken
- public static Argument[] addTjpArguments(Argument[] arguments) {
+ public static Argument[] addTjpArguments(Argument[] arguments, TypeDeclaration containingTypeDec) {
int index = arguments.length;
- arguments = extendArgumentsLength(arguments, 3);
+ arguments = extendArgumentsLength(arguments, 4);
arguments[index++] = makeFinalArgument("thisJoinPointStaticPart", AjTypeConstants.getJoinPointStaticPartType());
arguments[index++] = makeFinalArgument("thisJoinPoint", AjTypeConstants.getJoinPointType());
arguments[index++] = makeFinalArgument("thisEnclosingJoinPointStaticPart", AjTypeConstants.getJoinPointStaticPartType());
+ arguments[index++] = makeFinalArgument("thisAspectInstance", toReference(containingTypeDec.name));
return arguments;
}
+ private static TypeReference toReference(char[] typename) {
+ if (CharOperation.contains('.', typename)) {
+ char[][] compoundName = CharOperation.splitOn('.', typename);
+ return new QualifiedTypeReference(compoundName, new long[compoundName.length]);
+ } else {
+ return new SingleTypeReference(typename, 0);
+ }
+ }
+
private static Argument makeFinalArgument(String name, TypeReference typeRef) {
long pos = 0; // XXX encode start and end location
return new Argument(name.toCharArray(), pos, typeRef, Modifier.FINAL);
// };
// };
// s += ")"; //$NON-NLS-1$
- //
+ //
// if (extraArgument != null) {
// s += "(" + extraArgument.toString(0) + ")";
// }
- //
- //
- //
+ //
+ //
+ //
// if (thrownExceptions != null) {
// s += " throws "; //$NON-NLS-1$
// for (int i = 0; i < thrownExceptions.length; i++) {
// s = s + ", "; //$NON-NLS-1$
// };
// };
- //
+ //
// s += ": ";
// if (pointcutDesignator != null) {
// s += pointcutDesignator.toString(0);
import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ReturnStatement;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
import org.aspectj.org.eclipse.jdt.internal.compiler.parser.Parser;
import org.aspectj.weaver.Member;
import org.aspectj.weaver.ResolvedMemberImpl;
-import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.patterns.IfPointcut;
+import org.aspectj.weaver.patterns.PerClause;
public class IfMethodDeclaration extends AjMethodDeclaration {
IfPointcut ifPointcut;
return classFile.generateMethodInfoAttribute(binding, false, AstUtil.getAjSyntheticAttribute());
}
- // private static class TrueFalseVisitor extends astvi
public void resolveStatements() {
super.resolveStatements();
if (binding != null) {
// XXX this is where we should remove unavailable args if we're in a cflow
EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(scope);
ifPointcut.testMethod = new ResolvedMemberImpl(Member.METHOD, factory.fromBinding(binding.declaringClass),
- this.modifiers, ResolvedType.BOOLEAN, new String(this.selector), factory.fromBindings(this.binding.parameters));
+ this.modifiers, UnresolvedType.BOOLEAN, new String(this.selector),
+ factory.fromBindings(this.binding.parameters));
+ if (tjp.needsThisAspectInstance && scope.parent instanceof ClassScope) { // really should be
+ ClassScope o = (ClassScope) scope.parent;
+ if (o.referenceContext instanceof AspectDeclaration) { // really should be
+ AspectDeclaration aspectDecl = (AspectDeclaration) o.referenceContext;
+ if (aspectDecl.perClause != null && aspectDecl.perClause.getKind() != PerClause.SINGLETON) {
+ scope.problemReporter()
+ .signalError(sourceStart, sourceEnd,
+ "thisAspectInstance can only be used inside an if() clause for singleton aspects (compiler limitation)");
+ ignoreFurtherInvestigation = true;
+ return;
+ }
+ }
+ }
}
}
}
if (pointcut == null)
return;
- testMethod = makeMethod(enclosingDec.compilationResult, enclosingDec);
+ testMethod = makeIfMethod(enclosingDec.compilationResult, enclosingDec, typeDec);
AstUtil.addMethodDeclaration(typeDec, testMethod);
}
// XXX todo: make sure that errors in Arguments only get displayed once
- private MethodDeclaration makeMethod(CompilationResult result, MethodDeclaration enclosingDec) {
+ private MethodDeclaration makeIfMethod(CompilationResult result, MethodDeclaration enclosingDec,
+ TypeDeclaration containingTypeDec) {
MethodDeclaration ret = new IfMethodDeclaration(result, pointcut);
ret.modifiers = ClassFileConstants.AccStatic | ClassFileConstants.AccFinal | ClassFileConstants.AccPublic;
ret.returnType = AstUtil.makeTypeReference(TypeBinding.BOOLEAN);
// }
// hashcode of expression
ret.selector = ifSelector.toString().toCharArray();
- ret.arguments = makeArguments(enclosingDec);
+ ret.arguments = makeArguments(enclosingDec, containingTypeDec);
ret.statements = new Statement[] { new ReturnStatement(expr, expr.sourceStart, expr.sourceEnd) };
return ret;
}
- private Argument[] makeArguments(MethodDeclaration enclosingDec) {
+ private Argument[] makeArguments(MethodDeclaration enclosingDec, TypeDeclaration containingTypeDec) {
Argument[] baseArguments = enclosingDec.arguments;
int len = baseArguments.length;
if (enclosingDec instanceof AdviceDeclaration) {
Argument a = baseArguments[i];
ret[i] = new Argument(a.name, AstUtil.makeLongPos(a.sourceStart, a.sourceEnd), a.type, Modifier.FINAL);
}
- ret = AdviceDeclaration.addTjpArguments(ret);
+ ret = AdviceDeclaration.addTjpArguments(ret, containingTypeDec);
return ret;
}
((NewConstructorTypeMunger) munger).setExplicitConstructor(world.makeResolvedMember(explicitConstructor));
} else {
((NewConstructorTypeMunger) munger).setExplicitConstructor(new ResolvedMemberImpl(Member.CONSTRUCTOR, world
- .fromBinding(onTypeBinding.superclass()), 0, ResolvedType.VOID, "<init>", UnresolvedType.NONE));
+ .fromBinding(onTypeBinding.superclass()), 0, UnresolvedType.VOID, "<init>", UnresolvedType.NONE));
}
return new AjAttribute.TypeMunger(munger);
}
ResolvedMember sig = munger.getSignature();
UnresolvedType aspectType = world.fromBinding(upperScope.referenceContext.binding);
- if (sig.getReturnType() == ResolvedType.VOID
- || (sig.getReturnType().isArray() && (sig.getReturnType().getComponentType() == ResolvedType.VOID))) {
+ if (sig.getReturnType().equals(UnresolvedType.VOID)
+ || (sig.getReturnType().isArray() && (sig.getReturnType().getComponentType().equals(UnresolvedType.VOID)))) {
upperScope.problemReporter().signalError(sourceStart, sourceEnd, "field type can not be void");
}
if (initialization == null) {
this.statements = new Statement[] { new ReturnStatement(null, 0, 0), };
} else if (!onTypeBinding.isInterface()) {
- MethodBinding writeMethod = world.makeMethodBinding(AjcMemberMaker.interFieldSetDispatcher(sig, aspectType), munger
- .getTypeVariableAliases());
+ MethodBinding writeMethod = world.makeMethodBinding(AjcMemberMaker.interFieldSetDispatcher(sig, aspectType),
+ munger.getTypeVariableAliases());
// For the body of an intertype field initalizer, generate a call to the inter field set dispatcher
// method as that casts the shadow of a field set join point.
if (Modifier.isStatic(declaredModifiers)) {
- this.statements = new Statement[] { new KnownMessageSend(writeMethod, AstUtil
- .makeNameReference(writeMethod.declaringClass), new Expression[] { initialization }), };
+ this.statements = new Statement[] { new KnownMessageSend(writeMethod,
+ AstUtil.makeNameReference(writeMethod.declaringClass), new Expression[] { initialization }), };
} else {
- this.statements = new Statement[] { new KnownMessageSend(writeMethod, AstUtil
- .makeNameReference(writeMethod.declaringClass), new Expression[] {
- AstUtil.makeLocalVariableReference(arguments[0].binding), initialization }), };
+ this.statements = new Statement[] { new KnownMessageSend(writeMethod,
+ AstUtil.makeNameReference(writeMethod.declaringClass), new Expression[] {
+ AstUtil.makeLocalVariableReference(arguments[0].binding), initialization }), };
}
} else {
// XXX something is broken about this logic. Can we write to static interface fields?
- MethodBinding writeMethod = world.makeMethodBinding(AjcMemberMaker.interFieldInterfaceSetter(sig, sig
- .getDeclaringType().resolve(world.getWorld()), aspectType), munger.getTypeVariableAliases());
+ MethodBinding writeMethod = world.makeMethodBinding(
+ AjcMemberMaker.interFieldInterfaceSetter(sig, sig.getDeclaringType().resolve(world.getWorld()), aspectType),
+ munger.getTypeVariableAliases());
if (Modifier.isStatic(declaredModifiers)) {
- this.statements = new Statement[] { new KnownMessageSend(writeMethod, AstUtil
- .makeNameReference(writeMethod.declaringClass), new Expression[] { initialization }), };
+ this.statements = new Statement[] { new KnownMessageSend(writeMethod,
+ AstUtil.makeNameReference(writeMethod.declaringClass), new Expression[] { initialization }), };
} else {
- this.statements = new Statement[] { new KnownMessageSend(writeMethod, AstUtil
- .makeLocalVariableReference(arguments[0].binding), new Expression[] { initialization }), };
+ this.statements = new Statement[] { new KnownMessageSend(writeMethod,
+ AstUtil.makeLocalVariableReference(arguments[0].binding), new Expression[] { initialization }), };
}
}
ClassFile classFile, boolean isGetter) {
MethodBinding binding;
if (isGetter) {
- binding = world.makeMethodBinding(AjcMemberMaker.interFieldGetDispatcher(sig, aspectType), munger
- .getTypeVariableAliases(), munger.getSignature().getDeclaringType());
+ binding = world.makeMethodBinding(AjcMemberMaker.interFieldGetDispatcher(sig, aspectType),
+ munger.getTypeVariableAliases(), munger.getSignature().getDeclaringType());
} else {
- binding = world.makeMethodBinding(AjcMemberMaker.interFieldSetDispatcher(sig, aspectType), munger
- .getTypeVariableAliases(), munger.getSignature().getDeclaringType());
+ binding = world.makeMethodBinding(AjcMemberMaker.interFieldSetDispatcher(sig, aspectType),
+ munger.getTypeVariableAliases(), munger.getSignature().getDeclaringType());
}
classFile.generateMethodInfoHeader(binding);
int methodAttributeOffset = classFile.contentsOffset;
- int attributeNumber = classFile.generateMethodInfoAttribute(binding, false, makeEffectiveSignatureAttribute(sig,
- isGetter ? Shadow.FieldGet : Shadow.FieldSet, false));
+ int attributeNumber = classFile.generateMethodInfoAttribute(binding, false,
+ makeEffectiveSignatureAttribute(sig, isGetter ? Shadow.FieldGet : Shadow.FieldSet, false));
int codeAttributeOffset = classFile.contentsOffset;
classFile.generateCodeAttributeHeader();
CodeStream codeStream = classFile.codeStream;
NewFieldTypeMunger fieldMunger = (NewFieldTypeMunger) munger;
- // Force use of version 1 if there is a field with that name on the type already
+ // Force use of version 1 if there is a field with that name on the type already
if (world.getItdVersion() == 1) {
fieldMunger.version = NewFieldTypeMunger.VersionOne;
} else {
}
}
- FieldBinding classField = world.makeFieldBinding(AjcMemberMaker.interFieldClassField(sig, aspectType,
- fieldMunger.version == NewFieldTypeMunger.VersionTwo), munger.getTypeVariableAliases());
+ FieldBinding classField = world.makeFieldBinding(
+ AjcMemberMaker.interFieldClassField(sig, aspectType, fieldMunger.version == NewFieldTypeMunger.VersionTwo),
+ munger.getTypeVariableAliases());
codeStream.initializeMaxLocals(binding);
if (isGetter) {
if (onTypeBinding.isInterface()) {
UnresolvedType declaringTX = sig.getDeclaringType();
ResolvedType declaringRTX = world.getWorld().resolve(declaringTX, munger.getSourceLocation());
- MethodBinding readMethod = world.makeMethodBinding(AjcMemberMaker.interFieldInterfaceGetter(sig, declaringRTX,
- aspectType), munger.getTypeVariableAliases());
+ MethodBinding readMethod = world.makeMethodBinding(
+ AjcMemberMaker.interFieldInterfaceGetter(sig, declaringRTX, aspectType), munger.getTypeVariableAliases());
generateInterfaceReadBody(binding, readMethod, codeStream);
} else {
generateClassReadBody(binding, classField, codeStream);
}
} else {
if (onTypeBinding.isInterface()) {
- MethodBinding writeMethod = world.makeMethodBinding(AjcMemberMaker.interFieldInterfaceSetter(sig, world.getWorld()
- .resolve(sig.getDeclaringType(), munger.getSourceLocation()), aspectType), munger.getTypeVariableAliases());
+ MethodBinding writeMethod = world.makeMethodBinding(
+ AjcMemberMaker.interFieldInterfaceSetter(sig,
+ world.getWorld().resolve(sig.getDeclaringType(), munger.getSourceLocation()), aspectType),
+ munger.getTypeVariableAliases());
generateInterfaceWriteBody(binding, writeMethod, codeStream);
} else {
generateClassWriteBody(binding, classField, codeStream);
boolean needsDynamic = false;
boolean needsStatic = false;
boolean needsStaticEnclosing = false;
+ boolean needsThisAspectInstance = false;
boolean hasEffectivelyStaticRef = false;
boolean hasConstantReference = false;
boolean constantReferenceValue = false; // only has valid value when hasConstantReference is true
LocalVariableBinding thisJoinPointDec;
LocalVariableBinding thisJoinPointStaticPartDec;
LocalVariableBinding thisEnclosingJoinPointStaticPartDec;
+ LocalVariableBinding thisAspectInstanceDec;
LocalVariableBinding thisJoinPointDecLocal;
LocalVariableBinding thisJoinPointStaticPartDecLocal;
LocalVariableBinding thisEnclosingJoinPointStaticPartDecLocal;
+ LocalVariableBinding thisAspectInstanceDecLocal;
boolean replaceEffectivelyStaticRefs = false;
+ boolean isIf = true;
+
AbstractMethodDeclaration method;
ThisJoinPointVisitor(AbstractMethodDeclaration method) {
this.method = method;
- int index = method.arguments.length - 3;
+ if (method instanceof AdviceDeclaration) {
+ isIf = false;
+ }
+ int index = method.arguments.length - 3 - (isIf ? 1 : 0);
thisJoinPointStaticPartDecLocal = method.scope.locals[index];
thisJoinPointStaticPartDec = method.arguments[index++].binding;
thisJoinPointDec = method.arguments[index++].binding;
thisEnclosingJoinPointStaticPartDecLocal = method.scope.locals[index];
thisEnclosingJoinPointStaticPartDec = method.arguments[index++].binding;
+ if (isIf) {
+ thisAspectInstanceDecLocal = method.scope.locals[index];
+ thisAspectInstanceDec = method.arguments[index++].binding;
+ }
}
public void computeJoinPointParams() {
needsStatic = true;
} else if (isRef(ref, thisEnclosingJoinPointStaticPartDec)) {
needsStaticEnclosing = true;
+ } else if (isIf && isRef(ref, thisAspectInstanceDec)) {
+ needsThisAspectInstance = true;
} else if (ref.constant != null && ref.constant != Constant.NotAConstant) {
if (ref.constant instanceof BooleanConstant) {
hasConstantReference = true;
this.computeJoinPointParams();
MethodBinding binding = method.binding;
- int index = binding.parameters.length - 3;
+ int index = binding.parameters.length - 3 - (isIf ? 1 : 0);
+
+ if (isIf) {
+ if (needsThisAspectInstance) {
+ extraArgumentFlags |= Advice.ThisAspectInstance;
+ } else {
+ removeParameter(index + 3);
+ }
+ }
+
if (needsStaticEnclosing) {
extraArgumentFlags |= Advice.ThisEnclosingJoinPointStaticPart;
} else {
return extraArgumentFlags;
}
+ public boolean usedThisAspectInstance() {
+ return needsThisAspectInstance;
+ }
+
private void removeParameter(int indexToRemove) {
// TypeBinding[] parameters = method.binding.parameters;
method.scope.locals = removeLocalBinding(indexToRemove, method.scope.locals);
private TypeBinding makeTypeBinding1(UnresolvedType typeX) {
if (typeX.isPrimitiveType()) {
- if (typeX == ResolvedType.BOOLEAN) {
+ if (typeX.equals(UnresolvedType.BOOLEAN)) {
return TypeBinding.BOOLEAN;
}
- if (typeX == ResolvedType.BYTE) {
+ if (typeX.equals(UnresolvedType.BYTE)) {
return TypeBinding.BYTE;
}
- if (typeX == ResolvedType.CHAR) {
+ if (typeX.equals(UnresolvedType.CHAR)) {
return TypeBinding.CHAR;
}
- if (typeX == ResolvedType.DOUBLE) {
+ if (typeX.equals(UnresolvedType.DOUBLE)) {
return TypeBinding.DOUBLE;
}
- if (typeX == ResolvedType.FLOAT) {
+ if (typeX.equals(UnresolvedType.FLOAT)) {
return TypeBinding.FLOAT;
}
- if (typeX == ResolvedType.INT) {
+ if (typeX.equals(UnresolvedType.INT)) {
return TypeBinding.INT;
}
- if (typeX == ResolvedType.LONG) {
+ if (typeX.equals(UnresolvedType.LONG)) {
return TypeBinding.LONG;
}
- if (typeX == ResolvedType.SHORT) {
+ if (typeX.equals(UnresolvedType.SHORT)) {
return TypeBinding.SHORT;
}
- if (typeX == ResolvedType.VOID) {
+ if (typeX.equals(UnresolvedType.VOID)) {
return TypeBinding.VOID;
}
throw new RuntimeException("weird primitive type " + typeX);
* PARC initial implementation
* ******************************************************************/
-
package org.aspectj.ajdt.internal.compiler.lookup;
-
-import org.aspectj.ajdt.internal.compiler.ast.*;
+import org.aspectj.ajdt.internal.compiler.ast.AdviceDeclaration;
+import org.aspectj.ajdt.internal.compiler.ast.InterTypeConstructorDeclaration;
+import org.aspectj.ajdt.internal.compiler.ast.InterTypeDeclaration;
+import org.aspectj.ajdt.internal.compiler.ast.InterTypeFieldDeclaration;
+import org.aspectj.ajdt.internal.compiler.ast.InterTypeMethodDeclaration;
import org.aspectj.bridge.ISourceLocation;
-import org.aspectj.weaver.*;
-import org.aspectj.weaver.ast.Var;
-import org.aspectj.org.eclipse.jdt.internal.compiler.ast.*;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Clinit;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
+import org.aspectj.weaver.Member;
+import org.aspectj.weaver.MemberImpl;
+import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.UnresolvedType;
+import org.aspectj.weaver.World;
+import org.aspectj.weaver.ast.Var;
/**
* This is only used for declare soft right now.
*
- * It might be used for other compile-time matching, but in all such cases
- * this and target pcds can't be used. We might not behave correctly in
- * such cases.
+ * It might be used for other compile-time matching, but in all such cases this and target pcds can't be used. We might not behave
+ * correctly in such cases.
*/
public class EclipseShadow extends Shadow {
EclipseFactory world;
ASTNode astNode;
ReferenceContext context;
- //AbstractMethodDeclaration enclosingMethod;
- public EclipseShadow(EclipseFactory world, Kind kind, Member signature, ASTNode astNode,
- ReferenceContext context)
- {
+ // AbstractMethodDeclaration enclosingMethod;
+
+ public EclipseShadow(EclipseFactory world, Kind kind, Member signature, ASTNode astNode, ReferenceContext context) {
super(kind, signature, null);
this.world = world;
this.astNode = astNode;
return world.getWorld();
}
-
public UnresolvedType getEnclosingType() {
if (context instanceof TypeDeclaration) {
- return world.fromBinding(((TypeDeclaration)context).binding);
+ return world.fromBinding(((TypeDeclaration) context).binding);
} else if (context instanceof AbstractMethodDeclaration) {
- return world.fromBinding(((AbstractMethodDeclaration)context).binding.declaringClass);
+ return world.fromBinding(((AbstractMethodDeclaration) context).binding.declaringClass);
} else {
return ResolvedType.MISSING;
}
}
-
+
public ISourceLocation getSourceLocation() {
- //XXX need to fill this in ASAP
+ // XXX need to fill this in ASAP
return null;
}
public Member getEnclosingCodeSignature() {
if (context instanceof TypeDeclaration) {
- return new MemberImpl(Member.STATIC_INITIALIZATION, getEnclosingType(), 0,
- ResolvedType.VOID, "<clinit>", UnresolvedType.NONE);
+ return new MemberImpl(Member.STATIC_INITIALIZATION, getEnclosingType(), 0, UnresolvedType.VOID, "<clinit>",
+ UnresolvedType.NONE);
} else if (context instanceof AbstractMethodDeclaration) {
- return world.makeResolvedMember(((AbstractMethodDeclaration)context).binding);
+ return world.makeResolvedMember(((AbstractMethodDeclaration) context).binding);
} else {
return null;
}
public Var getKindedAnnotationVar(UnresolvedType annotationType) {
throw new RuntimeException("unimplemented");
}
-
+
public Var getTargetAnnotationVar(UnresolvedType annotationType) {
throw new RuntimeException("unimplemented");
}
-
+
public Var getThisAnnotationVar(UnresolvedType annotationType) {
throw new RuntimeException("unimplemented");
}
-
+
+ public Var getThisAspectInstanceVar(ResolvedType aspectType) {
+ throw new RuntimeException("unimplemented");
+ }
+
public Var getWithinAnnotationVar(UnresolvedType annotationType) {
throw new RuntimeException("unimplemented");
}
-
+
public Var getWithinCodeAnnotationVar(UnresolvedType annotationType) {
throw new RuntimeException("unimplemented");
}
// --- factory methods
-
- public static EclipseShadow makeShadow(EclipseFactory world, ASTNode astNode,
- ReferenceContext context)
- {
- //XXX make sure we're getting the correct declaring type at call-site
+
+ public static EclipseShadow makeShadow(EclipseFactory world, ASTNode astNode, ReferenceContext context) {
+ // XXX make sure we're getting the correct declaring type at call-site
if (astNode instanceof AllocationExpression) {
- AllocationExpression e = (AllocationExpression)astNode;
- return new EclipseShadow(world, Shadow.ConstructorCall,
- world.makeResolvedMember(e.binding), astNode, context);
+ AllocationExpression e = (AllocationExpression) astNode;
+ return new EclipseShadow(world, Shadow.ConstructorCall, world.makeResolvedMember(e.binding), astNode, context);
} else if (astNode instanceof MessageSend) {
- MessageSend e = (MessageSend)astNode;
- if (e.isSuperAccess()) return null; // super calls don't have shadows
- return new EclipseShadow(world, Shadow.MethodCall,
- world.makeResolvedMember(e.binding), astNode, context);
+ MessageSend e = (MessageSend) astNode;
+ if (e.isSuperAccess())
+ return null; // super calls don't have shadows
+ return new EclipseShadow(world, Shadow.MethodCall, world.makeResolvedMember(e.binding), astNode, context);
} else if (astNode instanceof ExplicitConstructorCall) {
- //??? these should be ignored, they don't have shadows
- return null;
+ // ??? these should be ignored, they don't have shadows
+ return null;
} else if (astNode instanceof AbstractMethodDeclaration) {
- AbstractMethodDeclaration e = (AbstractMethodDeclaration)astNode;
+ AbstractMethodDeclaration e = (AbstractMethodDeclaration) astNode;
Shadow.Kind kind;
if (e instanceof AdviceDeclaration) {
kind = Shadow.AdviceExecution;
} else if (e instanceof InterTypeMethodDeclaration) {
- return new EclipseShadow(world, Shadow.MethodExecution,
- ((InterTypeDeclaration)e).getSignature(), astNode, context);
+ return new EclipseShadow(world, Shadow.MethodExecution, ((InterTypeDeclaration) e).getSignature(), astNode, context);
} else if (e instanceof InterTypeConstructorDeclaration) {
- return new EclipseShadow(world, Shadow.ConstructorExecution,
- ((InterTypeDeclaration)e).getSignature(), astNode, context);
+ return new EclipseShadow(world, Shadow.ConstructorExecution, ((InterTypeDeclaration) e).getSignature(), astNode,
+ context);
} else if (e instanceof InterTypeFieldDeclaration) {
return null;
} else if (e instanceof MethodDeclaration) {
} else if (e instanceof ConstructorDeclaration) {
kind = Shadow.ConstructorExecution;
} else if (e instanceof Clinit) {
- kind = Shadow.StaticInitialization;
+ kind = Shadow.StaticInitialization;
} else {
return null;
- //throw new RuntimeException("unimplemented: " + e);
+ // throw new RuntimeException("unimplemented: " + e);
}
- return
- new EclipseShadow(world, kind,
- world.makeResolvedMember(e.binding,kind), astNode, context);
+ return new EclipseShadow(world, kind, world.makeResolvedMember(e.binding, kind), astNode, context);
} else if (astNode instanceof TypeDeclaration) {
return new EclipseShadow(world, Shadow.StaticInitialization,
- new MemberImpl(Member.STATIC_INITIALIZATION,
- world.fromBinding(((TypeDeclaration)astNode).binding), 0,
- ResolvedType.VOID, "<clinit>", UnresolvedType.NONE),
- astNode, context);
+ new MemberImpl(Member.STATIC_INITIALIZATION, world.fromBinding(((TypeDeclaration) astNode).binding), 0,
+ UnresolvedType.VOID, "<clinit>", UnresolvedType.NONE), astNode, context);
} else {
return null;
- //throw new RuntimeException("unimplemented: " + astNode);
- }
+ // throw new RuntimeException("unimplemented: " + astNode);
+ }
}
-
}
public void notePrivilegedTypeAccess(ReferenceBinding type, ASTNode location) {
ResolvedMember key = new ResolvedMemberImpl(Member.STATIC_INITIALIZATION, inAspect.factory.fromEclipse(type), 0,
- ResolvedType.VOID, "", UnresolvedType.NONE);
+ UnresolvedType.VOID, "", UnresolvedType.NONE);
checkWeaveAccess(key.getDeclaringType(), location);
accessors.put(key, key);