]> source.dussan.org Git - aspectj.git/commitdiff
Fix some generics warnings, add overrides
authorAndy Clement <aclement@pivotal.io>
Tue, 29 May 2018 15:51:24 +0000 (08:51 -0700)
committerAndy Clement <aclement@pivotal.io>
Tue, 29 May 2018 15:51:24 +0000 (08:51 -0700)
12 files changed:
org.aspectj.matcher/src/org/aspectj/weaver/patterns/AndTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnyAnnotationTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnyTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/BindingAnnotationFieldTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/KindedPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/NoTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/ParserException.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java

index d23404f7fb23779daa2e59e3211387ab6e5c353e..781a5881a3ee4fea0355c5caf9e6d77b43cc78e5 100644 (file)
@@ -19,6 +19,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;
 
@@ -41,33 +42,40 @@ public class AndTypePattern extends TypePattern {
                setLocation(left.getSourceContext(), left.getStart(), right.getEnd());
        }
 
+       @Override
        protected boolean couldEverMatchSameTypesAs(TypePattern other) {
                return true; // don't dive into ands yet....
        }
 
+       @Override
        public FuzzyBoolean matchesInstanceof(ResolvedType type) {
                return left.matchesInstanceof(type).and(right.matchesInstanceof(type));
        }
 
+       @Override
        protected boolean matchesExactly(ResolvedType type) {
                // ??? if these had side-effects, this sort-circuit could be a mistake
                return left.matchesExactly(type) && right.matchesExactly(type);
        }
 
+       @Override
        protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) {
                return left.matchesExactly(type, annotatedType) && right.matchesExactly(type, annotatedType);
        }
 
+       @Override
        public boolean matchesStatically(ResolvedType type) {
                return left.matchesStatically(type) && right.matchesStatically(type);
        }
 
+       @Override
        public void setIsVarArgs(boolean isVarArgs) {
                this.isVarArgs = isVarArgs;
                left.setIsVarArgs(isVarArgs);
                right.setIsVarArgs(isVarArgs);
        }
 
