summaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-07-11 13:48:13 +0000
committeracolyer <acolyer>2005-07-11 13:48:13 +0000
commitebeba53b5bc8c8134ac1bfe119c3154008862cc0 (patch)
tree9be9c9f08523a790b365b6a028929bbc62da453b /org.aspectj.ajdt.core
parentf8934add4ef633393763bb753981bd6c6de41027 (diff)
downloadaspectj-ebeba53b5bc8c8134ac1bfe119c3154008862cc0.tar.gz
aspectj-ebeba53b5bc8c8134ac1bfe119c3154008862cc0.zip
changed EclipseFactory.makeResolvedMember from static to non-static member and fully resolved all types involved.
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java8
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java4
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/SuperFixerVisitor.java6
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java50
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java8
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java4
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedFieldBinding.java4
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedHandler.java4
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java4
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java11
10 files changed, 55 insertions, 48 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java
index 06e7381c0..779dc9ee4 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java
@@ -153,7 +153,7 @@ public class AccessForInlineVisitor extends ASTVisitor {
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);
@@ -176,14 +176,14 @@ public class AccessForInlineVisitor extends ASTVisitor {
// 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(
@@ -202,7 +202,7 @@ public class AccessForInlineVisitor extends ASTVisitor {
}
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;
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 7b09a4d07..d28960b4a 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
@@ -218,7 +218,7 @@ public class InterTypeConstructorDeclaration extends InterTypeDeclaration {
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,
@@ -250,7 +250,7 @@ public class InterTypeConstructorDeclaration extends InterTypeDeclaration {
((NewConstructorTypeMunger)munger).setExplicitConstructor(
- EclipseFactory.makeResolvedMember(explicitConstructor));
+ world.makeResolvedMember(explicitConstructor));
} else {
((NewConstructorTypeMunger)munger).setExplicitConstructor(
new ResolvedMember(Member.CONSTRUCTOR,
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 0a539cfd7..9bb02707f 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.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;
@@ -95,8 +96,9 @@ public class SuperFixerVisitor extends ASTVisitor {
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);
}
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
index 65aa041ed..6ef49eabc 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
@@ -37,6 +37,7 @@ import org.aspectj.weaver.Shadow;
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;
@@ -239,23 +240,24 @@ public class EclipseFactory {
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) {
@@ -336,33 +338,33 @@ public class EclipseFactory {
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);
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java
index 3ba294132..6a27e4bf6 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java
@@ -68,7 +68,7 @@ public class EclipseShadow extends Shadow {
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;
}
@@ -134,12 +134,12 @@ public class EclipseShadow extends Shadow {
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;
@@ -167,7 +167,7 @@ public class EclipseShadow extends Shadow {
//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,
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
index d6ce0b6da..72175f599 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
@@ -151,7 +151,7 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
declaredPointcuts.add(df);
} else {
if (amd.binding == null || !amd.binding.isValidBinding()) continue;
- declaredMethods.add(EclipseFactory.makeResolvedMember(amd.binding));
+ declaredMethods.add(factory.makeResolvedMember(amd.binding));
}
}
}
@@ -159,7 +159,7 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
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[])
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedFieldBinding.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedFieldBinding.java
index 670e6c721..0807c3d61 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedFieldBinding.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedFieldBinding.java
@@ -35,11 +35,11 @@ public class PrivilegedFieldBinding extends FieldBinding {
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;
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedHandler.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedHandler.java
index 6ef97d471..8306a499d 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedHandler.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedHandler.java
@@ -45,7 +45,7 @@ public class PrivilegedHandler implements IPrivilegedHandler {
}
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);
@@ -56,7 +56,7 @@ public class PrivilegedHandler implements IPrivilegedHandler {
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;
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
index 0e9f8f2e7..ce41e4809 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
@@ -163,7 +163,7 @@ public class AjProblemReporter extends ProblemReporter {
m.getAspectType(),
sig.getDeclaringType().isInterface(
factory.getWorld())),
- EclipseFactory.makeResolvedMember(concreteMethod))) {
+ factory.makeResolvedMember(concreteMethod))) {
return;
}
}
@@ -210,7 +210,7 @@ public class AjProblemReporter extends ProblemReporter {
m.getAspectType(),
sig.getDeclaringType().isInterface(
factory.getWorld())),
- EclipseFactory.makeResolvedMember(abstractMethod))) {
+ factory.makeResolvedMember(abstractMethod))) {
return;
}
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java
index 8f5cc266d..9ff31370c 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java
@@ -413,11 +413,12 @@ public class AsmHierarchyBuilder extends ASTVisitor {
}
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;
@@ -496,7 +497,8 @@ public class AsmHierarchyBuilder extends ASTVisitor {
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
@@ -684,7 +686,8 @@ public class AsmHierarchyBuilder extends ASTVisitor {
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