From 66469e04fe35e5ceb3723cb563379a03e4883101 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 6 Feb 2018 22:12:42 +0100 Subject: [var] various upgrades to var: * var is promoted to the main package. * It is no longer an opt-in thing. * bug: var (unlike val) is allowed in old-style for loops, but if you multi-init: for (var i = 0, j="Foo";;), you now get an error that you can't do that. * tests both for the multi-for situation and the new main package variant. --- test/transform/resource/before/VarComplex.java | 3 +-- test/transform/resource/before/VarInFor.java | 3 +-- test/transform/resource/before/VarInForOld.java | 3 +-- test/transform/resource/before/VarInForOldMulti.java | 10 ++++++++++ test/transform/resource/before/VarModifier.java | 1 - test/transform/resource/before/VarNullInit.java | 3 +-- test/transform/resource/before/VarWarning.java | 3 +-- 7 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 test/transform/resource/before/VarInForOldMulti.java (limited to 'test/transform/resource/before') diff --git a/test/transform/resource/before/VarComplex.java b/test/transform/resource/before/VarComplex.java index bfaa8804..c93e177a 100644 --- a/test/transform/resource/before/VarComplex.java +++ b/test/transform/resource/before/VarComplex.java @@ -1,5 +1,4 @@ -//CONF: lombok.var.flagUsage = ALLOW -import lombok.experimental.var; +import lombok.var; public class VarComplex { private String field = ""; diff --git a/test/transform/resource/before/VarInFor.java b/test/transform/resource/before/VarInFor.java index cc8c387e..7f7bb7a7 100644 --- a/test/transform/resource/before/VarInFor.java +++ b/test/transform/resource/before/VarInFor.java @@ -1,5 +1,4 @@ -//CONF: lombok.var.flagUsage = ALLOW -import lombok.experimental.var; +import lombok.var; public class VarInFor { public void enhancedFor() { diff --git a/test/transform/resource/before/VarInForOld.java b/test/transform/resource/before/VarInForOld.java index f90aba7f..99e83b57 100644 --- a/test/transform/resource/before/VarInForOld.java +++ b/test/transform/resource/before/VarInForOld.java @@ -1,5 +1,4 @@ -//CONF: lombok.var.flagUsage = ALLOW -import lombok.experimental.var; +import lombok.var; public class VarInForOld { public void oldFor() { diff --git a/test/transform/resource/before/VarInForOldMulti.java b/test/transform/resource/before/VarInForOldMulti.java new file mode 100644 index 00000000..e2ea9682 --- /dev/null +++ b/test/transform/resource/before/VarInForOldMulti.java @@ -0,0 +1,10 @@ +//skip compare contents +import lombok.var; + +public class VarInForOldMulti { + public void oldForMulti() { + for (var i = 0, j = "Hey"; i < 100; ++i) { + System.out.println(i); + } + } +} \ No newline at end of file diff --git a/test/transform/resource/before/VarModifier.java b/test/transform/resource/before/VarModifier.java index 7250c1c5..5c68caa7 100644 --- a/test/transform/resource/before/VarModifier.java +++ b/test/transform/resource/before/VarModifier.java @@ -1,4 +1,3 @@ -//CONF: lombok.var.flagUsage = ALLOW import lombok.experimental.var; public class VarModifier { diff --git a/test/transform/resource/before/VarNullInit.java b/test/transform/resource/before/VarNullInit.java index efdc9d9e..f9bb53a3 100644 --- a/test/transform/resource/before/VarNullInit.java +++ b/test/transform/resource/before/VarNullInit.java @@ -1,5 +1,4 @@ -//CONF: lombok.var.flagUsage = ALLOW -import lombok.experimental.var; +import lombok.var; public class VarNullInit { void method() { diff --git a/test/transform/resource/before/VarWarning.java b/test/transform/resource/before/VarWarning.java index 85559587..90464d30 100644 --- a/test/transform/resource/before/VarWarning.java +++ b/test/transform/resource/before/VarWarning.java @@ -1,6 +1,5 @@ //CONF: lombok.var.flagUsage = WARNING -//skip compare contents -import lombok.experimental.var; +import lombok.var; public class VarWarning { public void isOkay() { -- cgit