diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-05-21 23:22:18 +0200 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-05-21 23:22:18 +0200 |
commit | 8f69331ce8d120c3a0c8440c805aab0b5e458e6d (patch) | |
tree | bf59e20b05c4dda5c6539efac50ccbecf4c1be61 /test/transform | |
parent | 56aabf5465918bd167c67fe46d56e72968c5cea3 (diff) | |
parent | 2704f073aad6deb362707e0311b6275cde7c5e1a (diff) | |
download | lombok-8f69331ce8d120c3a0c8440c805aab0b5e458e6d.tar.gz lombok-8f69331ce8d120c3a0c8440c805aab0b5e458e6d.tar.bz2 lombok-8f69331ce8d120c3a0c8440c805aab0b5e458e6d.zip |
Merge branch 'bulgakovalexander-feature/typeInferenceImprovements'
Diffstat (limited to 'test/transform')
7 files changed, 46 insertions, 21 deletions
diff --git a/test/transform/resource/after-delombok/ValLambda.java b/test/transform/resource/after-delombok/ValLambda.java index 9214b490..00ff27ad 100644 --- a/test/transform/resource/after-delombok/ValLambda.java +++ b/test/transform/resource/after-delombok/ValLambda.java @@ -5,17 +5,17 @@ class ValLambda { }; } public void easyIntersectionLambda() { - final java.lang.Object foo = (Runnable & java.io.Serializable) () -> { + final java.lang.Runnable foo = (Runnable & java.io.Serializable) () -> { }; - final java.lang.Object bar = (java.io.Serializable & Runnable) () -> { + final java.io.Serializable bar = (java.io.Serializable & Runnable) () -> { }; } public void easyLubLambda() { final java.lang.Runnable foo = (System.currentTimeMillis() > 0) ? (Runnable) () -> { - } : (Runnable) System.out::println; + } : System.out::println; + final java.lang.Runnable foo1 = (System.currentTimeMillis() > 0) ? (Runnable) System.out::println : System.out::println; + final java.util.function.Function foo2 = (System.currentTimeMillis() < 0) ? (java.util.function.Function) r -> "" : r -> System.currentTimeMillis(); + java.util.function.Function foo3 = (System.currentTimeMillis() < 0) ? (java.util.function.Function) r -> "" : r -> System.currentTimeMillis(); + final java.util.function.Function<java.lang.String, java.lang.String> foo4 = (System.currentTimeMillis() < 0) ? (java.util.function.Function<String, String>) r -> "" : r -> String.valueOf(System.currentTimeMillis()); } -// public void castLubLambda() { -// Runnable foo = (Runnable) ((System.currentTimeMillis() > 0) ? () -> {} : System.out::println); -// lombok.val foo = (Runnable) ((System.currentTimeMillis() > 0) ? () -> {} : System.out::println); -// } -} +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/ValWeirdTypes.java b/test/transform/resource/after-delombok/ValWeirdTypes.java index a6bc9bd4..8b399fe8 100644 --- a/test/transform/resource/after-delombok/ValWeirdTypes.java +++ b/test/transform/resource/after-delombok/ValWeirdTypes.java @@ -56,8 +56,14 @@ public class ValWeirdTypes<Z> { final int singleInt = copy[0]; } public void arraysAsList() { - final java.util.List<java.lang.Class<? extends java.lang.Object>> x = Arrays.asList(String.class, BigDecimal.class); - for (final java.lang.Class<?> y : x) { + final java.util.List<java.lang.Class<? extends java.io.Serializable>> x = Arrays.asList(String.class, BigDecimal.class); + for (final java.lang.Class<? extends java.io.Serializable> y : x) { + } + } + @SuppressWarnings("all") + public void arraysAsList2() { + final java.util.List<java.lang.Class<? extends java.lang.Comparable>> x = Arrays.asList(String.class, BigDecimal.class, Comparable.class); + for (final java.lang.Class<? extends java.lang.Comparable> y : x) { } } } diff --git a/test/transform/resource/after-ecj/ValLambda.java b/test/transform/resource/after-ecj/ValLambda.java index 4bf3265b..fcb855b3 100644 --- a/test/transform/resource/after-ecj/ValLambda.java +++ b/test/transform/resource/after-ecj/ValLambda.java @@ -7,13 +7,17 @@ class ValLambda { }; } public void easyIntersectionLambda() { - final @lombok.val java.lang.Object foo = (Runnable & java.io.Serializable) () -> { + final @lombok.val java.lang.Runnable foo = (Runnable & java.io.Serializable) () -> { }; - final @lombok.val java.lang.Object bar = (java.io.Serializable & Runnable) () -> { + final @lombok.val java.io.Serializable bar = (java.io.Serializable & Runnable) () -> { }; } public void easyLubLambda() { final @lombok.val java.lang.Runnable foo = ((System.currentTimeMillis() > 0) ? (Runnable) () -> { -} : (Runnable) System.out::println); +} : System.out::println); + final @lombok.val java.lang.Runnable foo1 = ((System.currentTimeMillis() > 0) ? (Runnable) System.out::println : System.out::println); + final @lombok.val java.util.function.Function foo2 = ((System.currentTimeMillis() < 0) ? (java.util.function.Function) (<no type> r) -> "" : (<no type> r) -> System.currentTimeMillis()); + java.util.function.Function foo3 = ((System.currentTimeMillis() < 0) ? (java.util.function.Function) (<no type> r) -> "" : (<no type> r) -> System.currentTimeMillis()); + final @lombok.val java.util.function.Function<java.lang.String, java.lang.String> foo4 = ((System.currentTimeMillis() < 0) ? (java.util.function.Function<String, String>) (<no type> r) -> "" : (<no type> r) -> String.valueOf(System.currentTimeMillis())); } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/ValWeirdTypes.java b/test/transform/resource/after-ecj/ValWeirdTypes.java index 9f448db9..e98b9753 100644 --- a/test/transform/resource/after-ecj/ValWeirdTypes.java +++ b/test/transform/resource/after-ecj/ValWeirdTypes.java @@ -63,8 +63,14 @@ public class ValWeirdTypes<Z> { final @val int singleInt = copy[0]; } public void arraysAsList() { - final @val java.util.List<java.lang.Class<? extends java.lang.Object>> x = Arrays.asList(String.class, BigDecimal.class); - for (final @val java.lang.Class<? extends java.lang.Object> y : x) + final @val java.util.List<java.lang.Class<? extends java.io.Serializable>> x = Arrays.asList(String.class, BigDecimal.class); + for (final @val java.lang.Class<? extends java.io.Serializable> y : x) + { + } + } + public @SuppressWarnings("all") void arraysAsList2() { + final @val java.util.List<java.lang.Class<? extends java.lang.Comparable>> x = Arrays.asList(String.class, BigDecimal.class, Comparable.class); + for (final @val java.lang.Class<? extends java.lang.Comparable> y : x) { } } diff --git a/test/transform/resource/before/ValLambda.java b/test/transform/resource/before/ValLambda.java index 51c4fba1..35f83c3c 100644 --- a/test/transform/resource/before/ValLambda.java +++ b/test/transform/resource/before/ValLambda.java @@ -10,11 +10,10 @@ class ValLambda { } public void easyLubLambda() { - lombok.val foo = (System.currentTimeMillis() > 0) ? (Runnable)()-> {} : (Runnable)System.out::println; + lombok.val foo = (System.currentTimeMillis() > 0) ? (Runnable)()-> {} : System.out::println; + lombok.val foo1 = (System.currentTimeMillis() > 0) ? (Runnable)System.out::println : System.out::println; + lombok.val foo2 = (System.currentTimeMillis() < 0) ? (java.util.function.Function) r -> "" : r -> System.currentTimeMillis(); + java.util.function.Function foo3 = (System.currentTimeMillis() < 0) ? (java.util.function.Function) r -> "" : r -> System.currentTimeMillis(); + lombok.val foo4 = (System.currentTimeMillis() < 0) ? (java.util.function.Function<String, String>) r -> "" : r -> String.valueOf(System.currentTimeMillis()); } - -// public void castLubLambda() { -// Runnable foo = (Runnable) ((System.currentTimeMillis() > 0) ? () -> {} : System.out::println); -// lombok.val foo = (Runnable) ((System.currentTimeMillis() > 0) ? () -> {} : System.out::println); -// } } diff --git a/test/transform/resource/before/ValWeirdTypes.java b/test/transform/resource/before/ValWeirdTypes.java index 4ea1b5d4..157ffc76 100644 --- a/test/transform/resource/before/ValWeirdTypes.java +++ b/test/transform/resource/before/ValWeirdTypes.java @@ -72,4 +72,12 @@ public class ValWeirdTypes<Z> { } } + + @SuppressWarnings("all") + public void arraysAsList2() { + val x = Arrays.asList(String.class, BigDecimal.class, Comparable.class); + for (val y : x) { + + } + } }
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/ValLambda.java.messages b/test/transform/resource/messages-ecj/ValLambda.java.messages new file mode 100644 index 00000000..21c831c3 --- /dev/null +++ b/test/transform/resource/messages-ecj/ValLambda.java.messages @@ -0,0 +1,2 @@ +14 Function is a raw type. References to generic type Function<T,R> should be parameterized +15 Function is a raw type. References to generic type Function<T,R> should be parameterized
\ No newline at end of file |