diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsage.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsage.java index 10675b4c150..9f4811716b2 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsage.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsage.java @@ -89,11 +89,11 @@ private static Optional constructMethodRef( LambdaExpressionTree lambdaExpr, Tree subTree) { return switch (subTree.getKind()) { case BLOCK -> constructMethodRef(lambdaExpr, (BlockTree) subTree); - case EXPRESSION_STATEMENT -> constructMethodRef( - lambdaExpr, ((ExpressionStatementTree) subTree).getExpression()); + case EXPRESSION_STATEMENT -> + constructMethodRef(lambdaExpr, ((ExpressionStatementTree) subTree).getExpression()); case METHOD_INVOCATION -> constructMethodRef(lambdaExpr, (MethodInvocationTree) subTree); - case PARENTHESIZED -> constructMethodRef( - lambdaExpr, ((ParenthesizedTree) subTree).getExpression()); + case PARENTHESIZED -> + constructMethodRef(lambdaExpr, ((ParenthesizedTree) subTree).getExpression()); case RETURN -> constructMethodRef(lambdaExpr, ((ReturnTree) subTree).getExpression()); default -> Optional.empty(); }; diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MockitoMockClassReference.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MockitoMockClassReference.java index 1be499307bb..58011740064 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MockitoMockClassReference.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MockitoMockClassReference.java @@ -71,12 +71,14 @@ public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState private static boolean isTypeDerivableFromContext(MethodInvocationTree tree, VisitorState state) { Tree parent = state.getPath().getParentPath().getLeaf(); return switch (parent.getKind()) { - case VARIABLE -> !ASTHelpers.hasImplicitType((VariableTree) parent, state) - && MoreASTHelpers.areSameType(tree, parent, state); + case VARIABLE -> + !ASTHelpers.hasImplicitType((VariableTree) parent, state) + && MoreASTHelpers.areSameType(tree, parent, state); case ASSIGNMENT -> MoreASTHelpers.areSameType(tree, parent, state); - case RETURN -> MoreASTHelpers.findMethodExitedOnReturn(state) - .filter(m -> MoreASTHelpers.areSameType(tree, m.getReturnType(), state)) - .isPresent(); + case RETURN -> + MoreASTHelpers.findMethodExitedOnReturn(state) + .filter(m -> MoreASTHelpers.areSameType(tree, m.getReturnType(), state)) + .isPresent(); default -> false; }; } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RedundantStringConversion.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RedundantStringConversion.java index 62eae24621b..eaa7444cb0e 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RedundantStringConversion.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RedundantStringConversion.java @@ -342,9 +342,10 @@ private Optional trySimplify(ExpressionTree tree, VisitorState s return switch (methodInvocation.getArguments().size()) { case 0 -> trySimplifyNullaryMethod(methodInvocation, state); case 1 -> trySimplifyUnaryMethod(methodInvocation, state); - default -> throw new IllegalStateException( - "Cannot simplify method call with two or more arguments: " - + SourceCode.treeToString(tree, state)); + default -> + throw new IllegalStateException( + "Cannot simplify method call with two or more arguments: " + + SourceCode.treeToString(tree, state)); }; } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/UnqualifiedSuggestedFixImport.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/UnqualifiedSuggestedFixImport.java index e7d465ac940..5b20dccb275 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/UnqualifiedSuggestedFixImport.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/UnqualifiedSuggestedFixImport.java @@ -46,10 +46,11 @@ public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState } return switch (ASTHelpers.getSymbol(tree).getSimpleName().toString()) { - case "addImport" -> createDescription( - tree, "SuggestedFix.Builder#addImport", "SuggestedFixes#qualifyType"); - case "addStaticImport" -> createDescription( - tree, "SuggestedFix.Builder#addStaticImport", "SuggestedFixes#qualifyStaticImport"); + case "addImport" -> + createDescription(tree, "SuggestedFix.Builder#addImport", "SuggestedFixes#qualifyType"); + case "addStaticImport" -> + createDescription( + tree, "SuggestedFix.Builder#addStaticImport", "SuggestedFixes#qualifyStaticImport"); default -> Description.NO_MATCH; }; } diff --git a/refaster-runner/src/main/java/tech/picnic/errorprone/refaster/runner/Refaster.java b/refaster-runner/src/main/java/tech/picnic/errorprone/refaster/runner/Refaster.java index ed2cdcce152..274b9b57100 100644 --- a/refaster-runner/src/main/java/tech/picnic/errorprone/refaster/runner/Refaster.java +++ b/refaster-runner/src/main/java/tech/picnic/errorprone/refaster/runner/Refaster.java @@ -140,8 +140,8 @@ private static Optional toSeverityLevel(Severity severity) { case DEFAULT -> Optional.empty(); case WARN -> Optional.of(WARNING); case ERROR -> Optional.of(ERROR); - default -> throw new IllegalStateException( - String.format("Unsupported severity='%s'", severity)); + default -> + throw new IllegalStateException(String.format("Unsupported severity='%s'", severity)); }; } diff --git a/refaster-runner/src/test/java/tech/picnic/errorprone/refaster/runner/RefasterTest.java b/refaster-runner/src/test/java/tech/picnic/errorprone/refaster/runner/RefasterTest.java index 65abc2d9ca7..6561d13b42f 100644 --- a/refaster-runner/src/test/java/tech/picnic/errorprone/refaster/runner/RefasterTest.java +++ b/refaster-runner/src/test/java/tech/picnic/errorprone/refaster/runner/RefasterTest.java @@ -195,8 +195,9 @@ private static SeverityLevel toSeverityLevel(String compilerDiagnosticsPrefix) { case "Note" -> SUGGESTION; case "warning" -> WARNING; case "error" -> ERROR; - default -> throw new IllegalStateException( - String.format("Unrecognized diagnostics prefix '%s'", compilerDiagnosticsPrefix)); + default -> + throw new IllegalStateException( + String.format("Unrecognized diagnostics prefix '%s'", compilerDiagnosticsPrefix)); }; }