aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-07-15 18:11:34 +0000
committeracolyer <acolyer>2005-07-15 18:11:34 +0000
commitcad71c760d6e073cfc63395b472308175a22c094 (patch)
tree1b63498499feec154cc05610e1e796c3092ac52a /org.aspectj.ajdt.core
parent17f150e1033357d7aa561200bd32526118183857 (diff)
downloadaspectj-cad71c760d6e073cfc63395b472308175a22c094.tar.gz
aspectj-cad71c760d6e073cfc63395b472308175a22c094.zip
makes fromBinding in EclipseFactory an instance rather than static method. This paves the way for fromBinding to return a ResolvedType (which needs the world that the instance contains) rather than an UnresolvedType.
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java5
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java4
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java12
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/IfMethodDeclaration.java6
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java14
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java8
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java8
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java13
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDesignator.java4
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/SuperFixerVisitor.java11
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java9
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java2
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java11
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseScope.java6
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java6
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java6
16 files changed, 67 insertions, 58 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
index feebe0bdd..d8d39277b 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
@@ -296,13 +296,14 @@ public class AdviceDeclaration extends AjMethodDeclaration {
// override, Called by ClassScope.postParse
public void postParse(TypeDeclaration typeDec) {
- int adviceSequenceNumberInType = ((AspectDeclaration)typeDec).adviceCounter++;
+ AspectDeclaration aspectDecl = (AspectDeclaration)typeDec;
+ int adviceSequenceNumberInType = aspectDecl.adviceCounter++;
StringBuffer stringifiedPointcut = new StringBuffer(30);
pointcutDesignator.print(0,stringifiedPointcut);
this.selector =
NameMangler.adviceName(
- EclipseFactory.fromBinding(typeDec.binding),
+ EclipseFactory.getName(typeDec.binding).replace('.', '_'),
kind,
adviceSequenceNumberInType,
stringifiedPointcut.toString().hashCode()).toCharArray();
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java
index bd56c2590..10cc0f70a 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java
@@ -55,7 +55,7 @@ public class AspectClinit extends Clinit {
codeStream.invokestatic(world.makeMethodBindingForCall(
AjcMemberMaker.ajcPreClinitMethod(
- EclipseFactory.fromBinding(classScope.referenceContext.binding)
+ world.fromBinding(classScope.referenceContext.binding)
)));
}
super.generateSyntheticCode(classScope, codeStream);
@@ -71,7 +71,7 @@ public class AspectClinit extends Clinit {
codeStream.invokestatic(world.makeMethodBindingForCall(
AjcMemberMaker.ajcPostClinitMethod(
- EclipseFactory.fromBinding(classScope.referenceContext.binding)
+ world.fromBinding(classScope.referenceContext.binding)
)));
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java
index c03083e29..c68e8227f 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java
@@ -450,7 +450,7 @@ public class AspectDeclaration extends TypeDeclaration {
{
final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(this.scope);
generateMethod(classFile, world.makeMethodBinding(AjcMemberMaker.perCflowPush(
- EclipseFactory.fromBinding(binding))),
+ factory.fromBinding(binding))),
new BodyGenerator() {
public void generate(CodeStream codeStream) {
// body starts here
@@ -482,7 +482,7 @@ public class AspectDeclaration extends TypeDeclaration {
{
final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(this.scope);
generateMethod(classFile, world.makeMethodBinding(AjcMemberMaker.ajcPreClinitMethod(
- EclipseFactory.fromBinding(binding))),
+ world.fromBinding(binding))),
new BodyGenerator() {
public void generate(CodeStream codeStream) {
// body starts here
@@ -650,7 +650,7 @@ public class AspectDeclaration extends TypeDeclaration {
final TypeBinding interfaceType)
{
final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(this.scope);
- generateMethod(classFile, AjcMemberMaker.perObjectBind(EclipseFactory.fromBinding(binding)),
+ generateMethod(classFile, AjcMemberMaker.perObjectBind(world.fromBinding(binding)),
new BodyGenerator() {
public void generate(CodeStream codeStream) {
// body starts here
@@ -685,7 +685,7 @@ public class AspectDeclaration extends TypeDeclaration {
// PTWIMPL Generate getInstance method
private void generatePerTypeWithinGetInstanceMethod(ClassFile classFile) {
final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(this.scope);
- generateMethod(classFile, AjcMemberMaker.perTypeWithinGetInstance(EclipseFactory.fromBinding(binding)),
+ generateMethod(classFile, AjcMemberMaker.perTypeWithinGetInstance(world.fromBinding(binding)),
new BodyGenerator() {
public void generate(CodeStream codeStream) {
ExceptionLabel exc = new ExceptionLabel(codeStream,world.makeTypeBinding(UnresolvedType.JAVA_LANG_EXCEPTION));
@@ -728,7 +728,7 @@ public class AspectDeclaration extends TypeDeclaration {
private void generatePerTypeWithinCreateAspectInstanceMethod(ClassFile classFile) {
final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(this.scope);
- generateMethod(classFile, AjcMemberMaker.perTypeWithinCreateAspectInstance(EclipseFactory.fromBinding(binding)),
+ generateMethod(classFile, AjcMemberMaker.perTypeWithinCreateAspectInstance(world.fromBinding(binding)),
new BodyGenerator() {
public void generate(CodeStream codeStream) {
@@ -823,7 +823,7 @@ public class AspectDeclaration extends TypeDeclaration {
{
final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(this.scope);
generateMethod(classFile, world.makeMethodBinding(AjcMemberMaker.ajcPostClinitMethod(
- EclipseFactory.fromBinding(binding))),
+ world.fromBinding(binding))),
new BodyGenerator() {
public void generate(CodeStream codeStream) {
// body starts here
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/IfMethodDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/IfMethodDeclaration.java
index 4aa1e9ef0..b0f406cf9 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/IfMethodDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/IfMethodDeclaration.java
@@ -49,13 +49,13 @@ public class IfMethodDeclaration extends AjMethodDeclaration {
ifPointcut.extraParameterFlags |= tjp.removeUnusedExtraArguments();
//XXX this is where we should remove unavailable args if we're in a cflow
-
+ EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(scope);
ifPointcut.testMethod = new ResolvedMember(
Member.METHOD,
- EclipseFactory.fromBinding(binding.declaringClass),
+ factory.fromBinding(binding.declaringClass),
this.modifiers, ResolvedType.BOOLEAN,
new String(this.selector),
- EclipseFactory.fromBindings(this.binding.parameters));
+ factory.fromBindings(this.binding.parameters));
}
}
}
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 784f3de5a..82dd5cdc3 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
@@ -75,8 +75,8 @@ public class InterTypeConstructorDeclaration extends InterTypeDeclaration {
{
EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(scope);
- UnresolvedType aspectTypeX = EclipseFactory.fromBinding(binding.declaringClass);
- UnresolvedType targetTypeX = EclipseFactory.fromBinding(onTypeBinding);
+ UnresolvedType aspectTypeX = world.fromBinding(binding.declaringClass);
+ UnresolvedType targetTypeX = world.fromBinding(onTypeBinding);
ArrayBinding objectArrayBinding = scope.createArrayType(scope.getJavaLangObject(), 1);
@@ -96,7 +96,7 @@ public class InterTypeConstructorDeclaration extends InterTypeDeclaration {
pre.binding = world.makeMethodBinding(
AjcMemberMaker.preIntroducedConstructor(aspectTypeX, targetTypeX,
- EclipseFactory.fromBindings(binding.parameters)));
+ world.fromBindings(binding.parameters)));
pre.bindArguments();
pre.bindThrownExceptions();
@@ -144,7 +144,7 @@ public class InterTypeConstructorDeclaration extends InterTypeDeclaration {
Expression arg = explicitConstructorCall.arguments[i];
ResolvedMember conversionMethod =
- AjcMemberMaker.toObjectConversionMethod(EclipseFactory.fromBinding(explicitConstructorCall.binding.parameters[i]));
+ AjcMemberMaker.toObjectConversionMethod(world.fromBinding(explicitConstructorCall.binding.parameters[i]));
if (conversionMethod != null) {
arg = new KnownMessageSend(world.makeMethodBindingForCall(conversionMethod),
new CastExpression(new NullLiteral(0, 0),
@@ -158,7 +158,7 @@ public class InterTypeConstructorDeclaration extends InterTypeDeclaration {
LocalVariableBinding binding = pre.arguments[i].binding;
Expression arg = AstUtil.makeResolvedLocalVariableReference(binding);
ResolvedMember conversionMethod =
- AjcMemberMaker.toObjectConversionMethod(EclipseFactory.fromBinding(binding.type));
+ AjcMemberMaker.toObjectConversionMethod(world.fromBinding(binding.type));
if (conversionMethod != null) {
arg = new KnownMessageSend(world.makeMethodBindingForCall(conversionMethod),
new CastExpression(new NullLiteral(0, 0),
@@ -234,7 +234,7 @@ public class InterTypeConstructorDeclaration extends InterTypeDeclaration {
this.selector = binding.selector =
NameMangler.postIntroducedConstructor(
- EclipseFactory.fromBinding(binding.declaringClass),
+ world.fromBinding(binding.declaringClass),
declaringTypeX).toCharArray();
return new EclipseTypeMunger(world, myMunger, aspectType, this);
@@ -254,7 +254,7 @@ public class InterTypeConstructorDeclaration extends InterTypeDeclaration {
} else {
((NewConstructorTypeMunger)munger).setExplicitConstructor(
new ResolvedMember(Member.CONSTRUCTOR,
- EclipseFactory.fromBinding(onTypeBinding.superclass()),
+ world.fromBinding(onTypeBinding.superclass()),
0, ResolvedType.VOID, "<init>", UnresolvedType.NONE));
}
return new AjAttribute.TypeMunger(munger);
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java
index 2e63bf999..3ea8c54a0 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java
@@ -69,7 +69,7 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration {
EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(upperScope);
ResolvedMember sig = munger.getSignature();
- UnresolvedType aspectType = EclipseFactory.fromBinding(upperScope.referenceContext.binding);
+ UnresolvedType aspectType = world.fromBinding(upperScope.referenceContext.binding);
if (sig.getReturnType() == ResolvedType.VOID ||
(sig.getReturnType().isArray() && (sig.getReturnType().getComponentType() == ResolvedType.VOID)))
@@ -171,8 +171,8 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration {
//System.err.println("type: " + binding.returnType + ", " + returnType);
ResolvedMember sig =
- new ResolvedMember(Member.FIELD, EclipseFactory.fromBinding(onTypeBinding),
- declaredModifiers, EclipseFactory.fromBinding(binding.returnType),
+ new ResolvedMember(Member.FIELD, world.fromBinding(onTypeBinding),
+ declaredModifiers, world.fromBinding(binding.returnType),
new String(declaredSelector), UnresolvedType.NONE);
NewFieldTypeMunger myMunger = new NewFieldTypeMunger(sig, null);
@@ -205,7 +205,7 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration {
private void generateDispatchMethods(ClassScope classScope, ClassFile classFile) {
EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(classScope);
ResolvedMember sig = munger.getSignature();
- UnresolvedType aspectType = EclipseFactory.fromBinding(classScope.referenceContext.binding);
+ UnresolvedType aspectType = world.fromBinding(classScope.referenceContext.binding);
generateDispatchMethod(world, sig, aspectType, classScope, classFile, true);
generateDispatchMethod(world, sig, aspectType, classScope, classFile, false);
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
index 3ca7e5412..326e2bb99 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
@@ -124,9 +124,9 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
if (isTargetAnnotation(classScope,"method")) return null; // Error message output in isTargetAnnotation
if (isTargetEnum(classScope,"method")) return null; // Error message output in isTargetEnum
- ResolvedMember sig = new ResolvedMember(Member.METHOD, EclipseFactory.fromBinding(onTypeBinding),
- declaredModifiers, EclipseFactory.fromBinding(binding.returnType), new String(declaredSelector),
- EclipseFactory.fromBindings(binding.parameters),
+ ResolvedMember sig = new ResolvedMember(Member.METHOD, world.fromBinding(onTypeBinding),
+ declaredModifiers, world.fromBinding(binding.returnType), new String(declaredSelector),
+ world.fromBindings(binding.parameters),
world.fromEclipse(binding.thrownExceptions));
NewMethodTypeMunger myMunger = new NewMethodTypeMunger(sig, null);
@@ -163,7 +163,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
public void generateDispatchMethod(ClassScope classScope, ClassFile classFile) {
EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(classScope);
- UnresolvedType aspectType = EclipseFactory.fromBinding(classScope.referenceContext.binding);
+ UnresolvedType aspectType = world.fromBinding(classScope.referenceContext.binding);
ResolvedMember signature = munger.getSignature();
ResolvedMember dispatchMember =
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java
index 82bf1a3ea..fba0d8812 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java
@@ -47,6 +47,7 @@ public class PointcutDeclaration extends AjMethodDeclaration {
private int declaredModifiers;
private String declaredName;
private boolean generateSyntheticPointcutMethod = false;
+ private EclipseFactory world = null;
//private boolean mangleSelector = true;
private ResolvedPointcutDefinition resolvedPointcutDeclaration = null;
@@ -142,6 +143,7 @@ public class PointcutDeclaration extends AjMethodDeclaration {
}
public void resolvePointcut(ClassScope upperScope) {
+ this.world = EclipseFactory.fromScopeLookupEnvironment(upperScope);
super.resolve(upperScope);
}
@@ -166,20 +168,20 @@ public class PointcutDeclaration extends AjMethodDeclaration {
}
//System.out.println("resolved: " + getPointcut() + ", " + getPointcut().state);
- makeResolvedPointcutDefinition();
+ makeResolvedPointcutDefinition(world);
resolvedPointcutDeclaration.setPointcut(getPointcut());
super.resolveStatements();
}
- public ResolvedPointcutDefinition makeResolvedPointcutDefinition() {
+ public ResolvedPointcutDefinition makeResolvedPointcutDefinition(EclipseFactory inWorld) {
if (resolvedPointcutDeclaration != null) return resolvedPointcutDeclaration;
//System.out.println("pc: " + getPointcut() + ", " + getPointcut().state);
resolvedPointcutDeclaration = new ResolvedPointcutDefinition(
- EclipseFactory.fromBinding(this.binding.declaringClass),
+ inWorld.fromBinding(this.binding.declaringClass),
declaredModifiers,
declaredName,
- EclipseFactory.fromBindings(this.binding.parameters),
+ inWorld.fromBindings(this.binding.parameters),
getPointcut()); //??? might want to use null
resolvedPointcutDeclaration.setPosition(sourceStart, sourceEnd);
@@ -189,7 +191,7 @@ public class PointcutDeclaration extends AjMethodDeclaration {
public AjAttribute makeAttribute() {
- return new AjAttribute.PointcutDeclarationAttribute(makeResolvedPointcutDefinition());
+ return new AjAttribute.PointcutDeclarationAttribute(makeResolvedPointcutDefinition(world));
}
@@ -199,6 +201,7 @@ public class PointcutDeclaration extends AjMethodDeclaration {
* method.
*/
public void generateCode(ClassScope classScope, ClassFile classFile) {
+ this.world = EclipseFactory.fromScopeLookupEnvironment(classScope);
if (ignoreFurtherInvestigation) return ;
classFile.extraAttributes.add(new EclipseAttributeAdapter(makeAttribute()));
if (generateSyntheticPointcutMethod) {
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDesignator.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDesignator.java
index da27382ff..bb824eaee 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDesignator.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDesignator.java
@@ -66,6 +66,8 @@ public class PointcutDesignator extends ASTNode {
if (pointcut.state == Pointcut.RESOLVED ||
pointcut.state == Pointcut.CONCRETE) return true;
+ EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(dec.scope);
+
TypeBinding[] parameters = method.parameters;
Argument[] arguments = dec.arguments;
@@ -73,7 +75,7 @@ public class PointcutDesignator extends ASTNode {
for (int i = 0, len = baseArgumentCount; i < len; i++) {
Argument arg = arguments[i];
String name = new String(arg.name);
- UnresolvedType type = EclipseFactory.fromBinding(parameters[i]);
+ UnresolvedType type = world.fromBinding(parameters[i]);
bindings[i] = new FormalBinding(type, name, i, arg.sourceStart, arg.sourceEnd, "unknown");
}
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 9bb02707f..32402c6bb 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
@@ -67,22 +67,24 @@ public class SuperFixerVisitor extends ASTVisitor {
// }
// return;
}
-
+
+ EclipseFactory factory = ((AjLookupEnvironment)method.scope.environment()).factory;
+
char[] accessName;
if (call.isSuperAccess() && !call.binding.isStatic()) {
call.receiver = new ThisReference(call.receiver.sourceStart, call.receiver.sourceEnd);
accessName =
- NameMangler.superDispatchMethod(EclipseFactory.fromBinding(targetClass),
+ 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
if (superBinding.declaringClass.equals(targetClass)) {
accessName =
- NameMangler.protectedDispatchMethod(EclipseFactory.fromBinding(targetClass),
+ NameMangler.protectedDispatchMethod(factory.fromBinding(targetClass),
new String(superBinding.selector)).toCharArray();
} else {
accessName =
- NameMangler.superDispatchMethod(EclipseFactory.fromBinding(targetClass),
+ NameMangler.superDispatchMethod(factory.fromBinding(targetClass),
new String(superBinding.selector)).toCharArray();
}
} else {
@@ -97,7 +99,6 @@ public class SuperFixerVisitor extends ASTVisitor {
AstUtil.replaceMethodBinding(call, superAccessBinding);
- 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/ast/ValidateAtAspectJAnnotationsVisitor.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java
index bc8e1b038..178a57d56 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java
@@ -301,12 +301,13 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
Pointcut pc = new PatternParser(pointcutExpression,context).parsePointcut();
FormalBinding[] bindings = buildFormalAdviceBindingsFrom(methodDeclaration);
pc.resolve(new EclipseScope(bindings,methodDeclaration.scope));
+ EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(methodDeclaration.scope);
// now create a ResolvedPointcutDefinition,make an attribute out of it, and add it to the method
UnresolvedType[] paramTypes = new UnresolvedType[bindings.length];
for (int i = 0; i < paramTypes.length; i++) paramTypes[i] = bindings[i].getType();
ResolvedPointcutDefinition resPcutDef =
new ResolvedPointcutDefinition(
- EclipseFactory.fromBinding(((TypeDeclaration)typeStack.peek()).binding),
+ factory.fromBinding(((TypeDeclaration)typeStack.peek()).binding),
methodDeclaration.modifiers,
"anonymous",
paramTypes,
@@ -344,6 +345,7 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
private FormalBinding[] buildFormalAdviceBindingsFrom(MethodDeclaration mDecl) {
if (mDecl.arguments == null) return new FormalBinding[0];
+ EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(mDecl.scope);
String extraArgName = maybeGetExtraArgName();
if (extraArgName == null) extraArgName = "";
FormalBinding[] ret = new FormalBinding[mDecl.arguments.length];
@@ -351,7 +353,7 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
Argument arg = mDecl.arguments[i];
String name = new String(arg.name);
TypeBinding argTypeBinding = mDecl.binding.parameters[i];
- UnresolvedType type = EclipseFactory.fromBinding(argTypeBinding);
+ UnresolvedType type = factory.fromBinding(argTypeBinding);
if (CharOperation.equals(joinPoint,argTypeBinding.signature()) ||
CharOperation.equals(joinPointStaticPart,argTypeBinding.signature()) ||
CharOperation.equals(joinPointEnclosingStaticPart,argTypeBinding.signature()) ||
@@ -460,12 +462,13 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
pcDecl.setGenerateSyntheticPointcutMethod();
TypeDeclaration onType = (TypeDeclaration) typeStack.peek();
pcDecl.postParse(onType);
+ EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(methodDeclaration.scope);
int argsLength = methodDeclaration.arguments == null ? 0 : methodDeclaration.arguments.length;
FormalBinding[] bindings = new FormalBinding[argsLength];
for (int i = 0, len = bindings.length; i < len; i++) {
Argument arg = methodDeclaration.arguments[i];
String name = new String(arg.name);
- UnresolvedType type = EclipseFactory.fromBinding(methodDeclaration.binding.parameters[i]);
+ UnresolvedType type = factory.fromBinding(methodDeclaration.binding.parameters[i]);
bindings[i] = new FormalBinding(type, name, i, arg.sourceStart, arg.sourceEnd, "unknown");
}
swap(onType,methodDeclaration,pcDecl);
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
index 6422270bd..340a532da 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
@@ -74,7 +74,7 @@ import org.aspectj.weaver.patterns.DeclareParents;
* @author Jim Hugunin
*/
public class AjLookupEnvironment extends LookupEnvironment {
- public EclipseFactory factory = null;
+ public EclipseFactory factory = null;
// private boolean builtInterTypesAndPerClauses = false;
private List pendingTypesToWeave = new ArrayList();
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 19d4aff53..8e85b0653 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
@@ -70,7 +70,6 @@ public class EclipseFactory {
private LookupEnvironment lookupEnvironment;
private boolean xSerializableAspects;
private World world;
- private AsmHierarchyBuilder asmHierarchyBuilder;
private Map/*UnresolvedType, TypeBinding*/ typexToBinding = new HashMap();
//XXX currently unused
@@ -140,7 +139,7 @@ public class EclipseFactory {
return ret;
}
- private static String getName(TypeBinding binding) {
+ public static String getName(TypeBinding binding) {
if (binding instanceof TypeVariableBinding) {
// The first bound may be null - so default to object?
TypeVariableBinding tvb = (TypeVariableBinding)binding;
@@ -181,7 +180,7 @@ public class EclipseFactory {
* type - since we don't know it's a type variable we can't replace it with the type parameter.
*/
//??? going back and forth between strings and bindings is a waste of cycles
- public static UnresolvedType fromBinding(TypeBinding binding) {
+ public UnresolvedType fromBinding(TypeBinding binding) {
if (binding instanceof HelperInterfaceBinding) {
return ((HelperInterfaceBinding) binding).getTypeX();
}
@@ -233,7 +232,7 @@ public class EclipseFactory {
//TODO asc generics - temporary guard....
if (!(binding instanceof SourceTypeBinding))
throw new RuntimeException("Cant get the generic sig for "+binding.debugName());
- return UnresolvedType.forGenericType(getName(binding),tVars,
+ return ResolvedType.forGenericType(getName(binding),tVars,
CharOperation.charToString(((SourceTypeBinding)binding).genericSignature()));
}
@@ -241,7 +240,7 @@ public class EclipseFactory {
}
private static Map typeVariableBindingsInProgress = new HashMap();
- private static UnresolvedType fromTypeVariableBinding(TypeVariableBinding aTypeVariableBinding) {
+ private UnresolvedType fromTypeVariableBinding(TypeVariableBinding aTypeVariableBinding) {
if (typeVariableBindingsInProgress.containsKey(aTypeVariableBinding)) {
return (UnresolvedType) typeVariableBindingsInProgress.get(aTypeVariableBinding);
}
@@ -260,7 +259,7 @@ public class EclipseFactory {
return ret;
}
- public static UnresolvedType[] fromBindings(TypeBinding[] bindings) {
+ public UnresolvedType[] fromBindings(TypeBinding[] bindings) {
if (bindings == null) return UnresolvedType.NONE;
int len = bindings.length;
UnresolvedType[] ret = new UnresolvedType[len];
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseScope.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseScope.java
index dcc4f65fb..bc7efca5b 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseScope.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseScope.java
@@ -70,7 +70,7 @@ public class EclipseScope implements IScope {
//System.err.println("binding: " + b);
// Binding(tokens, bits & RestrictiveFlagMASK, this)
- return EclipseFactory.fromBinding(b);
+ return world.fromBinding(b);
/*
computeImports();
@@ -193,7 +193,7 @@ public class EclipseScope implements IScope {
TypeBinding[] topTypes = cuScope.topLevelTypes;
for (int i = 0; i < topTypes.length; i++) {
- importedNamesList.add(EclipseFactory.fromBinding(topTypes[i]).getName());
+ importedNamesList.add(world.fromBinding(topTypes[i]).getName());
}
importedNames =
@@ -208,7 +208,7 @@ public class EclipseScope implements IScope {
List importedPrefixesList)
{
if (binding == null) return;
- importedPrefixesList.add(EclipseFactory.fromBinding(binding).getName()+"$");
+ importedPrefixesList.add(world.fromBinding(binding).getName()+"$");
addClassAndParentsToPrefixes(binding.superclass(), importedPrefixesList);
ReferenceBinding[] superinterfaces = binding.superInterfaces();
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 f1ac562d6..f610a8007 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
@@ -50,9 +50,9 @@ public class EclipseShadow extends Shadow {
public UnresolvedType getEnclosingType() {
if (context instanceof TypeDeclaration) {
- return EclipseFactory.fromBinding(((TypeDeclaration)context).binding);
+ return world.fromBinding(((TypeDeclaration)context).binding);
} else if (context instanceof AbstractMethodDeclaration) {
- return EclipseFactory.fromBinding(((AbstractMethodDeclaration)context).binding.declaringClass);
+ return world.fromBinding(((AbstractMethodDeclaration)context).binding.declaringClass);
} else {
return ResolvedType.MISSING;
}
@@ -171,7 +171,7 @@ public class EclipseShadow extends Shadow {
} else if (astNode instanceof TypeDeclaration) {
return new EclipseShadow(world, Shadow.StaticInitialization,
new Member(Member.STATIC_INITIALIZATION,
- EclipseFactory.fromBinding(((TypeDeclaration)astNode).binding), 0,
+ world.fromBinding(((TypeDeclaration)astNode).binding), 0,
ResolvedType.VOID, "<clinit>", UnresolvedType.NONE),
astNode, context);
} else {
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 1f4a430c0..b8eb60b83 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
@@ -133,7 +133,7 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
if (amd == null || amd.ignoreFurtherInvestigation) continue;
if (amd instanceof PointcutDeclaration) {
PointcutDeclaration d = (PointcutDeclaration)amd;
- ResolvedPointcutDefinition df = d.makeResolvedPointcutDefinition();
+ ResolvedPointcutDefinition df = d.makeResolvedPointcutDefinition(factory);
declaredPointcuts.add(df);
} else if (amd instanceof InterTypeDeclaration) {
// these are handled in a separate pass
@@ -172,10 +172,10 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
private ResolvedPointcutDefinition makeResolvedPointcutDefinition(AbstractMethodDeclaration md) {
ResolvedPointcutDefinition resolvedPointcutDeclaration = new ResolvedPointcutDefinition(
- EclipseFactory.fromBinding(md.binding.declaringClass),
+ factory.fromBinding(md.binding.declaringClass),
md.modifiers,
new String(md.selector),
- EclipseFactory.fromBindings(md.binding.parameters),
+ factory.fromBindings(md.binding.parameters),
null); //??? might want to use null
resolvedPointcutDeclaration.setPosition(md.sourceStart, md.sourceEnd);