--- /dev/null
+.isJava5
\ No newline at end of file
protected final ResolvedType type;
- private Set supportedTargets = null; // @target meta annotation
+ private Set<String> supportedTargets = null; // @target meta annotation
public AbstractAnnotationAJ(ResolvedType type) {
this.type = type;
if (supportedTargets == null) {
AnnotationAJ atTargetAnnotation = retrieveAnnotationOnAnnotation(UnresolvedType.AT_TARGET);
if (atTargetAnnotation == null) {
- supportedTargets = Collections.EMPTY_SET;
+ supportedTargets = Collections.emptySet();
} else {
supportedTargets = atTargetAnnotation.getTargets();
}
public final String getValidTargets() {
StringBuffer sb = new StringBuffer();
sb.append("{");
- for (Iterator iter = supportedTargets.iterator(); iter.hasNext();) {
- String evalue = (String) iter.next();
+ for (Iterator<String> iter = supportedTargets.iterator(); iter.hasNext();) {
+ String evalue = iter.next();
sb.append(evalue);
if (iter.hasNext()) {
sb.append(",");
protected boolean hasMatchedAtLeastOnce = false;
- protected List/* Lint.Kind */suppressedLintKinds = null; // based on
- // annotations on
- // this advice
+ // based on annotations on this advice
+ protected List<Lint.Kind> suppressedLintKinds = null;
public ISourceLocation lastReportedMonitorExitJoinpointLocation = null;
}
}
+ @Override
public boolean match(Shadow shadow, World world) {
if (super.match(shadow, world)) {
if (shadow.getKind() == Shadow.ExceptionHandler) {
}
}
+ @Override
public Pointcut getPointcut() {
return pointcut;
}
* @param fromType is guaranteed to be a non-abstract aspect
* @param clause has been concretized at a higher level
*/
+ @Override
public ShadowMunger concretize(ResolvedType fromType, World world, PerClause clause) {
// assert !fromType.isAbstract();
Pointcut p = pointcut.concretize(fromType, getDeclaringType(), signature.getArity(), this);
// ---- from object
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("(").append(getKind()).append(extraParametersToString());
}
// XXX this perhaps ought to take account of the other fields in advice ...
+ @Override
public boolean equals(Object other) {
if (!(other instanceof Advice)) {
return false;
private volatile int hashCode = 0;
+ @Override
public int hashCode() {
if (hashCode == 0) {
int result = 17;
private PerClause perClause;
- private List shadowMungers = new ArrayList(4);
- private List typeMungers = new ArrayList(4);
- private List lateTypeMungers = new ArrayList(0);
+ private List<ShadowMunger> shadowMungers = new ArrayList<ShadowMunger>(4);
+ private List<ConcreteTypeMunger> typeMungers = new ArrayList<ConcreteTypeMunger>(4);
+ private List<ConcreteTypeMunger> lateTypeMungers = new ArrayList<ConcreteTypeMunger>(0);
- private Set declareParents = new HashSet();
- private Set declareSofts = new HashSet();
- private List declareDominates = new ArrayList(4);
+ private Set<DeclareParents> declareParents = new HashSet<DeclareParents>();
+ private Set<DeclareSoft> declareSofts = new HashSet<DeclareSoft>();
+ private List<Declare> declareDominates = new ArrayList<Declare>(4);
// These are like declare parents type mungers
- private Set declareAnnotationsOnType = new HashSet();
- private Set declareAnnotationsOnField = new HashSet();
- private Set declareAnnotationsOnMethods = new HashSet();
+ private Set<DeclareAnnotation> declareAnnotationsOnType = new HashSet<DeclareAnnotation>();
+ private Set<DeclareAnnotation> declareAnnotationsOnField = new HashSet<DeclareAnnotation>();
+ private Set<DeclareAnnotation> declareAnnotationsOnMethods = new HashSet<DeclareAnnotation>();
// declareAnnotationsOnMethods includes constructors too
private boolean shouldConcretizeIfNeeded = true;
shadowMungers.add(m);
}
- public void addShadowMungers(Collection c) {
- for (Iterator i = c.iterator(); i.hasNext();) {
- addShadowMunger((ShadowMunger) i.next());
+ public void addShadowMungers(Collection<ShadowMunger> c) {
+ for (ShadowMunger munger : c) {
+ addShadowMunger(munger);
}
}
addConcreteShadowMunger(m.concretize(inAspect, world, perClause));
}
- public void addTypeMungers(Collection c) {
+ public void addTypeMungers(Collection<ConcreteTypeMunger> c) {
typeMungers.addAll(c);
}
typeMungers.add(m);
}
- public void addLateTypeMungers(Collection c) {
+ public void addLateTypeMungers(Collection<ConcreteTypeMunger> c) {
lateTypeMungers.addAll(c);
}
}
// Check we haven't already got a munger for this:
String signatureToLookFor = typeToExpose.getSignature();
- for (Iterator iterator = typeMungers.iterator(); iterator.hasNext();) {
- ConcreteTypeMunger cTM = (ConcreteTypeMunger) iterator.next();
+ for (Iterator<ConcreteTypeMunger> iterator = typeMungers.iterator(); iterator.hasNext();) {
+ ConcreteTypeMunger cTM = iterator.next();
ResolvedTypeMunger rTM = cTM.getMunger();
if (rTM != null && rTM instanceof ExposeTypeMunger) {
String exposedType = ((ExposeTypeMunger) rTM).getExposedTypeSignature();
addTypeMunger(world.getWeavingSupport().concreteTypeMunger(new PrivilegedAccessMunger(member), inAspect));
}
- public Collection getCflowEntries() {
- ArrayList ret = new ArrayList();
- for (Iterator i = shadowMungers.iterator(); i.hasNext();) {
- ShadowMunger m = (ShadowMunger) i.next();
+ public Collection<ShadowMunger> getCflowEntries() {
+ List<ShadowMunger> ret = new ArrayList<ShadowMunger>();
+ for (ShadowMunger m : shadowMungers) {
if (m instanceof Advice) {
Advice a = (Advice) m;
if (a.getKind().isCflow()) {
if (careAboutShadowMungers) {
// bug 129163: use set equality rather than list equality
- Set theseShadowMungers = new HashSet();
- Set theseInlinedAroundMungers = new HashSet();
- for (Iterator iter = shadowMungers.iterator(); iter.hasNext();) {
- ShadowMunger munger = (ShadowMunger) iter.next();
+ Set<ShadowMunger> theseShadowMungers = new HashSet<ShadowMunger>();
+ Set<ShadowMunger> theseInlinedAroundMungers = new HashSet<ShadowMunger>();
+ for (ShadowMunger munger : shadowMungers) {
if (munger instanceof Advice) {
Advice adviceMunger = (Advice) munger;
// bug 154054: if we're around advice that has been inlined
theseShadowMungers.add(munger);
}
}
- Set tempSet = new HashSet();
+ Set<ShadowMunger> tempSet = new HashSet<ShadowMunger>();
tempSet.addAll(other.shadowMungers);
- Set otherShadowMungers = new HashSet();
- Set otherInlinedAroundMungers = new HashSet();
- for (Iterator iter = tempSet.iterator(); iter.hasNext();) {
- ShadowMunger munger = (ShadowMunger) iter.next();
+ Set<ShadowMunger> otherShadowMungers = new HashSet<ShadowMunger>();
+ Set<ShadowMunger> otherInlinedAroundMungers = new HashSet<ShadowMunger>();
+ for (ShadowMunger munger : tempSet) {
if (munger instanceof Advice) {
Advice adviceMunger = (Advice) munger;
// bug 154054: if we're around advice that has been inlined
// bug 158573 - if there are no changes then preserve whether
// or not a particular shadowMunger has matched something.
if (!changed) {
- for (Iterator iter = shadowMungers.iterator(); iter.hasNext();) {
- ShadowMunger munger = (ShadowMunger) iter.next();
+ for (ShadowMunger munger : shadowMungers) {
int i = other.shadowMungers.indexOf(munger);
- ShadowMunger otherMunger = (ShadowMunger) other.shadowMungers.get(i);
+ ShadowMunger otherMunger = other.shadowMungers.get(i);
if (munger instanceof Advice) {
((Advice) otherMunger).setHasMatchedSomething(((Advice) munger).hasMatchedSomething());
}
// if we dont care about shadow mungers then ignore those
// typeMungers which are created to help with the implementation
// of shadowMungers
- Set theseTypeMungers = new HashSet();
- Set otherTypeMungers = new HashSet();
+ Set<Object> theseTypeMungers = new HashSet<Object>();
+ Set<Object> otherTypeMungers = new HashSet<Object>();
if (!careAboutShadowMungers) {
- for (Iterator iter = typeMungers.iterator(); iter.hasNext();) {
+ for (Iterator<ConcreteTypeMunger> iter = typeMungers.iterator(); iter.hasNext();) {
Object o = iter.next();
if (o instanceof ConcreteTypeMunger) {
ConcreteTypeMunger typeMunger = (ConcreteTypeMunger) o;
}
}
- for (Iterator iter = other.typeMungers.iterator(); iter.hasNext();) {
+ for (Iterator<ConcreteTypeMunger> iter = other.typeMungers.iterator(); iter.hasNext();) {
Object o = iter.next();
if (o instanceof ConcreteTypeMunger) {
ConcreteTypeMunger typeMunger = (ConcreteTypeMunger) o;
} else {
boolean shouldOverwriteThis = false;
boolean foundInequality = false;
- for (Iterator iter = theseTypeMungers.iterator(); iter.hasNext() && !foundInequality;) {
+ for (Iterator<Object> iter = theseTypeMungers.iterator(); iter.hasNext() && !foundInequality;) {
Object thisOne = iter.next();
boolean foundInOtherSet = false;
- for (Iterator iterator = otherTypeMungers.iterator(); iterator.hasNext();) {
- Object otherOne = iterator.next();
+ for (Object otherOne : otherTypeMungers) {
if (thisOne instanceof ConcreteTypeMunger) {
if (((ConcreteTypeMunger) thisOne).shouldOverwrite()) {
shouldOverwriteThis = true;
// the up front comparison
if (!careAboutShadowMungers) {
// this means we are in front end compilation and if the differences are purely mixin parents, we can continue OK
- Set trimmedThis = new HashSet();
- for (Iterator iterator = declareParents.iterator(); iterator.hasNext();) {
- DeclareParents decp = (DeclareParents) iterator.next();
+ Set<DeclareParents> trimmedThis = new HashSet<DeclareParents>();
+ for (Iterator<DeclareParents> iterator = declareParents.iterator(); iterator.hasNext();) {
+ DeclareParents decp = iterator.next();
if (!decp.isMixin()) {
trimmedThis.add(decp);
}
}
- Set trimmedOther = new HashSet();
- for (Iterator iterator = other.declareParents.iterator(); iterator.hasNext();) {
- DeclareParents decp = (DeclareParents) iterator.next();
+ Set<DeclareParents> trimmedOther = new HashSet<DeclareParents>();
+ for (Iterator<DeclareParents> iterator = other.declareParents.iterator(); iterator.hasNext();) {
+ DeclareParents decp = iterator.next();
if (!decp.isMixin()) {
trimmedOther.add(decp);
}
return changed;
}
- private boolean equivalent(Set theseInlinedAroundMungers, Set otherInlinedAroundMungers) {
+ private boolean equivalent(Set<ShadowMunger> theseInlinedAroundMungers, Set<ShadowMunger> otherInlinedAroundMungers) {
if (theseInlinedAroundMungers.size() != otherInlinedAroundMungers.size()) {
return false;
}
- for (Iterator iter = theseInlinedAroundMungers.iterator(); iter.hasNext();) {
+ for (Iterator<ShadowMunger> iter = theseInlinedAroundMungers.iterator(); iter.hasNext();) {
Advice thisAdvice = (Advice) iter.next();
boolean foundIt = false;
- for (Iterator iterator = otherInlinedAroundMungers.iterator(); iterator.hasNext();) {
+ for (Iterator<ShadowMunger> iterator = otherInlinedAroundMungers.iterator(); iterator.hasNext();) {
Advice otherAdvice = (Advice) iterator.next();
if (thisAdvice.equals(otherAdvice)) {
if (thisAdvice.getSignature() instanceof ResolvedMemberImpl) {
}
}
- public List getDeclareDominates() {
+ public List<Declare> getDeclareDominates() {
return declareDominates;
}
- public Collection getDeclareParents() {
+ public Collection<DeclareParents> getDeclareParents() {
return declareParents;
}
- public Collection getDeclareSofts() {
+ public Collection<DeclareSoft> getDeclareSofts() {
return declareSofts;
}
- public List getShadowMungers() {
+ public List<ShadowMunger> getShadowMungers() {
return shadowMungers;
}
- public List getTypeMungers() {
+ public List<ConcreteTypeMunger> getTypeMungers() {
return typeMungers;
}
- public List getLateTypeMungers() {
+ public List<ConcreteTypeMunger> getLateTypeMungers() {
return lateTypeMungers;
}
- public Collection getDeclareAnnotationOnTypes() {
+ public Collection<DeclareAnnotation> getDeclareAnnotationOnTypes() {
return declareAnnotationsOnType;
}
- public Collection getDeclareAnnotationOnFields() {
+ public Collection<DeclareAnnotation> getDeclareAnnotationOnFields() {
return declareAnnotationsOnField;
}
/**
* includes declare @method and @constructor
*/
- public Collection getDeclareAnnotationOnMethods() {
+ public Collection<DeclareAnnotation> getDeclareAnnotationOnMethods() {
return declareAnnotationsOnMethods;
}
import java.util.Map;
import java.util.Set;
+import org.aspectj.weaver.patterns.DeclareAnnotation;
import org.aspectj.weaver.patterns.DeclareParents;
import org.aspectj.weaver.patterns.IVerificationRequired;
import org.aspectj.weaver.tools.Trace;
private transient World world;
// FIXME AV - ? we may need a sequencedHashMap there to ensure source based precedence for @AJ advice
- private final Map /* ResolvedType (the aspect) > CrosscuttingMembers */members = new HashMap();
+ private final Map /* ResolvedType (the aspect) > CrosscuttingMembers */<ResolvedType, CrosscuttingMembers> members = new HashMap<ResolvedType, CrosscuttingMembers>();
// List of things to be verified once the type system is 'complete'
- private transient List /* IVerificationRequired */verificationList = null;
+ private transient List /* IVerificationRequired */<IVerificationRequired> verificationList = null;
- private List /* ShadowMunger */shadowMungers = null;
+ private List<ShadowMunger> shadowMungers = null;
private List typeMungers = null;
private List lateTypeMungers = null;
private List declareSofts = null;
private List declareParents = null;
private List declareAnnotationOnTypes = null;
private List declareAnnotationOnFields = null;
- private List declareAnnotationOnMethods = null; // includes constructors
+ private List<DeclareAnnotation> declareAnnotationOnMethods = null; // includes constructors
private List declareDominates = null;
private boolean changedSinceLastReset = false;
}
boolean change = false;
- CrosscuttingMembers xcut = (CrosscuttingMembers) members.get(aspectType);
+ CrosscuttingMembers xcut = members.get(aspectType);
if (xcut == null) {
members.put(aspectType, aspectType.collectCrosscuttingMembers(inWeavingPhase));
clearCaches();
private boolean addOrReplaceDescendantsOf(ResolvedType aspectType, boolean inWeavePhase) {
// System.err.println("Looking at descendants of "+aspectType.getName());
- Set knownAspects = members.keySet();
- Set toBeReplaced = new HashSet();
- for (Iterator it = knownAspects.iterator(); it.hasNext();) {
- ResolvedType candidateDescendant = (ResolvedType) it.next();
+ Set<ResolvedType> knownAspects = members.keySet();
+ Set<ResolvedType> toBeReplaced = new HashSet<ResolvedType>();
+ for (Iterator<ResolvedType> it = knownAspects.iterator(); it.hasNext();) {
+ ResolvedType candidateDescendant = it.next();
if ((candidateDescendant != aspectType) && (aspectType.isAssignableFrom(candidateDescendant))) {
toBeReplaced.add(candidateDescendant);
}
}
boolean change = false;
- for (Iterator it = toBeReplaced.iterator(); it.hasNext();) {
- ResolvedType next = (ResolvedType) it.next();
+ for (Iterator<ResolvedType> it = toBeReplaced.iterator(); it.hasNext();) {
+ ResolvedType next = it.next();
boolean thisChange = addOrReplaceAspect(next, inWeavePhase);
change = change || thisChange;
}
if (!members.containsKey(aspectType)) {
return;
}
- CrosscuttingMembers xcut = (CrosscuttingMembers) members.get(aspectType);
+ CrosscuttingMembers xcut = members.get(aspectType);
xcut.addDeclares(aspectType.collectDeclares(true));
}
public List getShadowMungers() {
if (shadowMungers == null) {
ArrayList ret = new ArrayList();
- for (Iterator i = members.values().iterator(); i.hasNext();) {
- ret.addAll(((CrosscuttingMembers) i.next()).getShadowMungers());
+ for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+ ret.addAll(i.next().getShadowMungers());
}
shadowMungers = ret;
}
public List getTypeMungers() {
if (typeMungers == null) {
ArrayList ret = new ArrayList();
- for (Iterator i = members.values().iterator(); i.hasNext();) {
- ret.addAll(((CrosscuttingMembers) i.next()).getTypeMungers());
+ for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+ ret.addAll(i.next().getTypeMungers());
}
typeMungers = ret;
}
public List getLateTypeMungers() {
if (lateTypeMungers == null) {
ArrayList ret = new ArrayList();
- for (Iterator i = members.values().iterator(); i.hasNext();) {
- ret.addAll(((CrosscuttingMembers) i.next()).getLateTypeMungers());
+ for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+ ret.addAll(i.next().getLateTypeMungers());
}
lateTypeMungers = ret;
}
public List getDeclareSofts() {
if (declareSofts == null) {
Set ret = new HashSet();
- for (Iterator i = members.values().iterator(); i.hasNext();) {
- ret.addAll(((CrosscuttingMembers) i.next()).getDeclareSofts());
+ for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+ ret.addAll(i.next().getDeclareSofts());
}
declareSofts = new ArrayList();
declareSofts.addAll(ret);
public List getDeclareParents() {
if (declareParents == null) {
Set ret = new HashSet();
- for (Iterator i = members.values().iterator(); i.hasNext();) {
- ret.addAll(((CrosscuttingMembers) i.next()).getDeclareParents());
+ for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+ ret.addAll(i.next().getDeclareParents());
}
declareParents = new ArrayList();
declareParents.addAll(ret);
public List getDeclareAnnotationOnTypes() {
if (declareAnnotationOnTypes == null) {
Set ret = new HashSet();
- for (Iterator i = members.values().iterator(); i.hasNext();) {
- ret.addAll(((CrosscuttingMembers) i.next()).getDeclareAnnotationOnTypes());
+ for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+ ret.addAll(i.next().getDeclareAnnotationOnTypes());
}
declareAnnotationOnTypes = new ArrayList();
declareAnnotationOnTypes.addAll(ret);
public List getDeclareAnnotationOnFields() {
if (declareAnnotationOnFields == null) {
Set ret = new HashSet();
- for (Iterator i = members.values().iterator(); i.hasNext();) {
- ret.addAll(((CrosscuttingMembers) i.next()).getDeclareAnnotationOnFields());
+ for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+ ret.addAll(i.next().getDeclareAnnotationOnFields());
}
declareAnnotationOnFields = new ArrayList();
declareAnnotationOnFields.addAll(ret);
/**
* Return an amalgamation of the declare @method/@constructor statements.
*/
- public List getDeclareAnnotationOnMethods() {
+ public List<DeclareAnnotation> getDeclareAnnotationOnMethods() {
if (declareAnnotationOnMethods == null) {
- Set ret = new HashSet();
- for (Iterator i = members.values().iterator(); i.hasNext();) {
- ret.addAll(((CrosscuttingMembers) i.next()).getDeclareAnnotationOnMethods());
+ Set<DeclareAnnotation> ret = new HashSet<DeclareAnnotation>();
+ for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+ ret.addAll(i.next().getDeclareAnnotationOnMethods());
}
- declareAnnotationOnMethods = new ArrayList();
+ declareAnnotationOnMethods = new ArrayList<DeclareAnnotation>();
declareAnnotationOnMethods.addAll(ret);
}
return declareAnnotationOnMethods;
public List getDeclareDominates() {
if (declareDominates == null) {
ArrayList ret = new ArrayList();
- for (Iterator i = members.values().iterator(); i.hasNext();) {
- ret.addAll(((CrosscuttingMembers) i.next()).getDeclareDominates());
+ for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+ ret.addAll(i.next().getDeclareDominates());
}
declareDominates = ret;
}
}
public ResolvedType findAspectDeclaringParents(DeclareParents p) {
- Set keys = this.members.keySet();
- for (Iterator iter = keys.iterator(); iter.hasNext();) {
- ResolvedType element = (ResolvedType) iter.next();
- for (Iterator i = ((CrosscuttingMembers) members.get(element)).getDeclareParents().iterator(); i.hasNext();) {
+ Set<ResolvedType> keys = this.members.keySet();
+ for (Iterator<ResolvedType> iter = keys.iterator(); iter.hasNext();) {
+ ResolvedType element = iter.next();
+ for (Iterator i = members.get(element).getDeclareParents().iterator(); i.hasNext();) {
DeclareParents dp = (DeclareParents) i.next();
if (dp.equals(p)) {
return element;
*/
public void recordNecessaryCheck(IVerificationRequired verification) {
if (verificationList == null) {
- verificationList = new ArrayList();
+ verificationList = new ArrayList<IVerificationRequired>();
}
verificationList.add(verification);
}
if (verificationList == null) {
return;
}
- for (Iterator iter = verificationList.iterator(); iter.hasNext();) {
- IVerificationRequired element = (IVerificationRequired) iter.next();
+ for (Iterator<IVerificationRequired> iter = verificationList.iterator(); iter.hasNext();) {
+ IVerificationRequired element = iter.next();
element.verify();
}
verificationList = null;
import org.aspectj.weaver.tools.TraceFactory;
public class Lint {
- /* private */Map kinds = new HashMap();
+ Map<String, Lint.Kind> kinds = new HashMap<String, Lint.Kind>();
/* private */World world;
public final Kind invalidAbsoluteTypeName = new Kind("invalidAbsoluteTypeName", "no match for this type name: {0}");
}
private void setAll(IMessage.Kind messageKind) {
- for (Iterator i = kinds.values().iterator(); i.hasNext();) {
- Kind kind = (Kind) i.next();
+ for (Kind kind : kinds.values()) {
kind.setKind(messageKind);
}
}
public void setFromProperties(Properties properties) {
for (Iterator i = properties.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry) i.next();
- Kind kind = (Kind) kinds.get(entry.getKey());
+ Kind kind = kinds.get(entry.getKey());
if (kind == null) {
MessageUtil.error(world.getMessageHandler(), WeaverMessages.format(WeaverMessages.XLINT_KEY_ERROR, entry.getKey()));
} else {
}
}
- public Collection allKinds() {
+ public Collection<Kind> allKinds() {
return kinds.values();
}
public Kind getLintKind(String name) {
- return (Kind) kinds.get(name);
+ return kinds.get(name);
}
// temporarily suppress the given lint messages
// remove any suppression of lint warnings in place
public void clearAllSuppressions() {
- for (Iterator iter = kinds.values().iterator(); iter.hasNext();) {
- Kind k = (Kind) iter.next();
+ for (Kind k : kinds.values()) {
k.setSuppressed(false);
}
}
- public void clearSuppressions(Collection lintKind) {
- if (lintKind.isEmpty())
- return;
- for (Iterator iter = lintKind.iterator(); iter.hasNext();) {
- Kind k = (Kind) iter.next();
+ public void clearSuppressions(Collection<Lint.Kind> lintKinds) {
+ for (Kind k : lintKinds) {
k.setSuppressed(false);
}
}
}
public Kind fromKey(String lintkey) {
- return (Lint.Kind) kinds.get(lintkey);
+ return kinds.get(lintkey);
}
public class Kind {
*/
protected ResolvedMember backingGenericMember = null;
- protected Set annotationTypes = null;
+ protected Set<UnresolvedType> annotationTypes = null;
protected ResolvedType[][] parameterAnnotationTypes = null;
// Some members are 'created' to represent other things (for example ITDs).
// ----
+ @Override
public final int getModifiers(World world) {
return modifiers;
}
+ @Override
public final int getModifiers() {
return modifiers;
}
// ----
+ @Override
public final UnresolvedType[] getExceptions(World world) {
return getExceptions();
}
}
return backingGenericMember.getAnnotationTypes();
}
- if (annotationTypes == null)
+ if (annotationTypes == null) {
return null;
- return (ResolvedType[]) annotationTypes.toArray(new ResolvedType[] {});
+ }
+ return annotationTypes.toArray(new ResolvedType[] {});
}
public String getAnnotationDefaultValue() {
"You should resolve this member and call getAnnotationDefaultValue() on the result...");
}
+ @Override
public AnnotationAJ[] getAnnotations() {
if (backingGenericMember != null)
return backingGenericMember.getAnnotations();
}
public void setAnnotationTypes(UnresolvedType[] annotationtypes) {
- if (annotationTypes == null)
- annotationTypes = new HashSet();
+ if (annotationTypes == null) {
+ annotationTypes = new HashSet<UnresolvedType>();
+ }
for (int i = 0; i < annotationtypes.length; i++) {
UnresolvedType typeX = annotationtypes[i];
annotationTypes.add(typeX);
public void addAnnotation(AnnotationAJ annotation) {
// FIXME asc only allows for annotation types, not instances - should
// it?
- if (annotationTypes == null)
- annotationTypes = new HashSet();
+ if (annotationTypes == null) {
+ annotationTypes = new HashSet<UnresolvedType>();
+ }
annotationTypes.add(annotation.getType());
}
// OPTIMIZE dont like how resolve(world) on ResolvedMemberImpl does
// something different to world.resolve(member)
+ @Override
public ResolvedMember resolve(World world) {
// make sure all the pieces of a resolvedmember really are resolved
try {
}
world.setTypeVariableLookupScope(this);
if (annotationTypes != null) {
- Set r = new HashSet();
- for (Iterator iter = annotationTypes.iterator(); iter.hasNext();) {
- UnresolvedType element = (UnresolvedType) iter.next();
+ Set<UnresolvedType> r = new HashSet<UnresolvedType>();
+ for (UnresolvedType element : annotationTypes) {
+ // for (Iterator iter = annotationTypes.iterator(); iter.hasNext();) {
+ // UnresolvedType element = (UnresolvedType) iter.next();
r.add(world.resolve(element));
}
annotationTypes = r;
parameterNames = pnames;
}
+ @Override
public final String[] getParameterNames(World world) {
return getParameterNames();
}
/**
* Get the UnresolvedType for the return type, taking generic signature into account
*/
+ @Override
public UnresolvedType getGenericReturnType() {
return getReturnType();
}
/**
* Get the TypeXs of the parameter types, taking generic signature into account
*/
+ @Override
public UnresolvedType[] getGenericParameterTypes() {
return getParameterTypes();
}
private Member matchingSignature;
private ResolvedMember resolvedSignature;
protected final Shadow enclosingShadow;
- protected List mungers = Collections.EMPTY_LIST;
+ protected List<ShadowMunger> mungers = Collections.emptyList();
public int shadowId = nextShadowID++; // every time we build a shadow, it gets a new id
public abstract World getIWorld();
- public List /* ShadowMunger */getMungers() {
+ public List<ShadowMunger> getMungers() {
return mungers;
}
import org.aspectj.bridge.context.PinpointingMessageHandler;
import org.aspectj.util.IStructureModel;
import org.aspectj.weaver.UnresolvedType.TypeKind;
+import org.aspectj.weaver.patterns.DeclareAnnotation;
import org.aspectj.weaver.patterns.DeclarePrecedence;
import org.aspectj.weaver.patterns.Pointcut;
import org.aspectj.weaver.patterns.TypePattern;
return crosscuttingMembersSet.getDeclareAnnotationOnFields();
}
- public List getDeclareAnnotationOnMethods() {
+ public List<DeclareAnnotation> getDeclareAnnotationOnMethods() {
return crosscuttingMembersSet.getDeclareAnnotationOnMethods();
}
aspect2 = a2;
}
+ @Override
public boolean equals(Object obj) {
if (!(obj instanceof PrecedenceCacheKey))
return false;
return (aspect1 == other.aspect1 && aspect2 == other.aspect2);
}
+ @Override
public int hashCode() {
return aspect1.hashCode() + aspect2.hashCode();
}
}
}
- public AnnotationAJ getAnnotationX() {
+ public AnnotationAJ getAnnotation() {
ensureAnnotationDiscovered();
return annotation;
}
}
public DeclarePrecedence parseDominates() {
- List l = new ArrayList();
+ List<TypePattern> l = new ArrayList<TypePattern>();
do {
l.add(parseTypePattern());
} while (maybeEat(","));
}
boolean isExtends = t.getString().equals("extends");
- List l = new ArrayList();
+ List<TypePattern> l = new ArrayList<TypePattern>();
do {
l.add(parseTypePattern());
} while (maybeEat(","));
return new PointcutDesignatorHandlerBasedPointcut(pcExpr, world);
}
- public List parseDottedIdentifier() {
- List ret = new ArrayList();
+ public List<String> parseDottedIdentifier() {
+ List<String> ret = new ArrayList<String>();
ret.add(parseIdentifier());
while (maybeEat(".")) {
ret.add(parseIdentifier());
// PVAL cope with annotation values at other places in this code
public AnnotationTypePattern maybeParseSingleAnnotationPattern() {
AnnotationTypePattern ret = null;
- Map values = null;
+ Map<String, String> values = null;
// LALR(2) - fix by making "!@" a single token
int startIndex = tokenSource.getIndex();
if (maybeEat("!")) {
// Parse annotation values. In an expression in @A(a=b,c=d) this method will be
// parsing the a=b,c=d.)
- public Map/* String,String */parseAnnotationValues() {
- Map values = new HashMap();
+ public Map/* String,String */<String, String>parseAnnotationValues() {
+ Map<String, String> values = new HashMap<String, String>();
boolean seenDefaultValue = false;
do {
String possibleKeyString = parseAnnotationNameValuePattern();
return parseHasFieldTypePattern();
}
- List names = parseDottedNamePattern();
+ List<NamePattern> names = parseDottedNamePattern();
int dim = 0;
while (maybeEat("[")) {
boolean isVarArgs = maybeEat("...");
// ??? what about the source location of any's????
- if (names.size() == 1 && ((NamePattern) names.get(0)).isAny() && dim == 0 && !isVarArgs && typeParameters == null)
+ if (names.size() == 1 && names.get(0).isAny() && dim == 0 && !isVarArgs && typeParameters == null)
return TypePattern.ANY;
// Notice we increase the dimensions if varargs is set. this is to allow type matching to
}
public TypePattern parseGenericsWildcardTypePattern() {
- List names = new ArrayList();
+ List<NamePattern> names = new ArrayList<NamePattern>();
names.add(new NamePattern("?"));
TypePattern upperBound = null;
TypePattern[] additionalInterfaceBounds = new TypePattern[0];
// return p;
// }
- public List parseDottedNamePattern() {
- List names = new ArrayList();
+ public List<NamePattern> parseDottedNamePattern() {
+ List<NamePattern> names = new ArrayList<NamePattern>();
StringBuffer buf = new StringBuffer();
IToken previous = null;
boolean justProcessedEllipsis = false; // Remember if we just dealt with an ellipsis (PR61536)
}
public TypePatternList parseArgumentsPattern(boolean parameterAnnotationsPossible) {
- List patterns = new ArrayList();
+ List<TypePattern> patterns = new ArrayList<TypePattern>();
eat("(");
// ()
}
public AnnotationPatternList parseArgumentsAnnotationPattern() {
- List patterns = new ArrayList();
+ List<AnnotationTypePattern> patterns = new ArrayList<AnnotationTypePattern>();
eat("(");
if (maybeEat(")")) {
return new AnnotationPatternList();
IToken t = tokenSource.peek();
if (t.isIdentifier() && t.getString().equals("throws")) {
tokenSource.next();
- List required = new ArrayList();
- List forbidden = new ArrayList();
+ List<TypePattern> required = new ArrayList<TypePattern>();
+ List<TypePattern> forbidden = new ArrayList<TypePattern>();
do {
boolean isForbidden = maybeEat("!");
// ???might want an error for a second ! without a paren
public TypeVariablePatternList maybeParseTypeVariableList() {
if (!maybeEat("<"))
return null;
- List typeVars = new ArrayList();
+ List<TypeVariablePattern> typeVars = new ArrayList<TypeVariablePattern>();
TypeVariablePattern t = parseTypeVariable();
typeVars.add(t);
while (maybeEat(",")) {
public String[] maybeParseSimpleTypeVariableList() {
if (!maybeEat("<"))
return null;
- List typeVarNames = new ArrayList();
+ List<String> typeVarNames = new ArrayList<String>();
do {
typeVarNames.add(parseIdentifier());
} while (maybeEat(","));
public TypePatternList maybeParseTypeParameterList() {
if (!maybeEat("<"))
return null;
- List typePats = new ArrayList();
+ List<TypePattern> typePats = new ArrayList<TypePattern>();
do {
TypePattern tp = parseTypePattern(true, false);
typePats.add(tp);
}
private TypePattern[] maybeParseAdditionalInterfaceBounds() {
- List boundsList = new ArrayList();
+ List<TypePattern> boundsList = new ArrayList<TypePattern>();
while (maybeEat("&")) {
TypePattern tp = parseTypePattern();
boundsList.add(tp);