Skip to content

Commit cb1fac8

Browse files
cushonError Prone Team
authored and
Error Prone Team
committed
Fix a crash on a test-only redefinition of ThreadPoolExecutor that doesn't have any parameters
PiperOrigin-RevId: 464805116
1 parent 9449d38 commit cb1fac8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/src/main/java/com/google/errorprone/bugpatterns/ErroneousThreadPoolConstructorChecker.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ public Description matchNewClass(NewClassTree tree, VisitorState state) {
6464
return Description.NO_MATCH;
6565
}
6666
List<? extends ExpressionTree> arguments = tree.getArguments();
67+
if (arguments.size() < 2) {
68+
return Description.NO_MATCH;
69+
}
6770
Integer corePoolSize = ASTHelpers.constValue(arguments.get(0), Integer.class);
6871
Integer maximumPoolSize = ASTHelpers.constValue(arguments.get(1), Integer.class);
6972
if (corePoolSize == null || maximumPoolSize == null || corePoolSize.equals(maximumPoolSize)) {

0 commit comments

Comments
 (0)