+       @Override
        public void setAnnotationTypePattern(AnnotationTypePattern annPatt) {
                if (annPatt == AnnotationTypePattern.ANY) {
                        return;
@@ -84,6 +92,7 @@ public class AndTypePattern extends TypePattern {
                }
        }
 
+       @Override
        public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(TypePattern.AND);
                left.write(s);
@@ -100,6 +109,7 @@ public class AndTypePattern extends TypePattern {
                return ret;
        }
 
+       @Override
        public TypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType) {
                if (requireExactType) {
                        return notExactType(scope);
@@ -108,8 +118,9 @@ public class AndTypePattern extends TypePattern {
                right = right.resolveBindings(scope, bindings, false, false);
                return this;
        }
-
-       public TypePattern parameterizeWith(Map typeVariableMap, World w) {
+       @Override
+       public TypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
                TypePattern newLeft = left.parameterizeWith(typeVariableMap, w);
                TypePattern newRight = right.parameterizeWith(typeVariableMap, w);
                AndTypePattern ret = new AndTypePattern(newLeft, newRight);
@@ -117,6 +128,7 @@ public class AndTypePattern extends TypePattern {
                return ret;
        }
 
+       @Override
        public String toString() {
                StringBuffer buff = new StringBuffer();
                if (annotationPattern != AnnotationTypePattern.ANY) {
@@ -143,6 +155,7 @@ public class AndTypePattern extends TypePattern {
                return right;
        }
 
+       @Override
        public boolean equals(Object obj) {
                if (!(obj instanceof AndTypePattern)) {
                        return false;
@@ -151,6 +164,7 @@ public class AndTypePattern extends TypePattern {
                return left.equals(atp.left) && right.equals(atp.right);
        }
 
+       @Override
        public boolean isStarAnnotation() {
                return left.isStarAnnotation() && right.isStarAnnotation();
        }
@@ -160,6 +174,7 @@ public class AndTypePattern extends TypePattern {
         * 
         * @see java.lang.Object#hashCode()
         */
+       @Override
        public int hashCode() {
                int ret = 17;
                ret = ret + 37 * left.hashCode();
@@ -167,10 +182,12 @@ public class AndTypePattern extends TypePattern {
                return ret;
        }
 
+       @Override
        public Object accept(PatternNodeVisitor visitor, Object data) {
                return visitor.visit(this, data);
        }
 
+       @Override
        public Object traverse(PatternNodeVisitor visitor, Object data) {
                Object ret = accept(visitor, data);
                left.traverse(visitor, ret);
index 0a197254a65713ffeefb3ebf49033e06957d3d87..e829d37724429d529b136380c58dd1578fac149c 100644 (file)
@@ -82,11 +82,13 @@ public class AnnotationPointcut extends NameBindingPointcut {
                return annotationTypePattern;
        }
 
+       @Override
        public int couldMatchKinds() {
                return Shadow.ALL_SHADOW_KINDS_BITS;
        }
 
-       public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+       @Override
+       public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
                AnnotationPointcut ret = new AnnotationPointcut((ExactAnnotationTypePattern) annotationTypePattern.parameterizeWith(
                                typeVariableMap, w));
                ret.copyLocationFrom(this);
@@ -98,6 +100,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
         * 
         * @see org.aspectj.weaver.patterns.Pointcut#fastMatch(org.aspectj.weaver.patterns.FastMatchInfo)
         */
+       @Override
        public FuzzyBoolean fastMatch(FastMatchInfo info) {
                if (info.getKind() == Shadow.StaticInitialization) {
                        return annotationTypePattern.fastMatches(info.getType());
@@ -111,6 +114,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
         * 
         * @see org.aspectj.weaver.patterns.Pointcut#match(org.aspectj.weaver.Shadow)
         */
+       @Override
        protected FuzzyBoolean matchInternal(Shadow shadow) {
                AnnotatedElement toMatchAgainst = null;
                Member member = shadow.getSignature();
@@ -173,6 +177,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
         * @see org.aspectj.weaver.patterns.Pointcut#resolveBindings(org.aspectj.weaver.patterns.IScope,
         * org.aspectj.weaver.patterns.Bindings)
         */
+       @Override
        protected void resolveBindings(IScope scope, Bindings bindings) {
                if (!scope.getWorld().isInJava5Mode()) {
                        scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.ATANNOTATION_ONLY_SUPPORTED_AT_JAVA5_LEVEL),
@@ -188,6 +193,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
         * 
         * @see org.aspectj.weaver.patterns.Pointcut#concretize1(org.aspectj.weaver.ResolvedType, org.aspectj.weaver.IntMap)
         */
+       @Override
        protected Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
                ExactAnnotationTypePattern newType = (ExactAnnotationTypePattern) annotationTypePattern.remapAdviceFormals(bindings);
                Pointcut ret = new AnnotationPointcut(newType, bindings.getEnclosingAdvice());
@@ -195,6 +201,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
                return ret;
        }
 
+       @Override
        protected Test findResidueInternal(Shadow shadow, ExposedState state) {
                if (annotationTypePattern instanceof BindingAnnotationFieldTypePattern) {
                        if (shadow.getKind() != Shadow.MethodExecution) {
@@ -254,6 +261,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
         * 
         * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns()
         */
+       @Override
        public List<BindingPattern> getBindingAnnotationTypePatterns() {
                if (annotationTypePattern instanceof BindingPattern) { // BindingAnnotationTypePattern) {
                        List<BindingPattern> l = new ArrayList<BindingPattern>();
@@ -269,6 +277,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
         * 
         * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns()
         */
+       @Override
        public List<BindingTypePattern> getBindingTypePatterns() {
                return Collections.emptyList();
        }
@@ -278,6 +287,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
         * 
         * @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream)
         */
+       @Override
        public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.ANNOTATION);
                annotationTypePattern.write(s);
@@ -291,6 +301,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
                return ret;
        }
 
+       @Override
        public boolean equals(Object other) {
                if (!(other instanceof AnnotationPointcut)) {
                        return false;
@@ -299,6 +310,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
                return o.annotationTypePattern.equals(this.annotationTypePattern);
        }
 
+       @Override
        public int hashCode() {
                int result = 17;
                result = 37 * result + annotationTypePattern.hashCode();
@@ -314,10 +326,12 @@ public class AnnotationPointcut extends NameBindingPointcut {
                this.declarationText = buf.toString();
        }
 
+       @Override
        public String toString() {
                return this.declarationText;
        }
 
+       @Override
        public Object accept(PatternNodeVisitor visitor, Object data) {
                return visitor.visit(this, data);
        }
index 8af265b74e6bb2ea263a4f6a60a9026c2e158da7..769424311b70e89f48692de55b0eec51b893cd37 100644 (file)
@@ -18,6 +18,7 @@ import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AnnotatedElement;
 import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
 import org.aspectj.weaver.World;
 
 public class AnyAnnotationTypePattern extends AnnotationTypePattern {
@@ -62,7 +63,7 @@ public class AnyAnnotationTypePattern extends AnnotationTypePattern {
        }
 
        @Override
-       public AnnotationTypePattern parameterizeWith(Map arg0, World w) {
+       public AnnotationTypePattern parameterizeWith(Map<String,UnresolvedType> arg0, World w) {
                return this;
        }
 
index f3685539952e52215a91887b1ec31e4b463af239..db9ba51309e22a6218a3985b42120ec37760737b 100644 (file)
@@ -17,6 +17,7 @@ import java.util.Map;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
 import org.aspectj.weaver.World;
 
 public class AnyTypePattern extends TypePattern {
@@ -106,7 +107,7 @@ public class AnyTypePattern extends TypePattern {
        }
 
        @Override
-       public TypePattern parameterizeWith(Map arg0, World w) {
+       public TypePattern parameterizeWith(Map<String,UnresolvedType> arg0, World w) {
                return this;
        }
 }
\ No newline at end of file
index e7b8ac936212cb2bfb429e54fd1ce2c3e310f4f0..707f1e79eb944bd501ed3c1a3c12fb0de073b1c4 100644 (file)
@@ -65,6 +65,7 @@ public class BindingAnnotationFieldTypePattern extends ExactAnnotationTypePatter
                }
        }
 
+       @Override
        public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) {
                throw new BCException("Parameterization not implemented for annotation field binding construct (compiler limitation)");
                // UnresolvedType newAnnotationType = annotationType;
@@ -86,10 +87,12 @@ public class BindingAnnotationFieldTypePattern extends ExactAnnotationTypePatter
                // return ret;
        }
 
+       @Override
        public int getFormalIndex() {
                return formalIndex;
        }
 
+       @Override
        public boolean equals(Object obj) {
                if (!(obj instanceof BindingAnnotationFieldTypePattern)) {
                        return false;
@@ -99,10 +102,12 @@ public class BindingAnnotationFieldTypePattern extends ExactAnnotationTypePatter
                                && (formalType.equals(btp.formalType));
        }
 
+       @Override
        public int hashCode() {
                return (annotationType.hashCode() * 37 + formalIndex * 37) + formalType.hashCode();
        }
 
+       @Override
        public AnnotationTypePattern remapAdviceFormals(IntMap bindings) {
                if (!bindings.hasKey(formalIndex)) {
                        throw new BCException("Annotation field binding reference must be bound (compiler limitation)");
@@ -117,6 +122,7 @@ public class BindingAnnotationFieldTypePattern extends ExactAnnotationTypePatter
                }
        }
 
+       @Override
        public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(AnnotationTypePattern.BINDINGFIELD2);
                formalType.write(s); // the type of the field within the annotation
@@ -141,6 +147,7 @@ public class BindingAnnotationFieldTypePattern extends ExactAnnotationTypePatter
                return ret;
        }
 
+       @Override
        public FuzzyBoolean matches(AnnotatedElement annotated, ResolvedType[] parameterAnnotations) {
                // Inheritance irrelevant because @annotation(Anno(x)) only supported at method execution join points (compiler limitation)
                // boolean checkSupers = false;
index 772e8f6ca64678e7c327b75cc31f83e2d5ef4030..b51d72df9801d3271068600bcf1657a5a16a9ff9 100644 (file)
@@ -18,6 +18,7 @@ import java.util.Set;
 import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
 import org.aspectj.weaver.AnnotatedElement;
 import org.aspectj.weaver.AnnotationAJ;
 import org.aspectj.weaver.BCException;
@@ -31,7 +32,6 @@ import org.aspectj.weaver.UnresolvedType;
 import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.World;
-import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
 
 /**
  * Matches an annotation of a given type
@@ -321,13 +321,13 @@ public class ExactAnnotationTypePattern extends AnnotationTypePattern {
        }
 
        @Override
-       public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) {
+       public AnnotationTypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
                UnresolvedType newAnnotationType = annotationType;
                if (annotationType.isTypeVariableReference()) {
                        TypeVariableReference t = (TypeVariableReference) annotationType;
                        String key = t.getTypeVariable().getName();
                        if (typeVariableMap.containsKey(key)) {
-                               newAnnotationType = (UnresolvedType) typeVariableMap.get(key);
+                               newAnnotationType = typeVariableMap.get(key);
                        }
                } else if (annotationType.isParameterizedType()) {
                        newAnnotationType = annotationType.parameterize(typeVariableMap);
index 892f01b2488735b7dfc31213095dd9536d164157..968c420e9ad8e7eb04dd00908addebd7b3e366a9 100644 (file)
@@ -457,7 +457,7 @@ public class KindedPointcut extends Pointcut {
        }
 
        @Override
-       public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+       public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
                Pointcut ret = new KindedPointcut(kind, signature.parameterizeWith(typeVariableMap, w), munger);
                ret.copyLocationFrom(this);
                return ret;
index 26dacba0b593e94fcb772529c84b5159429e1f32..e5be0a9694a7b7e4a2d214b03991ce7525a62046 100644 (file)
@@ -17,6 +17,7 @@ import java.util.Map;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
 import org.aspectj.weaver.World;
 
 public class NoTypePattern extends TypePattern {
@@ -111,7 +112,7 @@ public class NoTypePattern extends TypePattern {
        }
 
        @Override
-       public TypePattern parameterizeWith(Map arg0, World w) {
+       public TypePattern parameterizeWith(Map<String,UnresolvedType> arg0, World w) {
                return this;
        }
 }
index 09ce1f6d861347fd220671ee2e0e6422e33b2f40..85d2cdb7abbb5d5c622ca77d5d5526fb78890a94 100644 (file)
@@ -21,6 +21,7 @@ import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 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.Test;
@@ -40,6 +41,7 @@ public class NotPointcut extends Pointcut {
                setLocation(pointcut.getSourceContext(), startPos, pointcut.getEnd());
        }
 
+       @Override
        public int couldMatchKinds() {
                return Shadow.ALL_SHADOW_KINDS_BITS;
        }
@@ -48,19 +50,23 @@ public class NotPointcut extends Pointcut {
                return body;
        }
 
+       @Override
        public FuzzyBoolean fastMatch(FastMatchInfo type) {
                return body.fastMatch(type).not();
        }
 
+       @Override
        protected FuzzyBoolean matchInternal(Shadow shadow) {
                return body.match(shadow).not();
        }
 
+       @Override
        public String toString() {
                return "!" + body.toString();
 
        }
 
+       @Override
        public boolean equals(Object other) {
                if (!(other instanceof NotPointcut)) {
                        return false;
@@ -69,10 +75,12 @@ public class NotPointcut extends Pointcut {
                return o.body.equals(body);
        }
 
+       @Override
        public int hashCode() {
                return 37 * 23 + body.hashCode();
        }
 
+       @Override
        public void resolveBindings(IScope scope, Bindings bindings) {
                // Bindings old = bindings.copy();
 
@@ -85,6 +93,7 @@ public class NotPointcut extends Pointcut {
 
        }
 
+       @Override
        public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.NOT);
                body.write(s);
@@ -97,26 +106,31 @@ public class NotPointcut extends Pointcut {
                return ret;
        }
 
+       @Override
        protected Test findResidueInternal(Shadow shadow, ExposedState state) {
                return Test.makeNot(body.findResidue(shadow, state));
        }
 
+       @Override
        public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
                Pointcut ret = new NotPointcut(body.concretize(inAspect, declaringType, bindings));
                ret.copyLocationFrom(this);
                return ret;
        }
 
-       public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+       @Override
+       public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
                Pointcut ret = new NotPointcut(body.parameterizeWith(typeVariableMap, w));
                ret.copyLocationFrom(this);
                return ret;
        }
 
+       @Override
        public Object accept(PatternNodeVisitor visitor, Object data) {
                return visitor.visit(this, data);
        }
 
+       @Override
        public Object traverse(PatternNodeVisitor visitor, Object data) {
                Object ret = accept(visitor, data);
                this.body.traverse(visitor, ret);
index cea4b84d459432715d70bf740c38bae7138511f1..0f8f82c217e172948e32dd5a5bf3986539fd8d81 100644 (file)
@@ -20,6 +20,7 @@ import org.aspectj.weaver.AjAttribute;
 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;
 
@@ -118,7 +119,7 @@ public class NotTypePattern extends TypePattern {
        }
 
        @Override
-       public TypePattern parameterizeWith(Map typeVariableMap, World w) {
+       public TypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
                TypePattern newNegatedPattern = negatedPattern.parameterizeWith(typeVariableMap, w);
                NotTypePattern ret = new NotTypePattern(newNegatedPattern);
                ret.copyLocationFrom(this);
index cce9287405e923b7c6bf979c40f471fedb6854ad..036061f1515aac46053ac8764cb6cdb2870e8870 100644 (file)
@@ -9,13 +9,10 @@
  * Contributors: 
  *     PARC     initial implementation 
  * ******************************************************************/
-
-
 package org.aspectj.weaver.patterns;
 
 import org.aspectj.weaver.IHasPosition;
 
-
 public class ParserException extends RuntimeException {
        private IHasPosition token;
        
index 10cce6207affd68d06b49ec3035a5c21f48297c1..0941462d18ac2071e44e868e31778fd2a5e125ef 100644 (file)
@@ -346,7 +346,7 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern {
        }
 
        @Override
-       public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) {
+       public AnnotationTypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
                WildAnnotationTypePattern ret = new WildAnnotationTypePattern(typePattern.parameterizeWith(typeVariableMap, w));
                ret.copyLocationFrom(this);
                ret.resolved = resolved;