From 36d7e65a4d39022c78bec0755e765bbb6bb842c4 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Tue, 10 Sep 2024 12:31:31 -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: 673063384 --- 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 0824e406034f..8a24c1a48fd9 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 621ae03f66ee..08b320156158 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 2181e204e5b4..976970415017 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