From 4e0b19cea5da91f3e9080cb8535839902bfdee3a Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Wed, 11 Sep 2024 09:56:39 -0700 Subject: [PATCH] Start using Java > 11 language features in Error Prone tests This is a first step towards raising the minimum supported JDK version Error Prone to JDK 17. PiperOrigin-RevId: 673432814 --- check_api/pom.xml | 2 +- .../errorprone/bugpatterns/FinallyTest.java | 23 +++++++++++-------- pom.xml | 6 ++--- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/check_api/pom.xml b/check_api/pom.xml index 0824e406034..8a24c1a48fd 100644 --- a/check_api/pom.xml +++ b/check_api/pom.xml @@ -168,7 +168,7 @@ default-compile - 11 + 17 diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/FinallyTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/FinallyTest.java index 621ae03f66e..08b32015615 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/FinallyTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/FinallyTest.java @@ -55,15 +55,20 @@ public void lambda() { compilationHelper .addSourceLines( "Test.java", - "class Test {", - " void f() {", - " try {", - " } catch (Throwable t) {", - " } finally {", - " Runnable r = () -> { return; };", - " }", - " }", - "}") + """ + class Test { + void f() { + try { + } catch (Throwable t) { + } finally { + Runnable r = + () -> { + return; + }; + } + } + } + """) .doTest(); } } diff --git a/pom.xml b/pom.xml index 2181e204e5b..97697041501 100644 --- a/pom.xml +++ b/pom.xml @@ -182,8 +182,8 @@ maven-compiler-plugin 3.13.0 - 11 - 11 + 17 + 17 --add-exports=java.base/jdk.internal.javac=ALL-UNNAMED @@ -284,7 +284,7 @@ - 11 + 17 24