diff --git a/.github/workflows/build-jdk11.yaml b/.github/workflows/build-jdk11.yaml index 9eccae55a5..3de9e6e885 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@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: persist-credentials: false - name: Set up JDK - uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0 with: java-version: | 11.0.20 diff --git a/documentation-support/src/main/java/tech/picnic/errorprone/documentation/BugPatternTestExtractor.java b/documentation-support/src/main/java/tech/picnic/errorprone/documentation/BugPatternTestExtractor.java index cf7f7a0b0e..e694c4943f 100644 --- a/documentation-support/src/main/java/tech/picnic/errorprone/documentation/BugPatternTestExtractor.java +++ b/documentation-support/src/main/java/tech/picnic/errorprone/documentation/BugPatternTestExtractor.java @@ -125,8 +125,8 @@ private static Optional getClassUnderTest( } ExpressionTree receiver = ASTHelpers.getReceiver(tree); - return receiver instanceof MethodInvocationTree - ? getClassUnderTest((MethodInvocationTree) receiver, state) + return receiver instanceof MethodInvocationTree methodInvocation + ? getClassUnderTest(methodInvocation, state) : Optional.empty(); } @@ -144,8 +144,8 @@ private static void extractIdentificationTestCases( } ExpressionTree receiver = ASTHelpers.getReceiver(tree); - if (receiver instanceof MethodInvocationTree) { - extractIdentificationTestCases((MethodInvocationTree) receiver, sink, state); + if (receiver instanceof MethodInvocationTree methodInvocation) { + extractIdentificationTestCases(methodInvocation, sink, state); } } @@ -174,8 +174,8 @@ private static void extractReplacementTestCases( } ExpressionTree receiver = ASTHelpers.getReceiver(tree); - if (receiver instanceof MethodInvocationTree) { - extractReplacementTestCases((MethodInvocationTree) receiver, sink, state); + if (receiver instanceof MethodInvocationTree methodInvocation) { + extractReplacementTestCases(methodInvocation, sink, state); } } diff --git a/documentation-support/src/test/java/tech/picnic/errorprone/documentation/DocumentationGeneratorTaskListenerTest.java b/documentation-support/src/test/java/tech/picnic/errorprone/documentation/DocumentationGeneratorTaskListenerTest.java index 2394b15a14..0b300dc23b 100644 --- a/documentation-support/src/test/java/tech/picnic/errorprone/documentation/DocumentationGeneratorTaskListenerTest.java +++ b/documentation-support/src/test/java/tech/picnic/errorprone/documentation/DocumentationGeneratorTaskListenerTest.java @@ -125,8 +125,8 @@ public Optional tryExtract(ClassTree tree, VisitorState st } private static String describeTree(Tree tree) { - return (tree instanceof ClassTree) - ? String.join(": ", String.valueOf(tree.getKind()), ((ClassTree) tree).getSimpleName()) + return (tree instanceof ClassTree clazz) + ? String.join(": ", String.valueOf(tree.getKind()), clazz.getSimpleName()) : tree.getKind().toString(); } } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NonStaticImport.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NonStaticImport.java index f913b93e09..a4a6c07260 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NonStaticImport.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NonStaticImport.java @@ -159,10 +159,9 @@ private static ImmutableTable getUndesire ImmutableTable.builder(); for (ImportTree importTree : tree.getImports()) { Tree qualifiedIdentifier = importTree.getQualifiedIdentifier(); - if (importTree.isStatic() && qualifiedIdentifier instanceof MemberSelectTree) { - MemberSelectTree memberSelectTree = (MemberSelectTree) qualifiedIdentifier; - String type = SourceCode.treeToString(memberSelectTree.getExpression(), state); - String member = memberSelectTree.getIdentifier().toString(); + if (importTree.isStatic() && qualifiedIdentifier instanceof MemberSelectTree memberSelect) { + String type = SourceCode.treeToString(memberSelect.getExpression(), state); + String member = memberSelect.getIdentifier().toString(); if (shouldNotBeStaticallyImported(type, member)) { imports.put( type,