diff options
author | Andy Clement <aclement@gopivotal.com> | 2014-10-08 09:07:52 -0700 |
---|---|---|
committer | Andy Clement <aclement@gopivotal.com> | 2014-10-08 09:07:52 -0700 |
commit | b6aec92d1ec73033130ecbb5552bf54ceb1cb85f (patch) | |
tree | cec50f9ea51317f76f132c01233c8446c58c046a /org.aspectj.matcher | |
parent | 170b1cef3f6f2c4792eb4c07c76ab19bee9daca7 (diff) | |
download | aspectj-b6aec92d1ec73033130ecbb5552bf54ceb1cb85f.tar.gz aspectj-b6aec92d1ec73033130ecbb5552bf54ceb1cb85f.zip |
Use generics
Diffstat (limited to 'org.aspectj.matcher')
27 files changed, 88 insertions, 155 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AndAnnotationTypePattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AndAnnotationTypePattern.java index 4889d0f9a..c14f36025 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AndAnnotationTypePattern.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AndAnnotationTypePattern.java @@ -17,6 +17,7 @@ import org.aspectj.weaver.AnnotatedElement; import org.aspectj.weaver.CompressingDataOutputStream; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.ResolvedType; +import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.World; import org.aspectj.weaver.AjAttribute.WeaverVersionInfo; @@ -63,7 +64,7 @@ public class AndAnnotationTypePattern extends AnnotationTypePattern { return this; } - public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) { + public AnnotationTypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { AnnotationTypePattern newLeft = left.parameterizeWith(typeVariableMap, w); AnnotationTypePattern newRight = right.parameterizeWith(typeVariableMap, w); AndAnnotationTypePattern ret = new AndAnnotationTypePattern(newLeft, newRight); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationPatternList.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationPatternList.java index 6b6d820b7..0b93b48d1 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationPatternList.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationPatternList.java @@ -18,14 +18,12 @@ import org.aspectj.weaver.CompressingDataOutputStream; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.IntMap; import org.aspectj.weaver.ResolvedType; +import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.World; /** - * @author colyer - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code - * Templates + * @author Adrian Colyer */ public class AnnotationPatternList extends PatternNode { @@ -38,7 +36,7 @@ public class AnnotationPatternList extends PatternNode { new AnnotationTypePattern[] { AnnotationTypePattern.ELLIPSIS }); public AnnotationPatternList() { - typePatterns = new AnnotationTypePattern[0]; + typePatterns = new AnnotationTypePattern[0]; ellipsisCount = 0; } @@ -51,7 +49,7 @@ public class AnnotationPatternList extends PatternNode { } } - public AnnotationPatternList(List l) { + public AnnotationPatternList(List<AnnotationTypePattern> l) { this((AnnotationTypePattern[]) l.toArray(new AnnotationTypePattern[l.size()])); } @@ -59,7 +57,7 @@ public class AnnotationPatternList extends PatternNode { return typePatterns; } - public AnnotationPatternList parameterizeWith(Map typeVariableMap, World w) { + public AnnotationPatternList parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { AnnotationTypePattern[] parameterizedPatterns = new AnnotationTypePattern[this.typePatterns.length]; for (int i = 0; i < parameterizedPatterns.length; i++) { parameterizedPatterns[i] = this.typePatterns[i].parameterizeWith(typeVariableMap, w); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationPointcut.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationPointcut.java index 44b346e60..0a197254a 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationPointcut.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationPointcut.java @@ -254,13 +254,13 @@ public class AnnotationPointcut extends NameBindingPointcut { * * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() */ - public List getBindingAnnotationTypePatterns() { + public List<BindingPattern> getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingPattern) { // BindingAnnotationTypePattern) { - List l = new ArrayList(); - l.add(annotationTypePattern); + List<BindingPattern> l = new ArrayList<BindingPattern>(); + l.add((BindingPattern)annotationTypePattern); return l; } else { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } } @@ -269,8 +269,8 @@ public class AnnotationPointcut extends NameBindingPointcut { * * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() */ - public List getBindingTypePatterns() { - return Collections.EMPTY_LIST; + public List<BindingTypePattern> getBindingTypePatterns() { + return Collections.emptyList(); } /* diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java index 0f610fc49..82fb33854 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java @@ -19,6 +19,7 @@ import org.aspectj.weaver.CompressingDataOutputStream; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.IntMap; import org.aspectj.weaver.ResolvedType; +import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.World; @@ -50,7 +51,7 @@ public abstract class AnnotationTypePattern extends PatternNode { public abstract void resolve(World world); - public abstract AnnotationTypePattern parameterizeWith(Map/* name -> ResolvedType */typeVariableMap, World w); + public abstract AnnotationTypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w); public boolean isAny() { return false; diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnyWithAnnotationTypePattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnyWithAnnotationTypePattern.java index fa154f38c..8306ff6d0 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnyWithAnnotationTypePattern.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnyWithAnnotationTypePattern.java @@ -20,6 +20,7 @@ import org.aspectj.util.FuzzyBoolean; import org.aspectj.weaver.CompressingDataOutputStream; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.ResolvedType; +import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; import org.aspectj.weaver.World; @@ -82,7 +83,7 @@ public class AnyWithAnnotationTypePattern extends TypePattern { } @Override - public TypePattern parameterizeWith(Map typeVariableMap, World w) { + public TypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { AnyWithAnnotationTypePattern ret = new AnyWithAnnotationTypePattern(this.annotationPattern.parameterizeWith( typeVariableMap, w)); ret.copyLocationFrom(this); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java index 433908813..db612b8cd 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java @@ -179,36 +179,21 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut { return ret; } - /* - * (non-Javadoc) - * - * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() - */ - public List getBindingAnnotationTypePatterns() { - List l = new ArrayList(); + public List<BindingPattern> getBindingAnnotationTypePatterns() { + List<BindingPattern> l = new ArrayList<BindingPattern>(); AnnotationTypePattern[] pats = arguments.getAnnotationPatterns(); for (int i = 0; i < pats.length; i++) { if (pats[i] instanceof BindingAnnotationTypePattern) { - l.add(pats[i]); + l.add((BindingPattern)pats[i]); } } return l; } - /* - * (non-Javadoc) - * - * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() - */ - public List getBindingTypePatterns() { - return Collections.EMPTY_LIST; + public List<BindingTypePattern> getBindingTypePatterns() { + return Collections.emptyList(); } - /* - * (non-Javadoc) - * - * @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream) - */ public void write(CompressingDataOutputStream s) throws IOException { s.writeByte(Pointcut.ATARGS); arguments.write(s); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ArgsPointcut.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ArgsPointcut.java index a5d3569c2..4898a92b5 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ArgsPointcut.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ArgsPointcut.java @@ -118,21 +118,11 @@ public class ArgsPointcut extends NameBindingPointcut { return argumentsToMatchAgainst; } - /* - * (non-Javadoc) - * - * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() - */ - public List getBindingAnnotationTypePatterns() { - return Collections.EMPTY_LIST; + public List<BindingPattern> getBindingAnnotationTypePatterns() { + return Collections.emptyList(); } - /* - * (non-Javadoc) - * - * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() - */ - public List getBindingTypePatterns() { + public List<BindingTypePattern> getBindingTypePatterns() { List<BindingTypePattern> l = new ArrayList<BindingTypePattern>(); TypePattern[] pats = arguments.getTypePatterns(); for (int i = 0; i < pats.length; i++) { diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/BindingTypePattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/BindingTypePattern.java index c0d5434ef..900285038 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/BindingTypePattern.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/BindingTypePattern.java @@ -96,7 +96,7 @@ public class BindingTypePattern extends ExactTypePattern implements BindingPatte } } - public TypePattern parameterizeWith(Map typeVariableMap, World w) { + public TypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { ExactTypePattern superParameterized = (ExactTypePattern) super.parameterizeWith(typeVariableMap, w); BindingTypePattern ret = new BindingTypePattern(superParameterized.getExactType(), this.formalIndex, this.isVarArgs); ret.copyLocationFrom(this); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/CflowPointcut.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/CflowPointcut.java index 135c496b5..ed66dc0d5 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/CflowPointcut.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/CflowPointcut.java @@ -40,6 +40,7 @@ import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Test; +import org.aspectj.weaver.patterns.ConcreteCflowPointcut.Slot; public class CflowPointcut extends Pointcut { private final Pointcut entry; // The pointcut inside the cflow() that @@ -103,7 +104,7 @@ public class CflowPointcut extends Pointcut { return ret; } - public Pointcut parameterizeWith(Map typeVariableMap, World w) { + public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { CflowPointcut ret = new CflowPointcut(entry.parameterizeWith(typeVariableMap, w), isBelow, freeVars); ret.copyLocationFrom(this); return ret; @@ -250,7 +251,7 @@ public class CflowPointcut extends Pointcut { return ret; } else { - List slots = new ArrayList(); + List<Slot> slots = new ArrayList<Slot>(); for (int i = 0, len = freeVars.length; i < len; i++) { int freeVar = freeVars[i]; diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java index 8a553632b..09208f9c2 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java @@ -13,7 +13,6 @@ package org.aspectj.weaver.patterns; import java.io.IOException; -import java.util.Iterator; import java.util.List; import java.util.Map; @@ -35,12 +34,12 @@ import org.aspectj.weaver.ast.Test; public class ConcreteCflowPointcut extends Pointcut { private final Member cflowField; - List/* Slot */slots; // exposed for testing + List<Slot> slots; // exposed for testing boolean usesCounter; ResolvedType aspect; // Can either use a counter or a stack to implement cflow. - public ConcreteCflowPointcut(ResolvedType aspect, Member cflowField, List slots, boolean usesCounter) { + public ConcreteCflowPointcut(ResolvedType aspect, Member cflowField, List<Slot> slots, boolean usesCounter) { this.aspect = aspect; this.cflowField = cflowField; this.slots = slots; @@ -63,8 +62,7 @@ public class ConcreteCflowPointcut extends Pointcut { // this bit is for pr145693 - we cannot match at all if one of the types is missing, we will be unable // to create the residue if (slots != null) { - for (Iterator i = slots.iterator(); i.hasNext();) { - Slot slot = (Slot) i.next(); + for (Slot slot: slots) { ResolvedType rt = slot.formalType; if (rt.isMissing()) { ISourceLocation[] locs = new ISourceLocation[] { getSourceLocation() }; @@ -98,7 +96,7 @@ public class ConcreteCflowPointcut extends Pointcut { throw new RuntimeException("unimplemented"); } - public Pointcut parameterizeWith(Map typeVariableMap, World w) { + public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { throw new RuntimeException("unimplemented"); } @@ -126,8 +124,7 @@ public class ConcreteCflowPointcut extends Pointcut { return Test.makeFieldGetCall(cflowField, cflowCounterIsValidMethod, Expr.NONE); } else { if (slots != null) { // null for cflows managed by counters - for (Iterator i = slots.iterator(); i.hasNext();) { - Slot slot = (Slot) i.next(); + for (Slot slot: slots) { // System.out.println("slot: " + slot.formalIndex); state.set(slot.formalIndex, aspect.getWorld().getWeavingSupport().makeCflowAccessVar(slot.formalType, cflowField, slot.arrayIndex)); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java index c3a698967..0a46fa1e9 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java @@ -17,6 +17,7 @@ import java.util.Map; import org.aspectj.weaver.CompressingDataOutputStream; import org.aspectj.weaver.ISourceContext; +import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.World; @@ -99,7 +100,7 @@ public class DeclareErrorOrWarning extends Declare { pointcut = pointcut.resolve(scope); } - public Declare parameterizeWith(Map typeVariableBindingMap, World w) { + public Declare parameterizeWith(Map<String,UnresolvedType> typeVariableBindingMap, World w) { Declare ret = new DeclareErrorOrWarning(isError, pointcut.parameterizeWith(typeVariableBindingMap, w), message); ret.copyLocationFrom(this); return ret; diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NameBindingPointcut.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NameBindingPointcut.java index 511ff6859..34b25e207 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NameBindingPointcut.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NameBindingPointcut.java @@ -45,8 +45,8 @@ public abstract class NameBindingPointcut extends Pointcut { return Test.makeInstanceof(var, myType.resolve(world)); } - public abstract List/*<BindingTypePattern>*/ getBindingTypePatterns(); - public abstract List/*<BindingAnnotationTypePattern>*/ getBindingAnnotationTypePatterns(); + public abstract List<BindingTypePattern> getBindingTypePatterns(); + public abstract List<BindingPattern> getBindingAnnotationTypePatterns(); } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotAnnotationTypePattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotAnnotationTypePattern.java index 76acc110a..0317b85a5 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotAnnotationTypePattern.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotAnnotationTypePattern.java @@ -17,6 +17,7 @@ import org.aspectj.weaver.AnnotatedElement; import org.aspectj.weaver.CompressingDataOutputStream; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.ResolvedType; +import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.World; import org.aspectj.weaver.AjAttribute.WeaverVersionInfo; @@ -63,7 +64,7 @@ public class NotAnnotationTypePattern extends AnnotationTypePattern { return this; } - public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) { + public AnnotationTypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { AnnotationTypePattern newNegatedPattern = negatedPattern.parameterizeWith(typeVariableMap, w); NotAnnotationTypePattern ret = new NotAnnotationTypePattern(newNegatedPattern); ret.copyLocationFrom(this); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/OrAnnotationTypePattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/OrAnnotationTypePattern.java index 559b0046a..3cfe1de8b 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/OrAnnotationTypePattern.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/OrAnnotationTypePattern.java @@ -17,6 +17,7 @@ import org.aspectj.weaver.AnnotatedElement; import org.aspectj.weaver.CompressingDataOutputStream; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.ResolvedType; +import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.World; import org.aspectj.weaver.AjAttribute.WeaverVersionInfo; @@ -45,19 +46,13 @@ public class OrAnnotationTypePattern extends AnnotationTypePattern { right.resolve(world); } - /* - * (non-Javadoc) - * - * @see org.aspectj.weaver.patterns.AnnotationTypePattern#resolveBindings(org.aspectj.weaver.patterns.IScope, - * org.aspectj.weaver.patterns.Bindings, boolean) - */ public AnnotationTypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding) { left = left.resolveBindings(scope, bindings, allowBinding); right = right.resolveBindings(scope, bindings, allowBinding); return this; } - public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) { + public AnnotationTypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { AnnotationTypePattern newLeft = left.parameterizeWith(typeVariableMap, w); AnnotationTypePattern newRight = right.parameterizeWith(typeVariableMap, w); OrAnnotationTypePattern ret = new OrAnnotationTypePattern(newLeft, newRight); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerCflow.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerCflow.java index c449eccfa..901c494a6 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerCflow.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerCflow.java @@ -69,7 +69,7 @@ public class PerCflow extends PerClause { entry.resolve(scope); } - public Pointcut parameterizeWith(Map typeVariableMap, World w) { + public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { PerCflow ret = new PerCflow(entry.parameterizeWith(typeVariableMap, w), isBelow); ret.copyLocationFrom(this); return ret; diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerFromSuper.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerFromSuper.java index d513d65f7..9875291f3 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerFromSuper.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerFromSuper.java @@ -21,6 +21,7 @@ import org.aspectj.weaver.CompressingDataOutputStream; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; +import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; import org.aspectj.weaver.World; @@ -74,7 +75,7 @@ public class PerFromSuper extends PerClause { } } - public Pointcut parameterizeWith(Map typeVariableMap, World w) { + public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { return this; } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerObject.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerObject.java index 3a799f78e..237a64a8e 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerObject.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerObject.java @@ -24,6 +24,7 @@ import org.aspectj.weaver.PerObjectInterfaceTypeMunger; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.ResolvedTypeMunger; import org.aspectj.weaver.Shadow; +import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Expr; @@ -87,7 +88,7 @@ public class PerObject extends PerClause { entry.resolve(scope); } - public Pointcut parameterizeWith(Map typeVariableMap, World w) { + public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { PerObject ret = new PerObject(entry.parameterizeWith(typeVariableMap, w), isThis); ret.copyLocationFrom(this); return ret; diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerSingleton.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerSingleton.java index 798b1ba55..f53c3a4a5 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerSingleton.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerSingleton.java @@ -22,6 +22,7 @@ import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; +import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Expr; @@ -55,7 +56,7 @@ public class PerSingleton extends PerClause { // this method intentionally left blank } - public Pointcut parameterizeWith(Map typeVariableMap, World w) { + public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { return this; } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerTypeWithin.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerTypeWithin.java index 0bcc85870..e8b92ac5a 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerTypeWithin.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerTypeWithin.java @@ -28,6 +28,7 @@ import org.aspectj.weaver.PerTypeWithinTargetTypeMunger; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.ResolvedTypeMunger; import org.aspectj.weaver.Shadow; +import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Expr; @@ -58,7 +59,7 @@ public class PerTypeWithin extends PerClause { return kindSet; } - public Pointcut parameterizeWith(Map typeVariableMap, World w) { + public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { PerTypeWithin ret = new PerTypeWithin(typePattern.parameterizeWith(typeVariableMap, w)); ret.copyLocationFrom(this); return ret; diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java index 7656a08e0..dfb509195 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java @@ -89,7 +89,7 @@ public class ThisOrTargetAnnotationPointcut extends NameBindingPointcut { } @Override - public Pointcut parameterizeWith(Map typeVariableMap, World w) { + public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { ExactAnnotationTypePattern newPattern = (ExactAnnotationTypePattern) this.annotationTypePattern.parameterizeWith( typeVariableMap, w); if (newPattern.getAnnotationType() instanceof ResolvedType) { @@ -246,13 +246,13 @@ public class ThisOrTargetAnnotationPointcut extends NameBindingPointcut { * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() */ @Override - public List getBindingAnnotationTypePatterns() { + public List<BindingPattern> getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingAnnotationTypePattern) { - List l = new ArrayList(); - l.add(annotationTypePattern); + List<BindingPattern> l = new ArrayList<BindingPattern>(); + l.add((BindingPattern)annotationTypePattern); return l; } else { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } } @@ -262,8 +262,8 @@ public class ThisOrTargetAnnotationPointcut extends NameBindingPointcut { * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() */ @Override - public List getBindingTypePatterns() { - return Collections.EMPTY_LIST; + public List<BindingTypePattern> getBindingTypePatterns() { + return Collections.emptyList(); } /* diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java index f2e77440b..a278e76c6 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java @@ -34,8 +34,6 @@ import org.aspectj.weaver.ast.Literal; import org.aspectj.weaver.ast.Test; import org.aspectj.weaver.ast.Var; -// - /** * Corresponds to target or this pcd. * @@ -90,7 +88,7 @@ public class ThisOrTargetPointcut extends NameBindingPointcut { } @Override - public Pointcut parameterizeWith(Map typeVariableMap, World w) { + public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { ThisOrTargetPointcut ret = new ThisOrTargetPointcut(isThis, typePattern.parameterizeWith(typeVariableMap, w)); ret.copyLocationFrom(this); return ret; @@ -159,29 +157,19 @@ public class ThisOrTargetPointcut extends NameBindingPointcut { typePattern.postRead(enclosingType); } - /* - * (non-Javadoc) - * - * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() - */ @Override - public List getBindingAnnotationTypePatterns() { - return Collections.EMPTY_LIST; + public List<BindingPattern> getBindingAnnotationTypePatterns() { + return Collections.emptyList(); } - /* - * (non-Javadoc) - * - * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() - */ @Override - public List getBindingTypePatterns() { + public List<BindingTypePattern> getBindingTypePatterns() { if (typePattern instanceof BindingTypePattern) { - List l = new ArrayList(); - l.add(typePattern); + List<BindingTypePattern> l = new ArrayList<BindingTypePattern>(); + l.add((BindingTypePattern)typePattern); return l; } else { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThrowsPattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThrowsPattern.java index d3e0afce2..93557d8c1 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThrowsPattern.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThrowsPattern.java @@ -78,7 +78,7 @@ public class ThrowsPattern extends PatternNode { return this; } - public ThrowsPattern parameterizeWith(Map/* name -> resolved type */typeVariableMap, World w) { + public ThrowsPattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { ThrowsPattern ret = new ThrowsPattern(required.parameterizeWith(typeVariableMap, w), forbidden.parameterizeWith( typeVariableMap, w)); ret.copyLocationFrom(this); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypeCategoryTypePattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypeCategoryTypePattern.java index 3e0934fe8..9f565b20d 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypeCategoryTypePattern.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypeCategoryTypePattern.java @@ -20,6 +20,7 @@ import org.aspectj.util.FuzzyBoolean; import org.aspectj.weaver.CompressingDataOutputStream; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.ResolvedType; +import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.World; @@ -69,7 +70,7 @@ public class TypeCategoryTypePattern extends TypePattern { } @Override - public TypePattern parameterizeWith(Map typeVariableMap, World w) { + public TypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { return this; } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypePatternList.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypePatternList.java index 1551cdb40..da9d6e15a 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypePatternList.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypePatternList.java @@ -58,7 +58,7 @@ public class TypePatternList extends PatternNode { } } - public TypePatternList(List l) { + public TypePatternList(List<TypePattern> l) { this((TypePattern[]) l.toArray(new TypePattern[l.size()])); } @@ -424,7 +424,7 @@ public class TypePatternList extends PatternNode { * @param typeVariableMap * @return */ - public TypePatternList parameterizeWith(Map typeVariableMap, World w) { + public TypePatternList parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { TypePattern[] parameterizedPatterns = new TypePattern[typePatterns.length]; for (int i = 0; i < parameterizedPatterns.length; i++) { parameterizedPatterns[i] = typePatterns[i].parameterizeWith(typeVariableMap, w); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypePatternQuestions.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypePatternQuestions.java index 41aaf4bcf..d4bdf2e58 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypePatternQuestions.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypePatternQuestions.java @@ -22,7 +22,7 @@ import org.aspectj.weaver.ResolvedType; public class TypePatternQuestions { - private Map questionsAndAnswers = new HashMap(); + private Map<Question,FuzzyBoolean> questionsAndAnswers = new HashMap<Question,FuzzyBoolean>(); public FuzzyBoolean askQuestion(TypePattern pattern, ResolvedType type, TypePattern.MatchKind kind) @@ -37,8 +37,8 @@ public class TypePatternQuestions { } public Question anyChanges() { - for (Iterator i = questionsAndAnswers.entrySet().iterator(); i.hasNext(); ) { - Map.Entry entry = (Map.Entry)i.next(); + for (Iterator<Map.Entry<Question,FuzzyBoolean>> i = questionsAndAnswers.entrySet().iterator(); i.hasNext(); ) { + Map.Entry<Question,FuzzyBoolean> entry = i.next(); Question question = (Question)entry.getKey(); FuzzyBoolean expectedAnswer = (FuzzyBoolean)entry.getValue(); @@ -55,8 +55,7 @@ public class TypePatternQuestions { public String toString() { StringBuffer buf = new StringBuffer(); buf.append("TypePatternQuestions{"); - for (Iterator i = questionsAndAnswers.entrySet().iterator(); i.hasNext(); ) { - Map.Entry entry = (Map.Entry)i.next(); + for (Map.Entry<Question,FuzzyBoolean> entry: questionsAndAnswers.entrySet()) { Question question = (Question)entry.getKey(); FuzzyBoolean expectedAnswer = (FuzzyBoolean)entry.getValue(); buf.append(question); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java index 87966f017..42ec11dc2 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java @@ -69,7 +69,7 @@ public class WithinAnnotationPointcut extends NameBindingPointcut { } @Override - public Pointcut parameterizeWith(Map typeVariableMap, World w) { + public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { WithinAnnotationPointcut ret = new WithinAnnotationPointcut(this.annotationTypePattern.parameterizeWith(typeVariableMap, w)); ret.copyLocationFrom(this); return ret; @@ -161,37 +161,22 @@ public class WithinAnnotationPointcut extends NameBindingPointcut { return match(shadow).alwaysTrue() ? Literal.TRUE : Literal.FALSE; } - /* - * (non-Javadoc) - * - * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() - */ @Override - public List getBindingAnnotationTypePatterns() { + public List<BindingPattern> getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingAnnotationTypePattern) { - List l = new ArrayList(); - l.add(annotationTypePattern); + List<BindingPattern> l = new ArrayList<BindingPattern>(); + l.add((BindingPattern)annotationTypePattern); return l; } else { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } } - /* - * (non-Javadoc) - * - * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() - */ @Override - public List getBindingTypePatterns() { - return Collections.EMPTY_LIST; + public List<BindingTypePattern> getBindingTypePatterns() { + return Collections.emptyList(); } - /* - * (non-Javadoc) - * - * @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream) - */ @Override public void write(CompressingDataOutputStream s) throws IOException { s.writeByte(Pointcut.ATWITHIN); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java index 0b574c4d4..408c829f5 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java @@ -77,7 +77,7 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut { return matchedShadowKinds; } - public Pointcut parameterizeWith(Map typeVariableMap, World w) { + public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { WithinCodeAnnotationPointcut ret = new WithinCodeAnnotationPointcut((ExactAnnotationTypePattern) this.annotationTypePattern .parameterizeWith(typeVariableMap, w)); ret.copyLocationFrom(this); @@ -170,35 +170,20 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut { } } - /* - * (non-Javadoc) - * - * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() - */ - public List getBindingAnnotationTypePatterns() { + public List<BindingPattern> getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingAnnotationTypePattern) { - List l = new ArrayList(); - l.add(annotationTypePattern); + List<BindingPattern> l = new ArrayList<BindingPattern>(); + l.add((BindingPattern)annotationTypePattern); return l; } else { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } } - /* - * (non-Javadoc) - * - * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() - */ - public List getBindingTypePatterns() { - return Collections.EMPTY_LIST; + public List<BindingTypePattern> getBindingTypePatterns() { + return Collections.emptyList(); } - /* - * (non-Javadoc) - * - * @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream) - */ public void write(CompressingDataOutputStream s) throws IOException { s.writeByte(Pointcut.ATWITHINCODE); annotationTypePattern.write(s); |