binding.modifiers = AstUtil.makePackageVisible(binding.modifiers);
}
- ResolvedMember m = EclipseFactory.makeResolvedMember(binding, receiverType);
+ ResolvedMember m = world.makeResolvedMember(binding, receiverType);
if (inAspect.accessForInline.containsKey(m)) return (FieldBinding)inAspect.accessForInline.get(m);
FieldBinding ret = new InlineAccessFieldBinding(inAspect, binding, m);
// declaring class? After all, the field is private but we can see it from
// where we are.
binding.modifiers = AstUtil.makePackageVisible(binding.modifiers);
- m = EclipseFactory.makeResolvedMember(binding);
+ m = world.makeResolvedMember(binding);
} else {
// Sometimes receiverType and binding.declaringClass are *not* the same.
// Sometimes receiverType is a subclass of binding.declaringClass. In these situations
// we want the generated inline accessor to call the method on the subclass (at
// runtime this will be satisfied by the super).
- m = EclipseFactory.makeResolvedMember(binding, receiverType);
+ m = world.makeResolvedMember(binding, receiverType);
}
if (inAspect.accessForInline.containsKey(m)) return (MethodBinding)inAspect.accessForInline.get(m);
MethodBinding ret = world.makeMethodBinding(
}
private MethodBinding getSuperAccessMethod(MethodBinding binding) {
- ResolvedMember m = EclipseFactory.makeResolvedMember(binding);
+ ResolvedMember m = world.makeResolvedMember(binding);
ResolvedMember superAccessMember = AjcMemberMaker.superAccessMethod(inAspect.typeX, m);
if (inAspect.superAccessForInline.containsKey(superAccessMember)) {
return ((SuperAccessMethodPair)inAspect.superAccessForInline.get(superAccessMember)).accessMethod;
ResolvedTypeX declaringTypeX = world.fromEclipse(onTypeBinding);
ResolvedTypeX aspectType = world.fromEclipse(classScope.referenceContext.binding);
- ResolvedMember bindingAsMember = EclipseFactory.makeResolvedMember(binding);
+ ResolvedMember bindingAsMember = world.makeResolvedMember(binding);
ResolvedMember signature =
new ResolvedMember(Member.CONSTRUCTOR, declaringTypeX, declaredModifiers,
((NewConstructorTypeMunger)munger).setExplicitConstructor(
- EclipseFactory.makeResolvedMember(explicitConstructor));
+ world.makeResolvedMember(explicitConstructor));
} else {
((NewConstructorTypeMunger)munger).setExplicitConstructor(
new ResolvedMember(Member.CONSTRUCTOR,
import java.util.HashSet;
import java.util.Set;
+import org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory;
import org.aspectj.ajdt.internal.compiler.lookup.InterTypeMethodBinding;
import org.aspectj.weaver.NameMangler;
targetClass);
AstUtil.replaceMethodBinding(call, superAccessBinding);
-
- ResolvedMember targetMember = EclipseFactory.makeResolvedMember(superBinding);
+
+ EclipseFactory factory = ((AjLookupEnvironment)method.scope.environment()).factory;
+ ResolvedMember targetMember = factory.makeResolvedMember(superBinding);
superMethodsCalled.add(targetMember);
}
}
import org.aspectj.weaver.TypeVariable;
import org.aspectj.weaver.TypeVariableReferenceType;
import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.UnresolvedTypeVariableReferenceType;
import org.aspectj.weaver.World;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode;
return TypeX.forName(getName(binding));
}
+ private static Map typeVariableBindingsInProgress = new HashMap();
private static TypeX fromTypeVariableBinding(TypeVariableBinding aTypeVariableBinding) {
+ if (typeVariableBindingsInProgress.containsKey(aTypeVariableBinding)) {
+ return (TypeX) typeVariableBindingsInProgress.get(aTypeVariableBinding);
+ }
+ UnresolvedTypeVariableReferenceType ret = new UnresolvedTypeVariableReferenceType();
+ typeVariableBindingsInProgress.put(aTypeVariableBinding,ret);
// TODO -- what about lower bounds??
-// String name = new String(aTypeVariableBinding.sourceName());
-// TypeX superclassType = fromBinding(aTypeVariableBinding.superclass());
-// TypeX[] superinterfaces = new TypeX[aTypeVariableBinding.superInterfaces.length];
-// for (int i = 0; i < superinterfaces.length; i++) {
-// superinterfaces[i] = fromBinding(aTypeVariableBinding.superInterfaces[i]);
-// }
-// TypeVariable tv = new TypeVariable(name,superclassType,superinterfaces);
-// TypeVariableReferenceType ret = null; /// how do we get a world???
-// return ret;
- // old code...
- if (aTypeVariableBinding.firstBound!=null) {
- return TypeX.forName(getName(aTypeVariableBinding.firstBound)); // XXX needs more investigation as to whether this is correct in all cases
- } else {
- return TypeX.forName(getName(aTypeVariableBinding.superclass));
+ String name = new String(aTypeVariableBinding.sourceName());
+ TypeX superclassType = fromBinding(aTypeVariableBinding.superclass());
+ TypeX[] superinterfaces = new TypeX[aTypeVariableBinding.superInterfaces.length];
+ for (int i = 0; i < superinterfaces.length; i++) {
+ superinterfaces[i] = fromBinding(aTypeVariableBinding.superInterfaces[i]);
}
+ TypeVariable tv = new TypeVariable(name,superclassType,superinterfaces);
+ ret.setTypeVariable(tv);
+ typeVariableBindingsInProgress.remove(aTypeVariableBinding);
+ return ret;
}
public static TypeX[] fromBindings(TypeBinding[] bindings) {
return finishedTypeMungers;
}
- public static ResolvedMember makeResolvedMember(MethodBinding binding) {
+ public ResolvedMember makeResolvedMember(MethodBinding binding) {
return makeResolvedMember(binding, binding.declaringClass);
}
- public static ResolvedMember makeResolvedMember(MethodBinding binding, TypeBinding declaringType) {
+ public ResolvedMember makeResolvedMember(MethodBinding binding, TypeBinding declaringType) {
//System.err.println("member for: " + binding + ", " + new String(binding.declaringClass.sourceName));
ResolvedMember ret = new ResolvedMember(
binding.isConstructor() ? Member.CONSTRUCTOR : Member.METHOD,
- fromBinding(declaringType),
+ world.resolve(fromBinding(declaringType)),
binding.modifiers,
- fromBinding(binding.returnType),
+ world.resolve(fromBinding(binding.returnType)),
new String(binding.selector),
- fromBindings(binding.parameters),
- fromBindings(binding.thrownExceptions));
+ world.resolve(fromBindings(binding.parameters)),
+ world.resolve(fromBindings(binding.thrownExceptions)));
return ret;
}
- public static ResolvedMember makeResolvedMember(FieldBinding binding) {
+ public ResolvedMember makeResolvedMember(FieldBinding binding) {
return makeResolvedMember(binding, binding.declaringClass);
}
- public static ResolvedMember makeResolvedMember(FieldBinding binding, TypeBinding receiverType) {
+ public ResolvedMember makeResolvedMember(FieldBinding binding, TypeBinding receiverType) {
return new ResolvedMember(
Member.FIELD,
- fromBinding(receiverType),
+ world.resolve(fromBinding(receiverType)),
binding.modifiers,
- fromBinding(binding.type),
+ world.resolve(fromBinding(binding.type)),
new String(binding.name),
TypeX.NONE);
}
return new Member(Member.STATIC_INITIALIZATION, getEnclosingType(), 0,
ResolvedTypeX.VOID, "<clinit>", TypeX.NONE);
} else if (context instanceof AbstractMethodDeclaration) {
- return EclipseFactory.makeResolvedMember(((AbstractMethodDeclaration)context).binding);
+ return world.makeResolvedMember(((AbstractMethodDeclaration)context).binding);
} else {
return null;
}
if (astNode instanceof AllocationExpression) {
AllocationExpression e = (AllocationExpression)astNode;
return new EclipseShadow(world, Shadow.ConstructorCall,
- EclipseFactory.makeResolvedMember(e.binding), astNode, context);
+ 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,
- EclipseFactory.makeResolvedMember(e.binding), astNode, context);
+ world.makeResolvedMember(e.binding), astNode, context);
} else if (astNode instanceof ExplicitConstructorCall) {
//??? these should be ignored, they don't have shadows
return null;
//throw new RuntimeException("unimplemented: " + e);
}
return new EclipseShadow(world, kind,
- EclipseFactory.makeResolvedMember(e.binding), astNode, context);
+ world.makeResolvedMember(e.binding), astNode, context);
} else if (astNode instanceof TypeDeclaration) {
return new EclipseShadow(world, Shadow.StaticInitialization,
new Member(Member.STATIC_INITIALIZATION,
declaredPointcuts.add(df);
} else {
if (amd.binding == null || !amd.binding.isValidBinding()) continue;
- declaredMethods.add(EclipseFactory.makeResolvedMember(amd.binding));
+ declaredMethods.add(factory.makeResolvedMember(amd.binding));
}
}
}
FieldBinding[] fields = binding.fields();
for (int i=0, len=fields.length; i < len; i++) {
FieldBinding f = fields[i];
- declaredFields.add(EclipseFactory.makeResolvedMember(f));
+ declaredFields.add(factory.makeResolvedMember(f));
}
this.declaredPointcuts = (ResolvedPointcutDefinition[])
this.reader = new SimpleSyntheticAccessMethodBinding(
inAspect.factory.makeMethodBinding(
AjcMemberMaker.privilegedAccessMethodForFieldGet(
- inAspect.typeX, EclipseFactory.makeResolvedMember(baseField)
+ inAspect.typeX, inAspect.factory.makeResolvedMember(baseField)
)));
this.writer = new SimpleSyntheticAccessMethodBinding(inAspect.factory.makeMethodBinding(
AjcMemberMaker.privilegedAccessMethodForFieldSet(
- inAspect.typeX, EclipseFactory.makeResolvedMember(baseField)
+ inAspect.typeX, inAspect.factory.makeResolvedMember(baseField)
)));
this.constant = ASTNode.NotAConstant;
}
public FieldBinding getPrivilegedAccessField(FieldBinding baseField, ASTNode location) {
- ResolvedMember key = EclipseFactory.makeResolvedMember(baseField);
+ ResolvedMember key = inAspect.factory.makeResolvedMember(baseField);
if (accessors.containsKey(key)) return (FieldBinding)accessors.get(key);
FieldBinding ret = new PrivilegedFieldBinding(inAspect, baseField);
checkWeaveAccess(key.getDeclaringType(), location);
public MethodBinding getPrivilegedAccessMethod(MethodBinding baseMethod, ASTNode location) {
if (baseMethod.alwaysNeedsAccessMethod()) return baseMethod;
- ResolvedMember key = EclipseFactory.makeResolvedMember(baseMethod);
+ ResolvedMember key = inAspect.factory.makeResolvedMember(baseMethod);
if (accessors.containsKey(key)) return (MethodBinding)accessors.get(key);
MethodBinding ret;
m.getAspectType(),
sig.getDeclaringType().isInterface(
factory.getWorld())),
- EclipseFactory.makeResolvedMember(concreteMethod))) {
+ factory.makeResolvedMember(concreteMethod))) {
return;
}
}
m.getAspectType(),
sig.getDeclaringType().isInterface(
factory.getWorld())),
- EclipseFactory.makeResolvedMember(abstractMethod))) {
+ factory.makeResolvedMember(abstractMethod))) {
return;
}
}
}
private ResolvedMember getPointcutDeclaration(ReferencePointcut rp, MethodDeclaration declaration) {
- World world = ((AjLookupEnvironment)declaration.scope.environment()).factory.getWorld();
+ EclipseFactory factory = ((AjLookupEnvironment)declaration.scope.environment()).factory;
+ World world = factory.getWorld();
TypeX onType = rp.onType;
if (onType == null) {
if (declaration.binding != null) {
- Member member = EclipseFactory.makeResolvedMember(declaration.binding);
+ Member member = factory.makeResolvedMember(declaration.binding);
onType = member.getDeclaringType();
} else {
return null;
String memberName = "";
String memberBytecodeSignature = "";
try {
- Member member = EclipseFactory.makeResolvedMember(methodDeclaration.binding);
+ EclipseFactory factory = ((AjLookupEnvironment)methodDeclaration.scope.environment()).factory;
+ Member member = factory.makeResolvedMember(methodDeclaration.binding);
memberName = member.getName();
memberBytecodeSignature = member.getSignature();
} catch (BCException bce) { // bad type name
String memberName = "";
String memberBytecodeSignature = "";
try {
- Member member = EclipseFactory.makeResolvedMember(constructorDeclaration.binding);
+ EclipseFactory factory = ((AjLookupEnvironment)constructorDeclaration.scope.environment()).factory;
+ Member member = factory.makeResolvedMember(constructorDeclaration.binding);
memberName = member.getName();
memberBytecodeSignature = member.getSignature();
} catch (BCException bce) { // bad type name