From 08e55fdfb64a1c27ac9b3fde5f78a12539617694 Mon Sep 17 00:00:00 2001 From: Picnic-Bot Date: Sun, 14 May 2023 17:01:46 +0200 Subject: [PATCH] Upgrade Error Prone 2.18.0 -> 2.19.1 (#621) Resolves #622. See: - https://github.com/google/error-prone/releases/tag/v2.19.0 - https://github.com/google/error-prone/releases/tag/v2.19.1 - https://github.com/google/error-prone/compare/v2.18.0...v2.19.1 - https://github.com/PicnicSupermarket/error-prone/compare/v2.18.0-picnic-1...v2.19.1-picnic-1 --- error-prone-contrib/pom.xml | 5 + ...cographicalAnnotationAttributeListing.java | 4 +- .../RedundantStringConversion.java | 4 +- .../bugpatterns/RequestParamType.java | 4 +- .../bugpatterns/StringCaseLocaleUsage.java | 89 ------------- .../refasterrules/BugCheckerRules.java | 2 + .../refasterrules/ComparatorRules.java | 2 + .../refasterrules/DoubleStreamRules.java | 2 + .../refasterrules/EqualityRules.java | 2 + .../refasterrules/IntStreamRules.java | 2 + .../refasterrules/LongStreamRules.java | 2 + .../refasterrules/OptionalRules.java | 2 + .../refasterrules/ReactorRules.java | 4 + .../errorprone/refasterrules/StreamRules.java | 2 + .../StringCaseLocaleUsageTest.java | 124 ------------------ pom.xml | 24 +++- refaster-runner/pom.xml | 5 + .../errorprone/refaster/runner/Refaster.java | 8 +- .../AnnotatedCompositeCodeTransformer.java | 4 +- ...AnnotatedCompositeCodeTransformerTest.java | 5 +- refaster-test-support/pom.xml | 5 + .../refaster/test/RefasterRuleCollection.java | 4 +- 22 files changed, 77 insertions(+), 228 deletions(-) delete mode 100644 error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StringCaseLocaleUsage.java delete mode 100644 error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/StringCaseLocaleUsageTest.java diff --git a/error-prone-contrib/pom.xml b/error-prone-contrib/pom.xml index a7a4215184..d405b73bef 100644 --- a/error-prone-contrib/pom.xml +++ b/error-prone-contrib/pom.xml @@ -126,6 +126,11 @@ jakarta.servlet-api test + + javax.inject + javax.inject + provided + javax.xml.bind jaxb-api diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListing.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListing.java index bd346140a5..ad46c26541 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListing.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListing.java @@ -40,6 +40,7 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Stream; +import javax.inject.Inject; import org.jspecify.annotations.Nullable; import tech.picnic.errorprone.bugpatterns.util.AnnotationAttributeMatcher; import tech.picnic.errorprone.bugpatterns.util.Flags; @@ -94,7 +95,8 @@ public LexicographicalAnnotationAttributeListing() { * * @param flags Any provided command line flags. */ - public LexicographicalAnnotationAttributeListing(ErrorProneFlags flags) { + @Inject + LexicographicalAnnotationAttributeListing(ErrorProneFlags flags) { matcher = createAnnotationAttributeMatcher(flags); } 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 db4889a91d..8ea3f7adb8 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 @@ -50,6 +50,7 @@ import java.util.Objects; import java.util.Optional; import java.util.stream.Stream; +import javax.inject.Inject; import tech.picnic.errorprone.bugpatterns.util.Flags; import tech.picnic.errorprone.bugpatterns.util.MethodMatcherFactory; import tech.picnic.errorprone.bugpatterns.util.SourceCode; @@ -155,7 +156,8 @@ public RedundantStringConversion() { * * @param flags Any provided command line flags. */ - public RedundantStringConversion(ErrorProneFlags flags) { + @Inject + RedundantStringConversion(ErrorProneFlags flags) { conversionMethodMatcher = createConversionMethodMatcher(flags); } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestParamType.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestParamType.java index 13143621f4..045d6ac8cd 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestParamType.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestParamType.java @@ -27,6 +27,7 @@ import com.google.errorprone.suppliers.Suppliers; import com.sun.source.tree.Tree; import com.sun.source.tree.VariableTree; +import javax.inject.Inject; import tech.picnic.errorprone.bugpatterns.util.Flags; /** A {@link BugChecker} that flags {@code @RequestParam} parameters with an unsupported type. */ @@ -55,7 +56,8 @@ public RequestParamType() { * * @param flags Any provided command line flags. */ - public RequestParamType(ErrorProneFlags flags) { + @Inject + RequestParamType(ErrorProneFlags flags) { hasUnsupportedRequestParamType = hasUnsupportedRequestParamType(flags); } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StringCaseLocaleUsage.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StringCaseLocaleUsage.java deleted file mode 100644 index 9aa40e0130..0000000000 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StringCaseLocaleUsage.java +++ /dev/null @@ -1,89 +0,0 @@ -package tech.picnic.errorprone.bugpatterns; - -import static com.google.errorprone.BugPattern.LinkType.CUSTOM; -import static com.google.errorprone.BugPattern.SeverityLevel.WARNING; -import static com.google.errorprone.BugPattern.StandardTags.FRAGILE_CODE; -import static com.google.errorprone.matchers.method.MethodMatchers.instanceMethod; -import static com.sun.tools.javac.parser.Tokens.TokenKind.RPAREN; -import static tech.picnic.errorprone.bugpatterns.util.Documentation.BUG_PATTERNS_BASE_URL; - -import com.google.auto.service.AutoService; -import com.google.common.collect.Streams; -import com.google.errorprone.BugPattern; -import com.google.errorprone.VisitorState; -import com.google.errorprone.bugpatterns.BugChecker; -import com.google.errorprone.bugpatterns.BugChecker.MethodInvocationTreeMatcher; -import com.google.errorprone.fixes.Fix; -import com.google.errorprone.fixes.SuggestedFix; -import com.google.errorprone.matchers.Description; -import com.google.errorprone.matchers.Matcher; -import com.google.errorprone.util.ASTHelpers; -import com.google.errorprone.util.ErrorProneTokens; -import com.sun.source.tree.ExpressionTree; -import com.sun.source.tree.MethodInvocationTree; -import com.sun.tools.javac.util.Position; -import tech.picnic.errorprone.bugpatterns.util.SourceCode; - -/** - * A {@link BugChecker} that flags calls to {@link String#toLowerCase()} and {@link - * String#toUpperCase()}, as these methods implicitly rely on the environment's default locale. - */ -// XXX: Also flag `String::toLowerCase` and `String::toUpperCase` method references. For these cases -// the suggested fix should introduce a lambda expression with a parameter of which the name does -// not coincide with the name of an existing variable name. Such functionality should likely be -// introduced in a utility class. -@AutoService(BugChecker.class) -@BugPattern( - summary = "Specify a `Locale` when calling `String#to{Lower,Upper}Case`", - link = BUG_PATTERNS_BASE_URL + "StringCaseLocaleUsage", - linkType = CUSTOM, - severity = WARNING, - tags = FRAGILE_CODE) -public final class StringCaseLocaleUsage extends BugChecker implements MethodInvocationTreeMatcher { - private static final long serialVersionUID = 1L; - private static final Matcher DEFAULT_LOCALE_CASE_CONVERSION = - instanceMethod() - .onExactClass(String.class.getName()) - .namedAnyOf("toLowerCase", "toUpperCase") - .withNoParameters(); - - /** Instantiates a new {@link StringCaseLocaleUsage} instance. */ - public StringCaseLocaleUsage() {} - - @Override - public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { - if (!DEFAULT_LOCALE_CASE_CONVERSION.matches(tree, state)) { - return Description.NO_MATCH; - } - - int closingParenPosition = getClosingParenPosition(tree, state); - if (closingParenPosition == Position.NOPOS) { - return describeMatch(tree); - } - - return buildDescription(tree) - .addFix(suggestLocale(closingParenPosition, "Locale.ROOT")) - .addFix(suggestLocale(closingParenPosition, "Locale.getDefault()")) - .build(); - } - - private static Fix suggestLocale(int insertPosition, String locale) { - return SuggestedFix.builder() - .addImport("java.util.Locale") - .replace(insertPosition, insertPosition, locale) - .build(); - } - - private static int getClosingParenPosition(MethodInvocationTree tree, VisitorState state) { - int startPosition = ASTHelpers.getStartPosition(tree); - if (startPosition == Position.NOPOS) { - return Position.NOPOS; - } - - return Streams.findLast( - ErrorProneTokens.getTokens(SourceCode.treeToString(tree, state), state.context).stream() - .filter(t -> t.kind() == RPAREN)) - .map(token -> startPosition + token.pos()) - .orElse(Position.NOPOS); - } -} diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/BugCheckerRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/BugCheckerRules.java index a65dff6783..fc3727af6d 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/BugCheckerRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/BugCheckerRules.java @@ -3,6 +3,7 @@ import com.google.errorprone.BugCheckerRefactoringTestHelper; import com.google.errorprone.BugCheckerRefactoringTestHelper.FixChooser; import com.google.errorprone.BugCheckerRefactoringTestHelper.FixChoosers; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.refaster.Refaster; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; @@ -25,6 +26,7 @@ BugCheckerRefactoringTestHelper before(BugCheckerRefactoringTestHelper helper) { } @AfterTemplate + @CanIgnoreReturnValue BugCheckerRefactoringTestHelper after(BugCheckerRefactoringTestHelper helper) { return helper; } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ComparatorRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ComparatorRules.java index 51a2659279..965044902d 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ComparatorRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ComparatorRules.java @@ -12,6 +12,7 @@ import com.google.common.collect.Comparators; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.refaster.Refaster; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; @@ -78,6 +79,7 @@ Comparator before(Comparator cmp) { } @AfterTemplate + @CanIgnoreReturnValue @UseImportPolicy(STATIC_IMPORT_ALWAYS) Comparator after(Comparator cmp) { return cmp; diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/DoubleStreamRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/DoubleStreamRules.java index 5e12ce5701..409eb1ae18 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/DoubleStreamRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/DoubleStreamRules.java @@ -1,6 +1,7 @@ package tech.picnic.errorprone.refasterrules; import com.google.common.collect.Streams; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.refaster.Refaster; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; @@ -27,6 +28,7 @@ DoubleStream before(DoubleStream stream) { } @AfterTemplate + @CanIgnoreReturnValue DoubleStream after(DoubleStream stream) { return stream; } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/EqualityRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/EqualityRules.java index bb6eb4bb53..effd045410 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/EqualityRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/EqualityRules.java @@ -1,5 +1,6 @@ package tech.picnic.errorprone.refasterrules; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.refaster.Refaster; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.AlsoNegation; @@ -63,6 +64,7 @@ boolean before(boolean b) { } @AfterTemplate + @CanIgnoreReturnValue boolean after(boolean b) { return b; } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/IntStreamRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/IntStreamRules.java index c49b7741b6..5ba2ed292f 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/IntStreamRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/IntStreamRules.java @@ -1,6 +1,7 @@ package tech.picnic.errorprone.refasterrules; import com.google.common.collect.Streams; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.refaster.Refaster; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; @@ -40,6 +41,7 @@ IntStream before(IntStream stream) { } @AfterTemplate + @CanIgnoreReturnValue IntStream after(IntStream stream) { return stream; } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/LongStreamRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/LongStreamRules.java index bd7edb557e..fe3bec8122 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/LongStreamRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/LongStreamRules.java @@ -1,6 +1,7 @@ package tech.picnic.errorprone.refasterrules; import com.google.common.collect.Streams; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.refaster.Refaster; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; @@ -40,6 +41,7 @@ LongStream before(LongStream stream) { } @AfterTemplate + @CanIgnoreReturnValue LongStream after(LongStream stream) { return stream; } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/OptionalRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/OptionalRules.java index 87f4ab8d0d..86fbe12501 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/OptionalRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/OptionalRules.java @@ -3,6 +3,7 @@ import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS; import com.google.common.collect.Streams; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.refaster.Refaster; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; @@ -351,6 +352,7 @@ Optional before(Optional optional, Comparator comparator) { } @AfterTemplate + @CanIgnoreReturnValue Optional after(Optional optional) { return optional; } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ReactorRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ReactorRules.java index ef0734e2da..f7c9d15eaa 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ReactorRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ReactorRules.java @@ -14,6 +14,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.refaster.Refaster; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; @@ -411,6 +412,7 @@ Mono> before3(Mono> mono) { } @AfterTemplate + @CanIgnoreReturnValue Mono after(Mono mono) { return mono; } @@ -424,6 +426,7 @@ Flux before(Flux flux) { } @AfterTemplate + @CanIgnoreReturnValue Flux after(Flux flux) { return flux; } @@ -1276,6 +1279,7 @@ StepVerifier.Step before(StepVerifier.Step step) { } @AfterTemplate + @CanIgnoreReturnValue StepVerifier.Step after(StepVerifier.Step step) { return step; } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/StreamRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/StreamRules.java index fdd5f2e77f..0cfa9ab31f 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/StreamRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/StreamRules.java @@ -21,6 +21,7 @@ import static java.util.stream.Collectors.summingLong; import com.google.common.collect.Streams; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.refaster.Refaster; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; @@ -124,6 +125,7 @@ Stream before(Stream stream) { } @AfterTemplate + @CanIgnoreReturnValue Stream after(Stream stream) { return stream; } diff --git a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/StringCaseLocaleUsageTest.java b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/StringCaseLocaleUsageTest.java deleted file mode 100644 index a3d087aef4..0000000000 --- a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/StringCaseLocaleUsageTest.java +++ /dev/null @@ -1,124 +0,0 @@ -package tech.picnic.errorprone.bugpatterns; - -import com.google.errorprone.BugCheckerRefactoringTestHelper; -import com.google.errorprone.BugCheckerRefactoringTestHelper.FixChoosers; -import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode; -import com.google.errorprone.CompilationTestHelper; -import org.junit.jupiter.api.Test; - -final class StringCaseLocaleUsageTest { - @Test - void identification() { - CompilationTestHelper.newInstance(StringCaseLocaleUsage.class, getClass()) - .addSourceLines( - "A.java", - "import static java.util.Locale.ROOT;", - "", - "import java.util.Locale;", - "", - "class A {", - " void m() {", - " \"a\".toLowerCase(Locale.ROOT);", - " \"a\".toUpperCase(Locale.ROOT);", - " \"b\".toLowerCase(ROOT);", - " \"b\".toUpperCase(ROOT);", - " \"c\".toLowerCase(Locale.getDefault());", - " \"c\".toUpperCase(Locale.getDefault());", - " \"d\".toLowerCase(Locale.ENGLISH);", - " \"d\".toUpperCase(Locale.ENGLISH);", - " \"e\".toLowerCase(new Locale(\"foo\"));", - " \"e\".toUpperCase(new Locale(\"foo\"));", - "", - " // BUG: Diagnostic contains:", - " \"f\".toLowerCase();", - " // BUG: Diagnostic contains:", - " \"g\".toUpperCase();", - "", - " String h = \"h\";", - " // BUG: Diagnostic contains:", - " h.toLowerCase();", - " String i = \"i\";", - " // BUG: Diagnostic contains:", - " i.toUpperCase();", - " }", - "}") - .doTest(); - } - - @Test - void replacementFirstSuggestedFix() { - BugCheckerRefactoringTestHelper.newInstance(StringCaseLocaleUsage.class, getClass()) - .addInputLines( - "A.java", - "class A {", - " void m() {", - " \"a\".toLowerCase(/* Comment with parens: (). */ );", - " \"b\".toUpperCase();", - " \"c\".toLowerCase().toString();", - "", - " toString().toLowerCase();", - " toString().toUpperCase /* Comment with parens: (). */();", - "", - " this.toString().toLowerCase() /* Comment with parens: (). */;", - " this.toString().toUpperCase();", - " }", - "}") - .addOutputLines( - "A.java", - "import java.util.Locale;", - "", - "class A {", - " void m() {", - " \"a\".toLowerCase(/* Comment with parens: (). */ Locale.ROOT);", - " \"b\".toUpperCase(Locale.ROOT);", - " \"c\".toLowerCase(Locale.ROOT).toString();", - "", - " toString().toLowerCase(Locale.ROOT);", - " toString().toUpperCase /* Comment with parens: (). */(Locale.ROOT);", - "", - " this.toString().toLowerCase(Locale.ROOT) /* Comment with parens: (). */;", - " this.toString().toUpperCase(Locale.ROOT);", - " }", - "}") - .doTest(TestMode.TEXT_MATCH); - } - - @Test - void replacementSecondSuggestedFix() { - BugCheckerRefactoringTestHelper.newInstance(StringCaseLocaleUsage.class, getClass()) - .setFixChooser(FixChoosers.SECOND) - .addInputLines( - "A.java", - "class A {", - " void m() {", - " \"a\".toLowerCase();", - " \"b\".toUpperCase(/* Comment with parens: (). */ );", - " \"c\".toLowerCase().toString();", - "", - " toString().toLowerCase();", - " toString().toUpperCase /* Comment with parens: (). */();", - "", - " this.toString().toLowerCase() /* Comment with parens: (). */;", - " this.toString().toUpperCase();", - " }", - "}") - .addOutputLines( - "A.java", - "import java.util.Locale;", - "", - "class A {", - " void m() {", - " \"a\".toLowerCase(Locale.getDefault());", - " \"b\".toUpperCase(/* Comment with parens: (). */ Locale.getDefault());", - " \"c\".toLowerCase(Locale.getDefault()).toString();", - "", - " toString().toLowerCase(Locale.getDefault());", - " toString().toUpperCase /* Comment with parens: (). */(Locale.getDefault());", - "", - " this.toString().toLowerCase(Locale.getDefault()) /* Comment with parens: (). */;", - " this.toString().toUpperCase(Locale.getDefault());", - " }", - "}") - .doTest(TestMode.TEXT_MATCH); - } -} diff --git a/pom.xml b/pom.xml index 6d25a72070..94ed687cf1 100644 --- a/pom.xml +++ b/pom.xml @@ -201,7 +201,7 @@ 1.10.1 ${version.error-prone-orig} v${version.error-prone-orig}-picnic-1 - 2.18.0 + 2.19.1 0.1.18 1.0 11 @@ -362,6 +362,11 @@ jakarta.servlet-api 6.0.0 + + javax.inject + javax.inject + 1 + javax.xml.bind jaxb-api @@ -981,6 +986,17 @@ org.checkerframework.dataflow.qual.* + + org.springframework + spring-aop + + + org.aopalliance.* + + true @@ -1700,10 +1716,6 @@ -Xep:BetaApi:OFF - - -Xep:InjectOnBugCheckers:OFF -Xep:Java7ApiChecker:OFF @@ -1724,6 +1736,8 @@ -XepOpt:NullAway:AssertsEnabled=true -XepOpt:NullAway:CheckOptionalEmptiness=true -XepOpt:Nullness:Conservative=false + -XepOpt:StatementSwitchToExpressionSwitch:EnableAssignmentSwitchConversion=true + -XepOpt:StatementSwitchToExpressionSwitch:EnableReturnSwitchConversion=true