diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ErrorProneRuntimeClasspath.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ErrorProneRuntimeClasspath.java index cafac9cf9ac..205a9396284 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ErrorProneRuntimeClasspath.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ErrorProneRuntimeClasspath.java @@ -116,7 +116,7 @@ private static SuggestedFix suggestClassReference( original, identifier + ".class.getCanonicalName()" - + (suffix.isEmpty() ? "" : " + " + Constants.format(suffix))) + + (suffix.isEmpty() ? "" : (" + " + Constants.format(suffix)))) .build(); } @@ -136,8 +136,8 @@ public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState /* * This class reference may not be safe; suggest using a string literal instead. (Note that - * dropping the type reference may make the associated import statement (if any) obsolete; - * dropping such imports is left to Error Prone's `RemoveUnusedImports` check.) + * dropping the type reference may make the associated import statement (if any) obsolete. + * Dropping such imports is left to Error Prone's `RemoveUnusedImports` check.) */ return buildDescription(tree) .setMessage("This type may not be on the runtime classpath; use a string literal instead") @@ -150,7 +150,9 @@ public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState private static boolean isTypeOnClasspath(String type, VisitorState state) { try { return ThirdPartyLibrary.canIntroduceUsage(type, state); - } catch (IllegalArgumentException e) { + } catch ( + @SuppressWarnings("java:S1166" /* Not exceptional. */) + IllegalArgumentException e) { return false; } }