diff --git a/.github/workflows/build-jdk11.yaml b/.github/workflows/build-jdk11.yaml
index 780668694c5..9ed337f2609 100644
--- a/.github/workflows/build-jdk11.yaml
+++ b/.github/workflows/build-jdk11.yaml
@@ -14,11 +14,11 @@ jobs:
# the code is compiled using JDK 17, while the tests are executed
# using JDK 11.
- name: Check out code
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
persist-credentials: false
- name: Set up JDK
- uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
+ uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0
with:
java-version: |
11.0.19
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ImmutablesSortedSetComparator.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ImmutablesSortedSetComparator.java
index 468a2dcc826..0d7446a2066 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ImmutablesSortedSetComparator.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ImmutablesSortedSetComparator.java
@@ -43,8 +43,9 @@
@AutoService(BugChecker.class)
@BugPattern(
summary =
- "`SortedSet` properties of a `@Value.Immutable` or `@Value.Modifiable` type must be "
- + "annotated with `@Value.NaturalOrder` or `@Value.ReverseOrder`",
+ """
+ `SortedSet` properties of a `@Value.Immutable` or `@Value.Modifiable` type must be \
+ annotated with `@Value.NaturalOrder` or `@Value.ReverseOrder`""",
link = BUG_PATTERNS_BASE_URL + "ImmutablesSortedSetComparator",
linkType = CUSTOM,
severity = ERROR,
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedPublishers.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedPublishers.java
index d4f00b99b13..da0761b4eec 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedPublishers.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedPublishers.java
@@ -34,8 +34,9 @@
@AutoService(BugChecker.class)
@BugPattern(
summary =
- "Avoid `Publisher`s that emit other `Publishers`s; "
- + "the resultant code is hard to reason about",
+ """
+ Avoid `Publisher`s that emit other `Publishers`s; the resultant code is hard to reason \
+ about""",
link = BUG_PATTERNS_BASE_URL + "NestedPublishers",
linkType = CUSTOM,
severity = WARNING,
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/PrimitiveComparison.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/PrimitiveComparison.java
index 997a52f644e..28c7b02c776 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/PrimitiveComparison.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/PrimitiveComparison.java
@@ -44,8 +44,9 @@
@AutoService(BugChecker.class)
@BugPattern(
summary =
- "Ensure invocations of `Comparator#comparing{,Double,Int,Long}` match the return type"
- + " of the provided function",
+ """
+ Ensure invocations of `Comparator#comparing{,Double,Int,Long}` match the return type of \
+ the provided function""",
link = BUG_PATTERNS_BASE_URL + "PrimitiveComparison",
linkType = CUSTOM,
severity = WARNING,
diff --git a/pom.xml b/pom.xml
index ea2fb187d2d..ff380c5f1fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1892,9 +1892,9 @@
true
${version.jdk.source}
diff --git a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsLikelyTrivialComputation.java b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsLikelyTrivialComputation.java
index 9cfa30b5110..dbf56e80e6b 100644
--- a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsLikelyTrivialComputation.java
+++ b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsLikelyTrivialComputation.java
@@ -23,7 +23,7 @@ public IsLikelyTrivialComputation() {}
@Override
public boolean matches(ExpressionTree expressionTree, VisitorState state) {
- if (expressionTree instanceof MethodInvocationTree) {
+ if (expressionTree instanceof MethodInvocationTree methodInvocation) {
// XXX: Method invocations are generally *not* trivial computations, but we make an exception
// for nullary method invocations on the result of a trivial computation. This exception
// allows this `Matcher` to by the `OptionalOrElseGet` Refaster rule, such that it does not
@@ -31,7 +31,6 @@ public boolean matches(ExpressionTree expressionTree, VisitorState state) {
// references. Once the `MethodReferenceUsage` bug checker is production-ready, this exception
// should be removed. (But at that point, instead defining a `RequiresComputation` matcher may
// be more appropriate.)
- MethodInvocationTree methodInvocation = (MethodInvocationTree) expressionTree;
if (methodInvocation.getArguments().isEmpty()
&& matches(methodInvocation.getMethodSelect())) {
return true;
@@ -44,9 +43,8 @@ && matches(methodInvocation.getMethodSelect())) {
// XXX: Some `BinaryTree`s may represent what could be considered "trivial computations".
// Depending on feedback such trees may be matched in the future.
private static boolean matches(ExpressionTree expressionTree) {
- if (expressionTree instanceof ArrayAccessTree) {
- return matches(((ArrayAccessTree) expressionTree).getExpression())
- && matches(((ArrayAccessTree) expressionTree).getIndex());
+ if (expressionTree instanceof ArrayAccessTree arrayAccess) {
+ return matches(arrayAccess.getExpression()) && matches(arrayAccess.getIndex());
}
if (expressionTree instanceof LiteralTree) {
@@ -65,26 +63,26 @@ private static boolean matches(ExpressionTree expressionTree) {
return true;
}
- if (expressionTree instanceof MemberReferenceTree) {
- return matches(((MemberReferenceTree) expressionTree).getQualifierExpression());
+ if (expressionTree instanceof MemberReferenceTree memberReference) {
+ return matches(memberReference.getQualifierExpression());
}
- if (expressionTree instanceof MemberSelectTree) {
- return matches(((MemberSelectTree) expressionTree).getExpression());
+ if (expressionTree instanceof MemberSelectTree memberSelect) {
+ return matches(memberSelect.getExpression());
}
- if (expressionTree instanceof ParenthesizedTree) {
- return matches(((ParenthesizedTree) expressionTree).getExpression());
+ if (expressionTree instanceof ParenthesizedTree parenthesized) {
+ return matches(parenthesized.getExpression());
}
- if (expressionTree instanceof TypeCastTree) {
- return matches(((TypeCastTree) expressionTree).getExpression());
+ if (expressionTree instanceof TypeCastTree typeCast) {
+ return matches(typeCast.getExpression());
}
- if (expressionTree instanceof UnaryTree) {
+ if (expressionTree instanceof UnaryTree unary) {
// XXX: Arguably side-effectful options such as pre- and post-increment and -decrement are not
// trivial.
- return matches(((UnaryTree) expressionTree).getExpression());
+ return matches(unary.getExpression());
}
return false;
diff --git a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/ThrowsCheckedException.java b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/ThrowsCheckedException.java
index aa11abcdf34..ed758cbcddc 100644
--- a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/ThrowsCheckedException.java
+++ b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/ThrowsCheckedException.java
@@ -7,7 +7,6 @@
import com.sun.source.tree.ExpressionTree;
import com.sun.source.tree.LambdaExpressionTree;
import com.sun.source.tree.MemberReferenceTree;
-import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.Types.FunctionDescriptorLookupError;
import java.util.Collection;
@@ -33,13 +32,8 @@ private static Collection getThrownTypes(ExpressionTree tree, VisitorState
return ASTHelpers.getThrownExceptions(lambdaExpression.getBody(), state);
}
- if (tree instanceof MemberReferenceTree) {
- Symbol symbol = ASTHelpers.getSymbol(tree);
- if (symbol == null) {
- return ImmutableSet.of();
- }
-
- return symbol.type.getThrownTypes();
+ if (tree instanceof MemberReferenceTree memberReference) {
+ return ASTHelpers.getSymbol(memberReference).type.getThrownTypes();
}
Type type = ASTHelpers.getType(tree);