summaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoraclement <aclement>2005-10-14 17:57:56 +0000
committeraclement <aclement>2005-10-14 17:57:56 +0000
commit51b0f6261c8b20d424bc7d2a69dba17976894caf (patch)
tree67f8e3e772d8c74be2568c5b02c3e4fd7d613bbe /org.aspectj.ajdt.core
parent7e397dbfae904a4cb9d9e2fdd2f08d5361b336a0 (diff)
downloadaspectj-51b0f6261c8b20d424bc7d2a69dba17976894caf.tar.gz
aspectj-51b0f6261c8b20d424bc7d2a69dba17976894caf.zip
Updates for generic ITDs - see pr112105 for a description of all changes.
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java10
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java13
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java159
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java4
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java14
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java20
-rw-r--r--org.aspectj.ajdt.core/testdata/OutjarTest/aspects.jarbin1367 -> 1367 bytes
-rw-r--r--org.aspectj.ajdt.core/testdata/OutjarTest/child.jarbin724 -> 724 bytes
-rw-r--r--org.aspectj.ajdt.core/testdata/OutjarTest/parent.jarbin630 -> 630 bytes
9 files changed, 161 insertions, 59 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java
index bd159aa17..01f3aceb7 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java
@@ -59,6 +59,8 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {
*/
protected List typeVariableAliases;
+ protected InterTypeScope interTypeScope;
+
/**
* When set to true, the scope hierarchy for the field/method declaration has been correctly modified to
* include an intertypescope which resolves things relative to the targetted type.
@@ -136,8 +138,8 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {
if (ignoreFurtherInvestigation) return;
if (!scopeSetup) {
- ClassScope newParent = new InterTypeScope(upperScope, onTypeBinding,typeVariableAliases);
- scope.parent = newParent;
+ interTypeScope = new InterTypeScope(upperScope, onTypeBinding,typeVariableAliases);
+ scope.parent = interTypeScope;
this.scope.isStatic = Modifier.isStatic(declaredModifiers);
scopeSetup = true;
}
@@ -354,7 +356,7 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {
// if resolution failed, give up - someone else is going to report an error
if (rb instanceof ProblemReferenceBinding) return;
- ClassScope newParent = new InterTypeScope(scope.parent, rb, typeVariableAliases);
+ interTypeScope = new InterTypeScope(scope.parent, rb, typeVariableAliases);
// FIXME asc verify the choice of lines here...
// Two versions of this next line.
// First one tricks the JDT variable processing code so that it won't complain if
@@ -364,7 +366,7 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {
// this is the original version in case tricking the JDT causes grief (if you reinstate this variant, you
// will need to change the expected messages output for some of the generic ITD tests)
// scope.isStatic = Modifier.isStatic(declaredModifiers);
- scope.parent = newParent;
+ scope.parent = interTypeScope;
scopeSetup = true;
}
}
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 2ef5cc7e1..a814fe74f 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
@@ -167,11 +167,11 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
public EclipseTypeMunger build(ClassScope classScope) {
- EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(classScope);
+ EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(classScope);
resolveOnType(classScope);
if (ignoreFurtherInvestigation) return null;
-
+
binding = classScope.referenceContext.binding.resolveTypesFor(binding);
if (binding == null) {
// if binding is null, we failed to find a type used in the method params, this error
@@ -183,23 +183,22 @@ 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
-
// This signature represents what we want consumers of the targetted type to 'see'
// must use the factory method to build it since there may be typevariables from the binding
// referred to in the parameters/returntype
- ResolvedMember sig = world.makeResolvedMember(binding,onTypeBinding);
+ ResolvedMember sig = factory.makeResolvedMemberForITD(binding,onTypeBinding,interTypeScope.getRecoveryAliases());
sig.resetName(new String(declaredSelector));
int resetModifiers = declaredModifiers;
if (binding.isVarargs()) resetModifiers = resetModifiers | Constants.ACC_VARARGS;
sig.resetModifiers(resetModifiers);
- NewMethodTypeMunger myMunger = new NewMethodTypeMunger(sig, null);
+ NewMethodTypeMunger myMunger = new NewMethodTypeMunger(sig, null, typeVariableAliases);
setMunger(myMunger);
- ResolvedType aspectType = world.fromEclipse(classScope.referenceContext.binding);
+ ResolvedType aspectType = factory.fromEclipse(classScope.referenceContext.binding);
ResolvedMember me =
myMunger.getInterMethodBody(aspectType);
this.selector = binding.selector = me.getName().toCharArray();
- return new EclipseTypeMunger(world, myMunger, aspectType, this);
+ return new EclipseTypeMunger(factory, myMunger, aspectType, this);
}
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 2c49f86ee..1977c32b7 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
@@ -19,6 +19,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration;
@@ -308,9 +309,22 @@ public class EclipseFactory {
if (typeVariableBindingsInProgress.containsKey(aTypeVariableBinding)) {
return (UnresolvedType) typeVariableBindingsInProgress.get(aTypeVariableBinding);
}
+
+ // Check if its a type variable binding that we need to recover to an alias...
+ if (typeVariablesForAliasRecovery!=null) {
+ String aliasname = (String)typeVariablesForAliasRecovery.get(aTypeVariableBinding);
+ if (aliasname!=null) {
+ UnresolvedTypeVariableReferenceType ret = new UnresolvedTypeVariableReferenceType();
+ ret.setTypeVariable(new TypeVariable(aliasname));
+ return ret;
+ }
+ }
+
if (typeVariablesForThisMember.containsKey(new String(aTypeVariableBinding.sourceName))) {
return (UnresolvedType)typeVariablesForThisMember.get(new String(aTypeVariableBinding.sourceName));
}
+
+
// Create the UnresolvedTypeVariableReferenceType for the type variable
String name = CharOperation.charToString(aTypeVariableBinding.sourceName());
@@ -430,8 +444,32 @@ public class EclipseFactory {
* (params, return type) we store the type variables in this structure, then should any
* component of the method binding refer to them, we grab them from the map.
*/
- // FIXME asc convert to array, indexed by rank
private Map typeVariablesForThisMember = new HashMap();
+
+ /**
+ * This is a map from typevariablebindings (eclipsey things) to the names the user
+ * originally specified in their ITD. For example if the target is 'interface I<N extends Number> {}'
+ * and the ITD was 'public void I<X>.m(List<X> lxs) {}' then this map would contain a pointer
+ * from the eclipse type 'N extends Number' to the letter 'X'.
+ */
+ private Map typeVariablesForAliasRecovery;
+
+ /**
+ * Construct a resolvedmember from a methodbinding. The supplied map tells us about any
+ * typevariablebindings that replaced typevariables whilst the compiler was resolving types -
+ * this only happens if it is a generic itd that shares type variables with its target type.
+ */
+ public ResolvedMember makeResolvedMemberForITD(MethodBinding binding,TypeBinding declaringType,
+ Map /*TypeVariableBinding > original alias name*/ recoveryAliases) {
+ ResolvedMember result = null;
+ try {
+ typeVariablesForAliasRecovery = recoveryAliases;
+ result = makeResolvedMember(binding,declaringType);
+ } finally {
+ typeVariablesForAliasRecovery = null;
+ }
+ return result;
+ }
public ResolvedMember makeResolvedMember(MethodBinding binding, TypeBinding declaringType) {
//System.err.println("member for: " + binding + ", " + new String(binding.declaringClass.sourceName));
@@ -463,14 +501,12 @@ public class EclipseFactory {
if (binding.isVarargs()) {
ret.setVarargsMethod();
}
- if (typeVariablesForThisMember.size()!=0) {
- // SAUSAGES this might be broken with the change for resolved members to own type variables
- TypeVariable[] tvars = new TypeVariable[typeVariablesForThisMember.size()];
- int i =0;
- for (Iterator iter = typeVariablesForThisMember.values().iterator(); iter.hasNext();) {
- tvars[i++] = ((TypeVariableReference)((UnresolvedType)iter.next())).getTypeVariable();
+ if (ajTypeRefs!=null) {
+ TypeVariable[] tVars = new TypeVariable[ajTypeRefs.length];
+ for (int i=0;i<ajTypeRefs.length;i++) {
+ tVars[i]=((TypeVariableReference)ajTypeRefs[i]).getTypeVariable();
}
- ret.setTypeVariables(tvars);
+ ret.setTypeVariables(tVars);
}
typeVariablesForThisMember.clear();
ret.resolve(world);
@@ -545,7 +581,8 @@ public class EclipseFactory {
lookupEnvironment.createParameterizedType(baseTypeBinding,argumentBindings,baseTypeBinding.enclosingType());
return ptb;
} else if (typeX.isTypeVariableReference()) {
- return makeTypeVariableBinding((TypeVariableReference)typeX);
+// return makeTypeVariableBinding((TypeVariableReference)typeX);
+ return makeTypeVariableBindingFromAJTypeVariable(((TypeVariableReference)typeX).getTypeVariable());
} else if (typeX.isRawType()) {
ReferenceBinding baseTypeBinding = lookupBinding(typeX.getBaseName());
RawTypeBinding rtb = lookupEnvironment.createRawType(baseTypeBinding,baseTypeBinding.enclosingType());
@@ -614,26 +651,72 @@ public class EclipseFactory {
private ReferenceBinding currentType = null;
+ /**
+ * Convert a resolvedmember into an eclipse method binding.
+ */
+ public MethodBinding makeMethodBinding(ResolvedMember member,List aliases) {
+ return internalMakeMethodBinding(member,aliases);
+ }
+
+ /**
+ * Convert a resolvedmember into an eclipse method binding.
+ */
public MethodBinding makeMethodBinding(ResolvedMember member) {
+ return internalMakeMethodBinding(member,null); // there are no aliases
+
+// typeVariableToTypeBinding.clear(); // will be filled in as we go along...
+// TypeVariableBinding[] tvbs = null;
+//
+// if (member.getTypeVariables()!=null) {
+// if (member.getTypeVariables().length==0) tvbs = MethodBinding.NoTypeVariables;
+// else tvbs = makeTypeVariableBindingsFromAJTypeVariables(member.getTypeVariables());
+// // QQQ do we need to bother fixing up the declaring element for each type variable?
+// }
+//
+// ReferenceBinding declaringType = (ReferenceBinding)makeTypeBinding(member.getDeclaringType());
+// currentType = declaringType;
+// MethodBinding mb = new MethodBinding(member.getModifiers(),
+// member.getName().toCharArray(),
+// makeTypeBinding(member.getReturnType()),
+// makeTypeBindings(member.getParameterTypes()),
+// makeReferenceBindings(member.getExceptions()),
+// declaringType);
+//
+// if (tvbs!=null) mb.typeVariables = tvbs;
+// typeVariableToTypeBinding.clear();
+// currentType = null;
+// return mb;
+ }
+
+ /**
+ * Convert a normal AJ member and convert it into an eclipse methodBinding.
+ * Taking into account any aliases that it may include due to being a
+ * generic ITD. Any aliases are put into the typeVariableToBinding
+ * map so that they will be substituted as appropriate in the returned
+ * methodbinding
+ */
+ public MethodBinding internalMakeMethodBinding(ResolvedMember member,List aliases) {
typeVariableToTypeBinding.clear();
TypeVariableBinding[] tvbs = null;
-
+
if (member.getTypeVariables()!=null) {
if (member.getTypeVariables().length==0) {
tvbs = MethodBinding.NoTypeVariables;
} else {
tvbs = makeTypeVariableBindingsFromAJTypeVariables(member.getTypeVariables());
- // fixup the declaring element, we couldn't do it whilst processing the typevariables as we'll end up in recursion.
- for (int i = 0; i < tvbs.length; i++) {
- TypeVariableBinding binding = tvbs[i];
-// if (binding.declaringElement==null && ((TypeVariableReference)member.getTypeVariables()[i]).getTypeVariable().getDeclaringElement() instanceof Member) {
-// tvbs[i].declaringElement = mb;
-// } else {
-// tvbs[i].declaringElement = declaringType;
-// }
- }
+ // QQQ do we need to bother fixing up the declaring element here?
}
- }
+ }
+
+ // If there are aliases, place them in the map
+ if (aliases!=null && aliases.size()!=0) {
+ ReferenceBinding tType = (ReferenceBinding)makeTypeBinding(member.getDeclaringType());
+ int i=0;
+ for (Iterator iter = aliases.iterator(); iter.hasNext();) {
+ String element = (String) iter.next();
+ typeVariableToTypeBinding.put(element,tType.typeVariables()[i++]);
+ }
+ }
ReferenceBinding declaringType = (ReferenceBinding)makeTypeBinding(member.getDeclaringType());
currentType = declaringType;
@@ -654,14 +737,14 @@ public class EclipseFactory {
/**
* Convert a bunch of type variables in one go, from AspectJ form to Eclipse form.
*/
- private TypeVariableBinding[] makeTypeVariableBindings(UnresolvedType[] typeVariables) {
- int len = typeVariables.length;
- TypeVariableBinding[] ret = new TypeVariableBinding[len];
- for (int i = 0; i < len; i++) {
- ret[i] = makeTypeVariableBinding((TypeVariableReference)typeVariables[i]);
- }
- return ret;
- }
+// private TypeVariableBinding[] makeTypeVariableBindings(UnresolvedType[] typeVariables) {
+// int len = typeVariables.length;
+// TypeVariableBinding[] ret = new TypeVariableBinding[len];
+// for (int i = 0; i < len; i++) {
+// ret[i] = makeTypeVariableBinding((TypeVariableReference)typeVariables[i]);
+// }
+// return ret;
+// }
private TypeVariableBinding[] makeTypeVariableBindingsFromAJTypeVariables(TypeVariable[] typeVariables) {
int len = typeVariables.length;
@@ -684,10 +767,10 @@ public class EclipseFactory {
* to the TypeVariableBinding.
*/
private TypeVariableBinding makeTypeVariableBinding(TypeVariableReference tvReference) {
- TypeVariable tVar = tvReference.getTypeVariable();
- TypeVariableBinding tvBinding = (TypeVariableBinding)typeVariableToTypeBinding.get(tVar.getName());
+ TypeVariable tv = tvReference.getTypeVariable();
+ TypeVariableBinding tvBinding = (TypeVariableBinding)typeVariableToTypeBinding.get(tv.getName());
if (currentType!=null) {
- TypeVariableBinding tvb = currentType.getTypeVariable(tVar.getName().toCharArray());
+ TypeVariableBinding tvb = currentType.getTypeVariable(tv.getName().toCharArray());
if (tvb!=null) return tvb;
}
if (tvBinding==null) {
@@ -698,14 +781,14 @@ public class EclipseFactory {
// } else {
// declaringElement = makeTypeBinding((UnresolvedType)tVar.getDeclaringElement());
// }
- tvBinding = new TypeVariableBinding(tVar.getName().toCharArray(),declaringElement,tVar.getRank());
- typeVariableToTypeBinding.put(tVar.getName(),tvBinding);
- tvBinding.superclass=(ReferenceBinding)makeTypeBinding(tVar.getUpperBound());
- tvBinding.firstBound=tvBinding.superclass; // FIXME asc is this correct? possibly it could be first superinterface
- if (tVar.getAdditionalInterfaceBounds()==null) {
+ tvBinding = new TypeVariableBinding(tv.getName().toCharArray(),declaringElement,tv.getRank());
+ typeVariableToTypeBinding.put(tv.getName(),tvBinding);
+ tvBinding.superclass=(ReferenceBinding)makeTypeBinding(tv.getUpperBound());
+ tvBinding.firstBound=(ReferenceBinding)makeTypeBinding(tv.getFirstBound());
+ if (tv.getAdditionalInterfaceBounds()==null) {
tvBinding.superInterfaces=TypeVariableBinding.NoSuperInterfaces;
} else {
- TypeBinding tbs[] = makeTypeBindings(tVar.getAdditionalInterfaceBounds());
+ TypeBinding tbs[] = makeTypeBindings(tv.getAdditionalInterfaceBounds());
ReferenceBinding[] rbs= new ReferenceBinding[tbs.length];
for (int i = 0; i < tbs.length; i++) {
rbs[i] = (ReferenceBinding)tbs[i];
@@ -733,7 +816,7 @@ public class EclipseFactory {
tvBinding = new TypeVariableBinding(tv.getName().toCharArray(),declaringElement,tv.getRank());
typeVariableToTypeBinding.put(tv.getName(),tvBinding);
tvBinding.superclass=(ReferenceBinding)makeTypeBinding(tv.getUpperBound());
- tvBinding.firstBound=tvBinding.superclass; // FIXME asc is this correct? possibly it could be first superinterface
+ tvBinding.firstBound=(ReferenceBinding)makeTypeBinding(tv.getFirstBound());
if (tv.getAdditionalInterfaceBounds()==null) {
tvBinding.superInterfaces=TypeVariableBinding.NoSuperInterfaces;
} else {
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java
index 8f7b1544f..d3ff29a8b 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java
@@ -106,7 +106,7 @@ public class EclipseTypeMunger extends ConcreteTypeMunger {
private boolean mungeNewMethod(SourceTypeBinding sourceType, ResolvedType onType, NewMethodTypeMunger munger, boolean isExactTargetType) {
InterTypeMethodBinding binding =
- new InterTypeMethodBinding(world, munger.getSignature(), aspectType, sourceMethod);
+ new InterTypeMethodBinding(world, munger, aspectType, sourceMethod);
if (!isExactTargetType) {
// we're munging an interface ITD onto a topmost implementor
@@ -144,7 +144,7 @@ public class EclipseTypeMunger extends ConcreteTypeMunger {
//classScope.referenceContext.binding.addMethod(binding);
} else {
InterTypeMethodBinding binding =
- new InterTypeMethodBinding(world, munger.getSignature(), aspectType, sourceMethod);
+ new InterTypeMethodBinding(world, munger, aspectType, sourceMethod);
findOrCreateInterTypeMemberFinder(sourceType).addInterTypeMethod(binding);
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java
index 658b6ef13..c3c2b97c4 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java
@@ -13,10 +13,6 @@
package org.aspectj.ajdt.internal.compiler.lookup;
-import org.aspectj.weaver.AjcMemberMaker;
-import org.aspectj.weaver.Member;
-import org.aspectj.weaver.ResolvedMember;
-import org.aspectj.weaver.UnresolvedType;
import org.aspectj.ajdt.internal.compiler.ast.InterTypeMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.InvocationSite;
@@ -25,6 +21,11 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+import org.aspectj.weaver.AjcMemberMaker;
+import org.aspectj.weaver.Member;
+import org.aspectj.weaver.ResolvedMember;
+import org.aspectj.weaver.ResolvedTypeMunger;
+import org.aspectj.weaver.UnresolvedType;
/**
* A special method binding representing an ITD that pretends to be a
@@ -46,11 +47,12 @@ public class InterTypeMethodBinding extends MethodBinding {
public AbstractMethodDeclaration sourceMethod;
- public InterTypeMethodBinding(EclipseFactory world, ResolvedMember signature, UnresolvedType withinType,
+ public InterTypeMethodBinding(EclipseFactory world, ResolvedTypeMunger munger, UnresolvedType withinType,
AbstractMethodDeclaration sourceMethod)
{
super();
- MethodBinding mb = world.makeMethodBinding(signature);
+ ResolvedMember signature = munger.getSignature();
+ MethodBinding mb = world.makeMethodBinding(signature,munger.getTypeVariableAliases());
this.modifiers = mb.modifiers;
this.selector = mb.selector;
this.returnType = mb.returnType;
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java
index 6ebf5dd36..800ed82e8 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java
@@ -13,7 +13,9 @@
package org.aspectj.ajdt.internal.compiler.lookup;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
@@ -28,6 +30,7 @@ import org.aspectj.weaver.BCException;
public class InterTypeScope extends ClassScope {
ReferenceBinding onType;
List aliases;
+ Map /* real type variable > alias letter */ usedAliases; // Used later when reconstructing the resolved member
public InterTypeScope(Scope parent, ReferenceBinding onType) {
super(parent, null);
@@ -40,6 +43,11 @@ public class InterTypeScope extends ClassScope {
this(parent,rb);
this.aliases = list;
}
+
+ public String getAnyAliasForTypeVariableBinding(TypeVariableBinding tvb) {
+ if (usedAliases==null) return null;
+ return (String)usedAliases.get(tvb);
+ }
// this method depends on the fact that BinaryTypeBinding extends SourceTypeBinding
private SourceTypeBinding makeSourceTypeBinding(ReferenceBinding onType) {
@@ -65,18 +73,26 @@ public class InterTypeScope extends ClassScope {
public TypeVariableBinding findTypeVariable(char[] name, SourceTypeBinding sourceType) {
- int aliased = (aliases==null?-1:aliases.indexOf(new String(name)));
+ String variableName = new String(name);
+ int aliased = (aliases==null?-1:aliases.indexOf(variableName));
if (aliased!=-1) {
if (aliased>sourceType.typeVariables.length || sourceType.typeVariables.length==0) {
TypeVariableBinding tvb = new TypeVariableBinding("fake".toCharArray(),null,0);
return tvb;
// error is going to be reported by someone else!
}
- return sourceType.typeVariables()[aliased];
+ TypeVariableBinding tvb = sourceType.typeVariables()[aliased];
+ if (usedAliases==null) usedAliases = new HashMap();
+ usedAliases.put(tvb,variableName);
+ return tvb;
} else {
return sourceType.getTypeVariable(name);
}
}
+
+ public Map getRecoveryAliases() {
+ return usedAliases;
+ }
}
diff --git a/org.aspectj.ajdt.core/testdata/OutjarTest/aspects.jar b/org.aspectj.ajdt.core/testdata/OutjarTest/aspects.jar
index 630447de1..fa70dfa06 100644
--- a/org.aspectj.ajdt.core/testdata/OutjarTest/aspects.jar
+++ b/org.aspectj.ajdt.core/testdata/OutjarTest/aspects.jar
Binary files differ
diff --git a/org.aspectj.ajdt.core/testdata/OutjarTest/child.jar b/org.aspectj.ajdt.core/testdata/OutjarTest/child.jar
index c68c6ee97..17ef34cb6 100644
--- a/org.aspectj.ajdt.core/testdata/OutjarTest/child.jar
+++ b/org.aspectj.ajdt.core/testdata/OutjarTest/child.jar
Binary files differ
diff --git a/org.aspectj.ajdt.core/testdata/OutjarTest/parent.jar b/org.aspectj.ajdt.core/testdata/OutjarTest/parent.jar
index d2dc56815..312c68e0f 100644
--- a/org.aspectj.ajdt.core/testdata/OutjarTest/parent.jar
+++ b/org.aspectj.ajdt.core/testdata/OutjarTest/parent.jar
Binary files differ