Skip to content

Commit

Permalink
fix(spoon): NPE in InvocationMatcher (#830)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinWitt authored Jul 13, 2023
1 parent 4f793d1 commit b333709
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ public boolean matches(CtInvocation<?> element) {
if (element.getArguments().size() != argsFQN.length) {
return false;
}

if (element.getArguments().stream().anyMatch(arg -> arg.getType() == null)) {
return false;
}
List<Pair<CtTypeReference<?>, CtExpression<?>>> zipped = new ArrayList<>();
for (int i = 0; i < argsFQN.length && i < element.getArguments().size(); i++) {
zipped.add(Pair.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ public class SpoonAnalyzer {

public SpoonAnalyzer() {
this.localAnalyzers = new ArrayList<>();
localAnalyzers.add(new IndexOfReplaceableByContainsAnalyzer());
localAnalyzers.add(new AccessStaticViaInstanceAnalyzer());
localAnalyzers.add(new ArrayCanBeReplacedWithEnumValuesAnalyzer());
localAnalyzers.add(new CharsetObjectCanBeUsedAnalyzer());
localAnalyzers.add(new IndexOfReplaceableByContainsAnalyzer());
localAnalyzers.add(new InnerClassMayBeStaticAnalyzer());
localAnalyzers.add(new UnnecessaryImplementsAnalyzer());
localAnalyzers.add(new UnnecessaryTostringAnalyzer());
localAnalyzers.add(new NonProtectedConstructorInAbstractClassAnalyzer());
localAnalyzers.add(new PrivateFinalMethodAnalyzer());
localAnalyzers.add(new SizeReplaceableByIsEmptyAnalyzer());
localAnalyzers.add(new UnnecessaryImplementsAnalyzer());
localAnalyzers.add(new UnnecessaryTostringAnalyzer());
}

public List<BadSmell> analyze(String path) {
Expand Down

0 comments on commit b333709

Please sign in to comment.