From 3ac415254f64d27003a3c5b7a232a33fd785b1f9 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 19 Feb 2019 02:08:08 +0100 Subject: [fixes #1997] try-with-resources where the thing you’re guarding is just a variable ref instead of a full decl (legal since JDK9) would break delombok MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/pretty/resource/after/tryWithResourcesVarRef.java | 9 +++++++++ test/pretty/resource/before/TryWithResourcesVarRef.java | 10 ++++++++++ 2 files changed, 19 insertions(+) create mode 100644 test/pretty/resource/after/tryWithResourcesVarRef.java create mode 100644 test/pretty/resource/before/TryWithResourcesVarRef.java (limited to 'test/pretty') diff --git a/test/pretty/resource/after/tryWithResourcesVarRef.java b/test/pretty/resource/after/tryWithResourcesVarRef.java new file mode 100644 index 00000000..5117f706 --- /dev/null +++ b/test/pretty/resource/after/tryWithResourcesVarRef.java @@ -0,0 +1,9 @@ +import java.io.PrintWriter; +public class TryWithResourcesVarRef { + { + PrintWriter pw = new PrintWriter(System.out); + try (pw) { + pw.println(); + } + } +} diff --git a/test/pretty/resource/before/TryWithResourcesVarRef.java b/test/pretty/resource/before/TryWithResourcesVarRef.java new file mode 100644 index 00000000..6c039eb7 --- /dev/null +++ b/test/pretty/resource/before/TryWithResourcesVarRef.java @@ -0,0 +1,10 @@ +//version 9: +import java.io.PrintWriter; +public class TryWithResourcesVarRef { + { + PrintWriter pw = new PrintWriter(System.out); + try (pw) { + pw.println(); + } + } +} -- cgit