Skip to content

Commit

Permalink
Return early when searching for a method without parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenc committed May 24, 2019
1 parent 0f16140 commit 67c73e2
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -203,7 +203,13 @@ public SymbolReference<ResolvedMethodDeclaration> solveMethod(String name, List<
boolean isSynthetic = method.getMethodInfo().getAttribute(SyntheticAttribute.tag) != null;
boolean isNotBridge = (method.getMethodInfo().getAccessFlags() & AccessFlag.BRIDGE) == 0;
if (method.getName().equals(name) && !isSynthetic && isNotBridge && staticOnlyCheck.test(method)) {
candidates.add(new JavassistMethodDeclaration(method, typeSolver));
ResolvedMethodDeclaration candidate = new JavassistMethodDeclaration(method, typeSolver);
candidates.add(candidate);

// no need to search for overloaded/inherited methods if the method has no parameters
if (argumentsTypes.isEmpty() && candidate.getNumberOfParams() == 0) {
return SymbolReference.solved(candidate);
}
}
}

Expand Down

0 comments on commit 67c73e2

Please sign in to comment.