/* *******************************************************************
- * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * Copyright (c) 2002-2010 Contributors
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * PARC initial implementation
+ * PARC, Andy Clement (SpringSource)
* ******************************************************************/
-
package org.aspectj.ajdt.internal.compiler.ast;
import java.lang.reflect.Modifier;
import java.util.List;
import java.util.Map;
+import org.aspectj.ajdt.internal.compiler.ast.AccessForInlineVisitor.SuperAccessMethodPair;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseScope;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseTypeMunger;
import org.aspectj.ajdt.internal.compiler.lookup.HelperInterfaceBinding;
import org.aspectj.ajdt.internal.compiler.lookup.InlineAccessFieldBinding;
+import org.aspectj.ajdt.internal.compiler.lookup.IntertypeMemberTypeFinder;
import org.aspectj.ajdt.internal.compiler.lookup.PrivilegedHandler;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ClassFile;
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.TagBits;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding;
import org.aspectj.weaver.AjAttribute;
import org.aspectj.weaver.AjcMemberMaker;
import org.aspectj.weaver.NameMangler;
+import org.aspectj.weaver.NewMemberClassTypeMunger;
import org.aspectj.weaver.ReferenceType;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.patterns.PerSingleton;
import org.aspectj.weaver.patterns.TypePattern;
-// (we used to...) making all aspects member types avoids a nasty hierarchy pain
-// switched from MemberTypeDeclaration to TypeDeclaration
+/**
+ * Represents an aspect declaration.
+ *
+ * @author PARC
+ * @author Andy Clement
+ */
public class AspectDeclaration extends TypeDeclaration {
// public IAjDeclaration[] ajDeclarations;
public ResolvedMember aspectOfMethod;
public ResolvedMember ptwGetWithinTypeNameMethod;
public ResolvedMember hasAspectMethod;
-
- public Map accessForInline = new HashMap();
- public Map superAccessForInline = new HashMap();
-
+ public Map<ResolvedMember, Binding> accessForInline = new HashMap<ResolvedMember, Binding>();
+ public Map<ResolvedMember, AccessForInlineVisitor.SuperAccessMethodPair> superAccessForInline = new HashMap<ResolvedMember, AccessForInlineVisitor.SuperAccessMethodPair>();
public boolean isPrivileged;
- private int declaredModifiers;
-
public EclipseSourceType concreteName;
-
public ReferenceType typeX;
-
public EclipseFactory factory; // ??? should use this consistently
-
public int adviceCounter = 1; // Used as a part of the generated name for advice methods
public int declareCounter = 1; // Used as a part of the generated name for methods representing declares
-
// for better error messages in 1.0 to 1.1 transition
public TypePattern dominatesPattern;
+ private int declaredModifiers;
+
public AspectDeclaration(CompilationResult compilationResult) {
super(compilationResult);
// perClause = new PerSingleton();
/**
* A pointcut might have already added the attribute, let's not add it again.
*/
+ @SuppressWarnings("unchecked")
private void addVersionAttributeIfNecessary(ClassFile classFile) {
for (Iterator iter = classFile.extraAttributes.iterator(); iter.hasNext();) {
EclipseAttributeAdapter element = (EclipseAttributeAdapter) iter.next();
private static char[] weaverVersionChars = "org.aspectj.weaver.WeaverVersion".toCharArray();
private void generateInlineAccessMembers(ClassFile classFile) {
- for (Iterator i = superAccessForInline.values().iterator(); i.hasNext();) {
- AccessForInlineVisitor.SuperAccessMethodPair pair = (AccessForInlineVisitor.SuperAccessMethodPair) i.next();
+ for (Iterator<SuperAccessMethodPair> i = superAccessForInline.values().iterator(); i.hasNext();) {
+ AccessForInlineVisitor.SuperAccessMethodPair pair = i.next();
generateSuperAccessMethod(classFile, pair.accessMethod, pair.originalMethod);
}
- for (Iterator i = accessForInline.entrySet().iterator(); i.hasNext();) {
- Map.Entry e = (Map.Entry) i.next();
- generateInlineAccessMethod(classFile, (Binding) e.getValue(), (ResolvedMember) e.getKey());
+ for (Iterator<Map.Entry<ResolvedMember, Binding>> i = accessForInline.entrySet().iterator(); i.hasNext();) {
+ Map.Entry<ResolvedMember, Binding> e = i.next();
+ generateInlineAccessMethod(classFile, e.getValue(), e.getKey());
}
}
generateMethod(classFile, methodBinding, null, gen);
}
- protected List makeEffectiveSignatureAttribute(ResolvedMember sig, Shadow.Kind kind, boolean weaveBody) {
- List l = new ArrayList(1);
+ protected List<EclipseAttributeAdapter> makeEffectiveSignatureAttribute(ResolvedMember sig, Shadow.Kind kind, boolean weaveBody) {
+ List<EclipseAttributeAdapter> l = new ArrayList<EclipseAttributeAdapter>(1);
l.add(new EclipseAttributeAdapter(new AjAttribute.EffectiveSignatureAttribute(sig, kind, weaveBody)));
return l;
}
* methods are able to masquerade as any join point (a field set, field get or method call). The effective signature attribute
* is 'unwrapped' in BcelClassWeaver.matchInvokeInstruction()
*/
- private void generateMethod(ClassFile classFile, MethodBinding methodBinding, List additionalAttributes/*
- * ResolvedMember
- * realMember
- */, BodyGenerator gen) {
+ private void generateMethod(ClassFile classFile, MethodBinding methodBinding, List additionalAttributes, BodyGenerator gen) {
// EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(this.scope);
classFile.generateMethodInfoHeader(methodBinding);
int methodAttributeOffset = classFile.contentsOffset;
return perClause;
}
+ public void processIntertypeMemberTypes(ClassScope classScope) {
+ factory = EclipseFactory.fromScopeLookupEnvironment(scope);
+ if (memberTypes != null) {
+ for (int i = 0; i < memberTypes.length; i++) {
+ if (memberTypes[i] instanceof IntertypeMemberClassDeclaration) {
+ EclipseTypeMunger m = ((IntertypeMemberClassDeclaration) memberTypes[i]).build(classScope);
+ if (m != null) {
+ mungeNewInnerClass(m, factory);
+ concreteName.typeMungers.add(m);
+ }
+ }
+ }
+ }
+ }
+
public void buildInterTypeAndPerClause(ClassScope classScope) {
factory = EclipseFactory.fromScopeLookupEnvironment(scope);
if (isPrivileged) {
}
}
}
- if (memberTypes != null) {
- for (int i = 0; i < memberTypes.length; i++) {
- if (memberTypes[i] instanceof IntertypeMemberClassDeclaration) {
- EclipseTypeMunger m = ((IntertypeMemberClassDeclaration) memberTypes[i]).build(classScope);
- if (m != null) {
- concreteName.typeMungers.add(m);
- }
- }
- }
- }
concreteName.getDeclaredPointcuts();
}
// return s;
// }
+ // very similar to code in EclipseTypeMunger
+ private void mungeNewInnerClass(EclipseTypeMunger m, EclipseFactory world) {
+
+ NewMemberClassTypeMunger munger = (NewMemberClassTypeMunger) m.getMunger();
+
+ // private boolean mungeNewInnerClass(SourceTypeBinding sourceType, ResolvedType onType, NewMemberClassTypeMunger munger,
+ // boolean isExactTargetType) {
+
+ SourceTypeBinding aspectTypeBinding = (SourceTypeBinding) world.makeTypeBinding(m.getAspectType());
+
+ char[] mungerMemberTypeName = ("$" + munger.getMemberTypeName()).toCharArray();
+ ReferenceBinding innerTypeBinding = null;
+ for (ReferenceBinding innerType : aspectTypeBinding.memberTypes) {
+ char[] compounded = CharOperation.concatWith(innerType.compoundName, '.');
+ if (org.aspectj.org.eclipse.jdt.core.compiler.CharOperation.endsWith(compounded, mungerMemberTypeName)) {
+ innerTypeBinding = innerType;
+ break;
+ }
+ }
+ // may be unresolved if the aspect type binding was a BinaryTypeBinding
+ if (innerTypeBinding instanceof UnresolvedReferenceBinding) {
+ innerTypeBinding = BinaryTypeBinding.resolveType(innerTypeBinding, world.getLookupEnvironment(), true);
+ }
+ if (innerTypeBinding == null) {
+ throw new IllegalStateException("Could not find inner type binding for '" + munger.getMemberTypeName() + "'");
+ }
+
+ // TODO adjust modifier?
+ // TODO deal with itd of it onto an interface
+
+ SourceTypeBinding targetSourceTypeBinding = (SourceTypeBinding) world.makeTypeBinding(munger.getTargetType());
+ ReferenceBinding[] existingMemberTypes = targetSourceTypeBinding.memberTypes();
+ for (int i = 0; i < existingMemberTypes.length; i++) {
+ char[] compounded = CharOperation.concatWith(existingMemberTypes[i].compoundName, '.');
+ if (CharOperation.endsWith(compounded, mungerMemberTypeName)) {
+ scope.problemReporter().signalError(sourceStart(), sourceEnd(),
+ "target type already declares a member type with the name '" + munger.getMemberTypeName() + "'");
+ return;
+ }
+ }
+
+ findOrCreateInterTypeMemberClassFinder(targetSourceTypeBinding).addInterTypeMemberType(innerTypeBinding);
+ }
+
+ private IntertypeMemberTypeFinder findOrCreateInterTypeMemberClassFinder(SourceTypeBinding sourceType) {
+ IntertypeMemberTypeFinder finder = (IntertypeMemberTypeFinder) sourceType.typeFinder;
+ if (finder == null) {
+ finder = new IntertypeMemberTypeFinder();
+ sourceType.typeFinder = finder;
+ finder.targetTypeBinding = sourceType;
+ sourceType.tagBits &= ~TagBits.HasNoMemberTypes; // ensure it thinks it has one
+ }
+ return finder;
+ }
+
public StringBuffer printHeader(int indent, StringBuffer output) {
// since all aspects are made public we want to print the
// modifiers that were supplied in the original source code
import org.aspectj.weaver.ReferenceTypeDelegate;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.ResolvedTypeMunger;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.WeaverStateInfo;
public EclipseFactory factory = null;
// private boolean builtInterTypesAndPerClauses = false;
- private final List pendingTypesToWeave = new ArrayList();
+ private final List<SourceTypeBinding> pendingTypesToWeave = new ArrayList<SourceTypeBinding>();
// Q: What are dangerousInterfaces?
// A: An interface is considered dangerous if an ITD has been made upon it
// need to build inter-type declarations for all AspectDeclarations at
// this point
// this MUST be done in order from super-types to subtypes
- List typesToProcess = new ArrayList();
+ List<SourceTypeBinding> typesToProcess = new ArrayList<SourceTypeBinding>();
+ List<SourceTypeBinding> aspectsToProcess = new ArrayList<SourceTypeBinding>();
for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
CompilationUnitScope cus = units[i].scope;
SourceTypeBinding[] stbs = cus.topLevelTypes;
for (int j = 0; j < stbs.length; j++) {
SourceTypeBinding stb = stbs[j];
typesToProcess.add(stb);
+ TypeDeclaration typeDeclaration = stb.scope.referenceContext;
+ if (typeDeclaration instanceof AspectDeclaration) {
+ aspectsToProcess.add(stb);
+ }
}
}
factory.getWorld().getCrosscuttingMembersSet().reset();
+
+ // Need to do these before the other ITDs
+ for (SourceTypeBinding aspectToProcess : aspectsToProcess) {
+ processInterTypeMemberTypes(aspectToProcess.scope);
+ }
+
while (typesToProcess.size() > 0) {
// removes types from the list as they are processed...
- collectAllITDsAndDeclares((SourceTypeBinding) typesToProcess.get(0), typesToProcess);
+ collectAllITDsAndDeclares(typesToProcess.get(0), typesToProcess);
}
factory.finishTypeMungers();
// now do weaving
- Collection typeMungers = factory.getTypeMungers();
+ List<ConcreteTypeMunger> typeMungers = factory.getTypeMungers();
- Collection declareParents = factory.getDeclareParents();
- Collection declareAnnotationOnTypes = factory.getDeclareAnnotationOnTypes();
+ List<DeclareParents> declareParents = factory.getDeclareParents();
+ List<DeclareAnnotation> declareAnnotationOnTypes = factory.getDeclareAnnotationOnTypes();
doPendingWeaves();
while (typesToProcess.size() > 0) {
// A side effect of weaveIntertypes() is that the processed type
// is removed from the collection
- weaveIntertypes(typesToProcess, (SourceTypeBinding) typesToProcess.get(0), typeMungers, declareParents,
- declareAnnotationOnTypes);
+ weaveIntertypes(typesToProcess, typesToProcess.get(0), typeMungers, declareParents, declareAnnotationOnTypes);
}
} else {
// Order isn't important
for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
- // System.err.println("Working on "+new
- // String(units[i].getFileName()));
weaveInterTypeDeclarations(units[i].scope, typeMungers, declareParents, declareAnnotationOnTypes);
}
}
* problems if you supply 'pieces' of a hierarchy, i.e. the bottom and the top, but not the middle - but what the hell are you
* doing if you do that?
*/
- private void weaveIntertypes(List typesToProcess, SourceTypeBinding typeToWeave, Collection typeMungers,
- Collection declareParents, Collection declareAnnotationOnTypes) {
+ private void weaveIntertypes(List<SourceTypeBinding> typesToProcess, SourceTypeBinding typeToWeave,
+ List<ConcreteTypeMunger> typeMungers, List<DeclareParents> declareParents,
+ List<DeclareAnnotation> declareAnnotationOnTypes) {
// Look at the supertype first
ReferenceBinding superType = typeToWeave.superclass();
if (typesToProcess.contains(superType) && superType instanceof SourceTypeBinding) {
return couldBeAtAspect;
}
+ /**
+ * Applies any intertype member type declarations up front.
+ */
+ private void processInterTypeMemberTypes(ClassScope classScope) {
+ TypeDeclaration dec = classScope.referenceContext;
+ if (dec instanceof AspectDeclaration) {
+ ((AspectDeclaration) dec).processIntertypeMemberTypes(classScope);
+ }
+ // if we are going to support nested aspects making itd member types, copy the logic from the end of
+ // buildInterTypeAndPerClause() which walks members
+ }
+
private void buildInterTypeAndPerClause(ClassScope s) {
TypeDeclaration dec = s.referenceContext;
if (dec instanceof AspectDeclaration) {
return false;
}
- private void weaveInterTypeDeclarations(CompilationUnitScope unit, Collection typeMungers, Collection declareParents,
- Collection declareAnnotationOnTypes) {
+ private void weaveInterTypeDeclarations(CompilationUnitScope unit, List<ConcreteTypeMunger> typeMungers,
+ List<DeclareParents> declareParents, List<DeclareAnnotation> declareAnnotationOnTypes) {
for (int i = 0, length = unit.topLevelTypes.length; i < length; i++) {
weaveInterTypeDeclarations(unit.topLevelTypes[i], typeMungers, declareParents, declareAnnotationOnTypes, false);
}
if (!factory.areTypeMungersFinished()) {
if (!pendingTypesToWeave.contains(sourceType)) {
pendingTypesToWeave.add(sourceType);
+
+// inner type ITD support - may need this for some incremental cases...
+ // List<ConcreteTypeMunger> ctms = factory.getWorld().getCrosscuttingMembersSet().getTypeMungersOfKind(
+ // ResolvedTypeMunger.InnerClass);
+ // // List<ConcreteTypeMunger> innerTypeMungers = new ArrayList<ConcreteTypeMunger>();
+ // // for (ConcreteTypeMunger ctm : ctms) {
+ // // if (ctm.getMunger() != null && ctm.getMunger().getKind() == ResolvedTypeMunger.InnerClass) {
+ // // innerTypeMungers.add(ctm);
+ // // }
+ // // }
+ // // that includes the innertype one...
+ // // doPendingWeaves at this level is about applying inner class
+ // BinaryTypeBinding t = (BinaryTypeBinding) sourceType;
+ // for (ConcreteTypeMunger ctm : innerTypeMungers) {
+ // NewMemberClassTypeMunger nmctm = (NewMemberClassTypeMunger) ctm.getMunger();
+ // ReferenceBinding[] rbs = t.memberTypes;
+ // UnresolvedType ut = factory.fromBinding(t);
+ // if (ut.equals(nmctm.getTargetType())) {
+ // // got a match here
+ // SourceTypeBinding aspectTypeBinding = (SourceTypeBinding) factory.makeTypeBinding(ctm.getAspectType());
+ //
+ // char[] mungerMemberTypeName = ("$" + nmctm.getMemberTypeName()).toCharArray();
+ // ReferenceBinding innerTypeBinding = null;
+ // for (ReferenceBinding innerType : aspectTypeBinding.memberTypes) {
+ // char[] compounded = CharOperation.concatWith(innerType.compoundName, '.');
+ // if (org.aspectj.org.eclipse.jdt.core.compiler.CharOperation.endsWith(compounded, mungerMemberTypeName)) {
+ // innerTypeBinding = innerType;
+ // break;
+ // }
+ // }
+ // // may be unresolved if the aspect type binding was a BinaryTypeBinding
+ // if (innerTypeBinding instanceof UnresolvedReferenceBinding) {
+ // innerTypeBinding = BinaryTypeBinding
+ // .resolveType(innerTypeBinding, factory.getLookupEnvironment(), true);
+ // }
+ // t.memberTypes(); // cause initialization
+ // t.memberTypes = new ReferenceBinding[] { innerTypeBinding };
+ //
+ // int stop = 1;
+ // // The inner type from the aspect should be put into the membertypebindings for this
+ //
+ // }
+ // }
+
}
} else {
weaveInterTypeDeclarations(sourceType, factory.getTypeMungers(), factory.getDeclareParents(), factory
}
}
- private void weaveInterTypeDeclarations(SourceTypeBinding sourceType, Collection typeMungers, Collection declareParents,
- Collection declareAnnotationOnTypes, boolean skipInners) {
+ private void weaveInterTypeDeclarations(SourceTypeBinding sourceType, List<ConcreteTypeMunger> typeMungers,
+ List<DeclareParents> declareParents, List<DeclareAnnotation> declareAnnotationOnTypes, boolean skipInners) {
ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.WEAVING_INTERTYPE_DECLARATIONS,
sourceType.sourceName);
// messages...
List decpToRepeat = new ArrayList();
- List decaToRepeat = new ArrayList();
+ List<DeclareAnnotation> decaToRepeat = new ArrayList<DeclareAnnotation>();
boolean anyNewParents = false;
boolean anyNewAnnotations = false;
}
}
- for (Iterator i = declareAnnotationOnTypes.iterator(); i.hasNext();) {
- DeclareAnnotation deca = (DeclareAnnotation) i.next();
+ for (Iterator<DeclareAnnotation> i = declareAnnotationOnTypes.iterator(); i.hasNext();) {
+ DeclareAnnotation deca = i.next();
boolean didSomething = doDeclareAnnotations(deca, sourceType, true);
if (didSomething) {
-
anyNewAnnotations = true;
} else {
if (!deca.getTypePattern().isStar()) {
decaToRepeat.removeAll(forRemoval);
}
- for (Iterator i = typeMungers.iterator(); i.hasNext();) {
+ for (Iterator<ConcreteTypeMunger> i = typeMungers.iterator(); i.hasNext();) {
EclipseTypeMunger munger = (EclipseTypeMunger) i.next();
if (munger.matches(onType)) {
if (needOldStyleWarning) {
needOldStyleWarning = false;
}
onType.addInterTypeMunger(munger, true);
+ if (munger.getMunger()!=null && munger.getMunger().getKind() == ResolvedTypeMunger.InnerClass) {
+ // Must do these right now, because if we do an ITD member afterwards it may attempt to reference the
+ // type being applied (the call above 'addInterTypeMunger' will fail for these ITDs if it needed
+ // it to be in place)
+ if (munger.munge(sourceType, onType)) {
+ if (factory.pushinCollector != null) {
+ factory.pushinCollector.tagAsMunged(sourceType, munger.getSourceMethod());
+ }
+ }
+ }
}
}
onType.checkInterTypeMungers();
for (Iterator i = onType.getInterTypeMungers().iterator(); i.hasNext();) {
EclipseTypeMunger munger = (EclipseTypeMunger) i.next();
- if (munger.munge(sourceType, onType)) {
- if (factory.pushinCollector != null) {
- factory.pushinCollector.tagAsMunged(sourceType, munger.getSourceMethod());
+ if (munger.getMunger()==null || munger.getMunger().getKind() != ResolvedTypeMunger.InnerClass) {
+ if (munger.munge(sourceType, onType)) {
+ if (factory.pushinCollector != null) {
+ factory.pushinCollector.tagAsMunged(sourceType, munger.getSourceMethod());
+ }
}
}
}
return true;
}
+ // very similar to code in AspectDeclaration
private boolean mungeNewInnerClass(SourceTypeBinding sourceType, ResolvedType onType, NewMemberClassTypeMunger munger,
boolean isExactTargetType) {
+++ /dev/null
-/* *******************************************************************
- * Copyright (c) 2010 Contributors
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Andy Clement - SpringSource
- * ******************************************************************/
-package org.aspectj.ajdt.internal.compiler.lookup;
-
-import org.aspectj.asm.internal.CharOperation;
-import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Binding;
-import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
-import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MemberTypeBinding;
-import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
-import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
-import org.aspectj.weaver.NewMemberClassTypeMunger;
-import org.aspectj.weaver.ResolvedType;
-
-/**
- * A special kind of MemberTypeBinding that is targeting some other type.
- *
- * @author Andy Clement
- */
-public class InterTypeMemberClassBinding extends MemberTypeBinding {
-
- public InterTypeMemberClassBinding(EclipseFactory world, NewMemberClassTypeMunger munger, ResolvedType aspectType,
- ResolvedType onType, String name, SourceTypeBinding sourceTypeOnType) {
- super(toCompoundName(onType, name), sourceTypeOnType.scope, sourceTypeOnType);
- SourceTypeBinding stb = (SourceTypeBinding) world.makeTypeBinding(aspectType);
- ReferenceBinding found = null;
- for (int i = 0; i < stb.memberTypes.length; i++) {
- ReferenceBinding rb = stb.memberTypes[i];
- char[] sn = rb.sourceName;
- if (CharOperation.equals(name.toCharArray(), sn)) {
- found = rb;
- }
- }
-
- if (found == null) {
- throw new IllegalStateException();
- }
- FieldBinding[] fbs = found.fields();
- this.fields = new FieldBinding[fbs.length];
- int fCounter = 0;
- for (FieldBinding fb : fbs) {
- this.fields[fCounter++] = new FieldBinding(fb, this);
- }
- // world.makeTypeBinding(onType));
- // helper interface binding is perhaps a good example of a 'new binding'
- // this.fPackage = enclosingType.fPackage;
- // //this.fileName = scope.referenceCompilationUnit().getFileName();
- // this.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccInterface | ClassFileConstants.AccAbstract;
- // this.sourceName = enclosingType.scope.referenceContext.name;
- // this.enclosingType = enclosingType;
- // this.typeX = typeX;
- this.typeVariables = Binding.NO_TYPE_VARIABLES;
- this.memberTypes = Binding.NO_MEMBER_TYPES;
- // this.scope =enclosingType.scope;
- // this.superInterfaces = new ReferenceBinding[0];
- }
-
- private static char[][] toCompoundName(ResolvedType onType, String name) {
- String memberName = onType.getName() + "$" + name;
- return CharOperation.splitOn('.', memberName.toCharArray());
- }
-}
* ******************************************************************/
package org.aspectj.ajdt.internal.compiler.lookup;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ITypeFinder;
public SourceTypeBinding targetTypeBinding;
// The new types declared onto the target
- private List<ReferenceBinding> intertypeMemberTypes = new ArrayList<ReferenceBinding>();
+ private Set<ReferenceBinding> intertypeMemberTypes = new HashSet<ReferenceBinding>();
public void addInterTypeMemberType(ReferenceBinding binding) {
intertypeMemberTypes.add(binding);