]> source.dussan.org Git - aspectj.git/commitdiff
Cleanup redundant null check before instanceof
authorAndrey Turbanov <turbanoff@gmail.com>
Sun, 17 Apr 2022 13:07:57 +0000 (16:07 +0300)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Sun, 17 Apr 2022 15:03:57 +0000 (22:03 +0700)
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/InterimCompilationResult.java
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/ProceedVisitor.java
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/ThisJoinPointVisitor.java
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java
weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java

index ceb1231db994626fde6b8468fda832d1b56760a4..c147cdafc0a9eb712f16e5c24df0a7fdc8f22ae4 100644 (file)
@@ -56,7 +56,7 @@ public class InterimCompilationResult {
        }
 
        public boolean equals(Object other) {
-               if (other == null || !(other instanceof InterimCompilationResult)) {
+               if (!(other instanceof InterimCompilationResult)) {
                        return false;
                }
                InterimCompilationResult ir = (InterimCompilationResult) other;
index d90feb7733e6fc7b55869593307391ef14e23e42..1ed6f009efc8a138c2010b928cca467af211d73e 100644 (file)
@@ -83,9 +83,8 @@ public class ProceedVisitor extends ASTVisitor {
 
        boolean isRef(Expression expr, Binding binding) {
                //System.err.println("isRef: " + expr + ", " + binding);
-               return expr != null
-                       && expr instanceof NameReference
-                       && isRef((NameReference) expr, binding);
+               return expr instanceof NameReference
+                               && isRef((NameReference)expr, binding);
        }
 
        public void endVisit(SingleNameReference ref, BlockScope scope) {
index b1189d9dccd1662945664f79c2e3591513eb61cc..44e929cc7cf33989ac1e22b50e7e7f0ac6742ee9 100644 (file)
@@ -102,7 +102,7 @@ public class ThisJoinPointVisitor extends ASTVisitor {
        }
 
        boolean isRef(Expression expr, Binding binding) {
-               return expr != null && expr instanceof NameReference && isRef((NameReference) expr, binding);
+               return expr instanceof NameReference && isRef((NameReference)expr, binding);
        }
 
        public void endVisit(SingleNameReference ref, BlockScope scope) {
index 9604bab9be6855905fce355db1e82f77f5c1033c..59bea43e52c9d1142efb137ae647d80a34b9aeb0 100644 (file)
@@ -485,7 +485,7 @@ public class AjProblemReporter extends ProblemReporter {
                // don't output unused type warnings for aspects!
                if (typeDecl instanceof AspectDeclaration)
                        return;
-               if (typeDecl.enclosingType != null && (typeDecl.enclosingType instanceof AspectDeclaration)) {
+               if (typeDecl.enclosingType instanceof AspectDeclaration) {
                        AspectDeclaration ad = (AspectDeclaration) typeDecl.enclosingType;
                        if (ad.concreteName != null) {
                                List<Declare> declares = ad.concreteName.declares;
@@ -609,7 +609,7 @@ public class AjProblemReporter extends ProblemReporter {
                        Argument arg = (Argument) localDecl;
                        if (arg.binding != null && arg.binding.declaringScope != null) {
                                ReferenceContext context = arg.binding.declaringScope.referenceContext();
-                               if (context != null && context instanceof PointcutDeclaration)
+                               if (context instanceof PointcutDeclaration)
                                        return;
                        }
                }
index 3e526002e0b47c14976c1eec16fa4f82183f155b..0fa1d6258de9b6cfab579d7c674d8d3a6396a6de 100644 (file)
@@ -115,7 +115,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags {
 
                @Override
                public boolean equals(Object obj) {
-                       if (obj != null && (obj instanceof BinarySourceFile)) {
+                       if (obj instanceof BinarySourceFile) {
                                BinarySourceFile other = (BinarySourceFile) obj;
                                return (binSrc.equals(other.binSrc));
                        }
index 17472ee6b66d43916ba03c913b03a1ae7b5fbc20..d6acdefd981922d19a58df2453023093d5832958 100644 (file)
@@ -188,7 +188,7 @@ public class CrosscuttingMembers {
                String signatureToLookFor = typeToExpose.getSignature();
                for (ConcreteTypeMunger cTM : typeMungers) {
                        ResolvedTypeMunger rTM = cTM.getMunger();
-                       if (rTM != null && rTM instanceof ExposeTypeMunger) {
+                       if (rTM instanceof ExposeTypeMunger) {
                                String exposedType = ((ExposeTypeMunger) rTM).getExposedTypeSignature();
                                if (exposedType.equals(signatureToLookFor)) {
                                        return; // dont need to bother
index 507717721886e40caeb3488f2a4388f5cf29a3b8..822539074902518ca310703912d6cf8e56bb1db1 100644 (file)
@@ -27,7 +27,7 @@ public class PerObjectInterfaceTypeMunger extends ResolvedTypeMunger {
        private TypePattern lazyTestTypePattern;
 
        public boolean equals(Object other) {
-               if (other == null || !(other instanceof PerObjectInterfaceTypeMunger)) {
+               if (!(other instanceof PerObjectInterfaceTypeMunger)) {
                        return false;
                }
                PerObjectInterfaceTypeMunger o = (PerObjectInterfaceTypeMunger) other;
index 5f0e5477235108db7a127339d590e0969d4d869f..60de7238599ac157b4387f76550d21a64f52c693 100644 (file)
@@ -55,7 +55,7 @@ public class DefaultCacheKeyResolver implements CacheKeyResolver {
                StringBuilder hashable = new StringBuilder(256);
 
                // Add the list of loader urls to the hash list
-               if (cl != null && cl instanceof URLClassLoader) {
+               if (cl instanceof URLClassLoader) {
                        URL[] urls = ((URLClassLoader) cl).getURLs();
                        for (URL url : urls) {
                                hashableStrings.add(url.toString());