Browse Source

Cleanup redundant null check before instanceof

tags/V1_9_19
Andrey Turbanov 2 years ago
parent
commit
816f585d54

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/InterimCompilationResult.java View File

} }


public boolean equals(Object other) { public boolean equals(Object other) {
if (other == null || !(other instanceof InterimCompilationResult)) {
if (!(other instanceof InterimCompilationResult)) {
return false; return false;
} }
InterimCompilationResult ir = (InterimCompilationResult) other; InterimCompilationResult ir = (InterimCompilationResult) other;

+ 2
- 3
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/ProceedVisitor.java View File



boolean isRef(Expression expr, Binding binding) { boolean isRef(Expression expr, Binding binding) {
//System.err.println("isRef: " + expr + ", " + 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) { public void endVisit(SingleNameReference ref, BlockScope scope) {

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/ThisJoinPointVisitor.java View File

} }


boolean isRef(Expression expr, Binding binding) { 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) { public void endVisit(SingleNameReference ref, BlockScope scope) {

+ 2
- 2
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java View File

// don't output unused type warnings for aspects! // don't output unused type warnings for aspects!
if (typeDecl instanceof AspectDeclaration) if (typeDecl instanceof AspectDeclaration)
return; return;
if (typeDecl.enclosingType != null && (typeDecl.enclosingType instanceof AspectDeclaration)) {
if (typeDecl.enclosingType instanceof AspectDeclaration) {
AspectDeclaration ad = (AspectDeclaration) typeDecl.enclosingType; AspectDeclaration ad = (AspectDeclaration) typeDecl.enclosingType;
if (ad.concreteName != null) { if (ad.concreteName != null) {
List<Declare> declares = ad.concreteName.declares; List<Declare> declares = ad.concreteName.declares;
Argument arg = (Argument) localDecl; Argument arg = (Argument) localDecl;
if (arg.binding != null && arg.binding.declaringScope != null) { if (arg.binding != null && arg.binding.declaringScope != null) {
ReferenceContext context = arg.binding.declaringScope.referenceContext(); ReferenceContext context = arg.binding.declaringScope.referenceContext();
if (context != null && context instanceof PointcutDeclaration)
if (context instanceof PointcutDeclaration)
return; return;
} }
} }

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java View File



@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj != null && (obj instanceof BinarySourceFile)) {
if (obj instanceof BinarySourceFile) {
BinarySourceFile other = (BinarySourceFile) obj; BinarySourceFile other = (BinarySourceFile) obj;
return (binSrc.equals(other.binSrc)); return (binSrc.equals(other.binSrc));
} }

+ 1
- 1
org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java View File

String signatureToLookFor = typeToExpose.getSignature(); String signatureToLookFor = typeToExpose.getSignature();
for (ConcreteTypeMunger cTM : typeMungers) { for (ConcreteTypeMunger cTM : typeMungers) {
ResolvedTypeMunger rTM = cTM.getMunger(); ResolvedTypeMunger rTM = cTM.getMunger();
if (rTM != null && rTM instanceof ExposeTypeMunger) {
if (rTM instanceof ExposeTypeMunger) {
String exposedType = ((ExposeTypeMunger) rTM).getExposedTypeSignature(); String exposedType = ((ExposeTypeMunger) rTM).getExposedTypeSignature();
if (exposedType.equals(signatureToLookFor)) { if (exposedType.equals(signatureToLookFor)) {
return; // dont need to bother return; // dont need to bother

+ 1
- 1
org.aspectj.matcher/src/main/java/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java View File

private TypePattern lazyTestTypePattern; private TypePattern lazyTestTypePattern;


public boolean equals(Object other) { public boolean equals(Object other) {
if (other == null || !(other instanceof PerObjectInterfaceTypeMunger)) {
if (!(other instanceof PerObjectInterfaceTypeMunger)) {
return false; return false;
} }
PerObjectInterfaceTypeMunger o = (PerObjectInterfaceTypeMunger) other; PerObjectInterfaceTypeMunger o = (PerObjectInterfaceTypeMunger) other;

+ 1
- 1
weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java View File

StringBuilder hashable = new StringBuilder(256); StringBuilder hashable = new StringBuilder(256);


// Add the list of loader urls to the hash list // 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(); URL[] urls = ((URLClassLoader) cl).getURLs();
for (URL url : urls) { for (URL url : urls) {
hashableStrings.add(url.toString()); hashableStrings.add(url.toString());

Loading…
Cancel
Save