diff options
author | Andrey Turbanov <turbanoff@gmail.com> | 2022-04-12 11:22:29 +0300 |
---|---|---|
committer | Andrey Turbanov <turbanoff@gmail.com> | 2022-04-12 11:22:29 +0300 |
commit | 1c487b2e0f54eeb4c2630940e7d57c279ba5a032 (patch) | |
tree | 0c0d84e75783441de07f4193e003429e64b11550 /org.aspectj.matcher | |
parent | caa2c39be10775a8772a27eea8b9a673dd0bab8d (diff) | |
download | aspectj-1c487b2e0f54eeb4c2630940e7d57c279ba5a032.tar.gz aspectj-1c487b2e0f54eeb4c2630940e7d57c279ba5a032.zip |
Remove redundant casts after generics update
Diffstat (limited to 'org.aspectj.matcher')
16 files changed, 33 insertions, 38 deletions
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java index d2a5f0492..2bdf10262 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java @@ -231,10 +231,8 @@ public class Lint { setFromProperties(p); } - @SuppressWarnings("rawtypes") public void setFromProperties(Properties properties) { - for (Map.Entry<Object, Object> objectObjectEntry : properties.entrySet()) { - Map.Entry entry = (Map.Entry) objectObjectEntry; + for (Map.Entry<Object, Object> entry : properties.entrySet()) { Kind kind = kinds.get(entry.getKey()); if (kind == null) { MessageUtil.error(world.getMessageHandler(), WeaverMessages.format(WeaverMessages.XLINT_KEY_ERROR, entry.getKey())); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java index 022d8242f..d52f96b2d 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java @@ -1034,7 +1034,7 @@ public class ReferenceType extends ResolvedType { // If we are raw, we have a generic type - we should ensure it uses the // same delegate if (isRawType() && getGenericType() != null) { - ReferenceType genType = (ReferenceType) getGenericType(); + ReferenceType genType = getGenericType(); if (genType.getDelegate() != delegate) { // avoids circular updates genType.setDelegate(delegate); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/WeakClassLoaderReference.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/WeakClassLoaderReference.java index 8bbfd3f42..9d81873a7 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/WeakClassLoaderReference.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/WeakClassLoaderReference.java @@ -50,7 +50,7 @@ public class WeakClassLoaderReference{ } public ClassLoader getClassLoader() { - ClassLoader instance = (ClassLoader) loaderRef.get(); + ClassLoader instance = loaderRef.get(); // Assert instance!=null return instance; } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPatternList.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPatternList.java index ede14efca..135fa8e01 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPatternList.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPatternList.java @@ -50,7 +50,7 @@ public class AnnotationPatternList extends PatternNode { } public AnnotationPatternList(List<AnnotationTypePattern> l) { - this((AnnotationTypePattern[]) l.toArray(AnnotationTypePattern.NONE)); + this(l.toArray(AnnotationTypePattern.NONE)); } protected AnnotationTypePattern[] getAnnotationPatterns() { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/BasicTokenSource.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/BasicTokenSource.java index 70b9c398c..9a1b3c803 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/BasicTokenSource.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/BasicTokenSource.java @@ -160,7 +160,7 @@ public class BasicTokenSource implements ITokenSource { //System.out.println(tokens); - return new BasicTokenSource((IToken[])tokens.toArray(new IToken[0]), context); + return new BasicTokenSource(tokens.toArray(new IToken[0]), context); } private static String makeString(char ch) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/Bindings.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/Bindings.java index 72d438210..0de1c1056 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/Bindings.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/Bindings.java @@ -109,10 +109,7 @@ public class Bindings { } public Bindings copy() { - // int len = bindings.length; - // boolean[] a = new boolean[len]; - // System.arraycopy(bindings, 0, a, 0, len); - return new Bindings((BindingPattern[]) bindings.clone()); + return new Bindings(bindings.clone()); } public void checkAllBound(IScope scope) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java index 79af11d7e..9c349fac8 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java @@ -83,7 +83,7 @@ public class ConcreteCflowPointcut extends Pointcut { } int[] indices = new int[slots.size()]; for (int i = 0; i < indices.length; i++) { - indices[i] = ((Slot) slots.get(i)).formalIndex; + indices[i] = slots.get(i).formalIndex; } return indices; } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/HasMemberTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/HasMemberTypePattern.java index 36adca253..84730b900 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/HasMemberTypePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/HasMemberTypePattern.java @@ -62,7 +62,7 @@ public class HasMemberTypePattern extends TypePattern { // TODO what about ITDs World world = type.getWorld(); for (Iterator<ResolvedMember> iter = type.getFields(); iter.hasNext();) { - Member field = (Member) iter.next(); + Member field = iter.next(); if (field.getName().startsWith(declareAtPrefix)) { continue; } @@ -82,7 +82,7 @@ public class HasMemberTypePattern extends TypePattern { // TODO what about ITDs World world = type.getWorld(); for (Iterator<ResolvedMember> iter = type.getMethods(true, true); iter.hasNext();) { - Member method = (Member) iter.next(); + Member method = iter.next(); if (method.getName().startsWith(declareAtPrefix)) { continue; } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java index 3b4295996..e2a9b2192 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java @@ -90,7 +90,7 @@ public class IfPointcut extends Pointcut { if ((extraParameterFlags & Advice.ConstantValue) != 0) { return FuzzyBoolean.YES; } else { - return FuzzyBoolean.NO; + return FuzzyBoolean.NO; } } } @@ -274,10 +274,10 @@ public class IfPointcut extends Pointcut { args.add(shadow.getThisEnclosingJoinPointStaticPartVar()); } else { - if (state.size() == 0 || currentStateIndex > state.size()) { // if 'we have nothing else to bind from in the state object' + if (state.size() == 0 || currentStateIndex > state.size()) { // if 'we have nothing else to bind from in the state object' String[] paramNames = testMethod.getParameterNames(); StringBuilder errorParameter = new StringBuilder(); - + // Support a single special situation: where the if() pointcut takes a parameter bound elsewhere // in the pointcut but the advice does not bind it. For example: // @@ -299,7 +299,7 @@ public class IfPointcut extends Pointcut { continue; } } - + if (paramNames != null) { errorParameter.append(testMethod.getParameterTypes()[i].getName()).append(" "); errorParameter.append(paramNames[i]); @@ -334,7 +334,7 @@ public class IfPointcut extends Pointcut { } } - ret = Test.makeAnd(ret, Test.makeCall(testMethod, (Expr[]) args.toArray(Expr.NONE))); + ret = Test.makeAnd(ret, Test.makeCall(testMethod, args.toArray(Expr.NONE))); // Remember... ifLastMatchedShadowId = shadow.shadowId; @@ -381,7 +381,7 @@ public class IfPointcut extends Pointcut { if (def != null) { ResolvedType aspect = inAspect.getWorld().resolve(def.getDeclaringType()); for (Iterator<ResolvedMember> memberIter = aspect.getMethods(true, true); memberIter.hasNext();) { - ResolvedMember method = (ResolvedMember) memberIter.next(); + ResolvedMember method = memberIter.next(); if (def.getName().equals(method.getName()) && def.getParameterTypes().length == method.getParameterTypes().length) { boolean sameSig = true; diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NameBindingPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NameBindingPointcut.java index 0254dfee2..11e2d1536 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NameBindingPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NameBindingPointcut.java @@ -40,7 +40,7 @@ public abstract class NameBindingPointcut extends Pointcut { ResolvedType myType = type.getExactType().resolve(world); if (myType.isParameterizedType()) { // unchecked warning already issued... - myType = (ResolvedType) myType.getRawType(); + myType = myType.getRawType(); } return Test.makeInstanceof(var, myType.resolve(world)); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePattern.java index 582c81f75..8deea5abf 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePattern.java @@ -199,7 +199,7 @@ public abstract class TypePattern extends PatternNode { } // FuzzyBoolean ret = FuzzyBoolean.NO; // ??? -eh for (Iterator<ResolvedType> i = superType.getDirectSupertypes(); i.hasNext();) { - ResolvedType superSuperType = (ResolvedType) i.next(); + ResolvedType superSuperType = i.next(); if (matchesSubtypes(superSuperType, annotatedType)) { return true; } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java index 4d9a28e2d..2ac2583c6 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java @@ -59,7 +59,7 @@ public class TypePatternList extends PatternNode { } public TypePatternList(List<TypePattern> l) { - this((TypePattern[]) l.toArray(new TypePattern[0])); + this(l.toArray(new TypePattern[0])); } public int size() { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java index da227d6ec..24c328999 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java @@ -37,8 +37,8 @@ public class TypePatternQuestions { public Question anyChanges() { for (Map.Entry<Question, FuzzyBoolean> entry : questionsAndAnswers.entrySet()) { - Question question = (Question) entry.getKey(); - FuzzyBoolean expectedAnswer = (FuzzyBoolean) entry.getValue(); + Question question = entry.getKey(); + FuzzyBoolean expectedAnswer = entry.getValue(); FuzzyBoolean currentAnswer = question.ask(); //System.out.println(question + ":" + currentAnswer); @@ -54,8 +54,8 @@ public class TypePatternQuestions { StringBuilder buf = new StringBuilder(); buf.append("TypePatternQuestions{"); for (Map.Entry<Question,FuzzyBoolean> entry: questionsAndAnswers.entrySet()) { - Question question = (Question)entry.getKey(); - FuzzyBoolean expectedAnswer = (FuzzyBoolean)entry.getValue(); + Question question = entry.getKey(); + FuzzyBoolean expectedAnswer = entry.getValue(); buf.append(question); buf.append(":"); buf.append(expectedAnswer); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java index 671989cd0..32cc0c6c1 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java @@ -110,7 +110,7 @@ public class WildTypePattern extends TypePattern { } public WildTypePattern(List<NamePattern> names, boolean includeSubtypes, int dim) { - this((NamePattern[]) names.toArray(new NamePattern[0]), includeSubtypes, dim, false, TypePatternList.EMPTY); + this(names.toArray(new NamePattern[0]), includeSubtypes, dim, false, TypePatternList.EMPTY); } @@ -127,7 +127,7 @@ public class WildTypePattern extends TypePattern { public WildTypePattern(List<NamePattern> names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg, TypePatternList typeParams, TypePattern upperBound, TypePattern[] additionalInterfaceBounds, TypePattern lowerBound) { - this((NamePattern[]) names.toArray(new NamePattern[0]), includeSubtypes, dim, isVarArg, typeParams); + this(names.toArray(new NamePattern[0]), includeSubtypes, dim, isVarArg, typeParams); this.end = endPos; this.upperBound = upperBound; this.lowerBound = lowerBound; @@ -135,7 +135,7 @@ public class WildTypePattern extends TypePattern { } public WildTypePattern(List<NamePattern> names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg, TypePatternList typeParams) { - this((NamePattern[]) names.toArray(new NamePattern[0]), includeSubtypes, dim, isVarArg, typeParams); + this(names.toArray(new NamePattern[0]), includeSubtypes, dim, isVarArg, typeParams); this.end = endPos; } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionShadow.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionShadow.java index 55e8a957b..0e5dc34fd 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionShadow.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionShadow.java @@ -256,7 +256,7 @@ public class ReflectionShadow extends Shadow { Var v = ReflectionVar.createAtAnnotationVar(annType, this.annotationFinder); annotationVar.put(annType, v); } - return (Var) annotationVar.get(annType); + return annotationVar.get(annType); } /* @@ -270,7 +270,7 @@ public class ReflectionShadow extends Shadow { Var v = ReflectionVar.createWithinAnnotationVar(annType, this.annotationFinder); withinAnnotationVar.put(annType, v); } - return (Var) withinAnnotationVar.get(annType); + return withinAnnotationVar.get(annType); } /* @@ -284,7 +284,7 @@ public class ReflectionShadow extends Shadow { Var v = ReflectionVar.createWithinCodeAnnotationVar(annType, this.annotationFinder); withinCodeAnnotationVar.put(annType, v); } - return (Var) withinCodeAnnotationVar.get(annType); + return withinCodeAnnotationVar.get(annType); } /* @@ -322,7 +322,7 @@ public class ReflectionShadow extends Shadow { Var[] vars = new Var[getArgCount()]; atArgsVars.put(annType, vars); } - Var[] vars = (Var[]) atArgsVars.get(annType); + Var[] vars = atArgsVars.get(annType); if (i > (vars.length - 1)) return null; if (vars[i] == null) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/StandardShadow.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/StandardShadow.java index 3bb113b08..d14f712cf 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/StandardShadow.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/StandardShadow.java @@ -291,7 +291,7 @@ public class StandardShadow extends Shadow { Var v = ReflectionVar.createAtAnnotationVar(annType, this.annotationFinder); annotationVar.put(annType, v); } - return (Var) annotationVar.get(annType); + return annotationVar.get(annType); } /* @@ -305,7 +305,7 @@ public class StandardShadow extends Shadow { Var v = ReflectionVar.createWithinAnnotationVar(annType, this.annotationFinder); withinAnnotationVar.put(annType, v); } - return (Var) withinAnnotationVar.get(annType); + return withinAnnotationVar.get(annType); } /* @@ -319,7 +319,7 @@ public class StandardShadow extends Shadow { Var v = ReflectionVar.createWithinCodeAnnotationVar(annType, this.annotationFinder); withinCodeAnnotationVar.put(annType, v); } - return (Var) withinCodeAnnotationVar.get(annType); + return withinCodeAnnotationVar.get(annType); } /* @@ -357,7 +357,7 @@ public class StandardShadow extends Shadow { Var[] vars = new Var[getArgCount()]; atArgsVars.put(annType, vars); } - Var[] vars = (Var[]) atArgsVars.get(annType); + Var[] vars = atArgsVars.get(annType); if (i > (vars.length - 1)) return null; if (vars[i] == null) { |