From b8e1f3bdeb622ba92b25f12a4eff35ea5f75908c Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 29 Oct 2012 23:12:14 +0100 Subject: added tests for lub and val (lub = finding the common supertype, for example in a ternary expression). --- test/transform/resource/before/ValLub.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/transform/resource/before/ValLub.java (limited to 'test/transform/resource/before') diff --git a/test/transform/resource/before/ValLub.java b/test/transform/resource/before/ValLub.java new file mode 100644 index 00000000..c1b41c26 --- /dev/null +++ b/test/transform/resource/before/ValLub.java @@ -0,0 +1,23 @@ +class ValLub { + public void easyLub() { + java.util.Map m = java.util.Collections.emptyMap(); + + lombok.val foo = (System.currentTimeMillis() > 0) ? m : java.util.Collections.emptyMap(); + } + + public void sillyLubWithUnboxingThatProducesErrorThatVarIsPrimitive() { + Integer i = 20; + Double d = 20.0; + + lombok.val thisShouldBePrimitiveDouble = (System.currentTimeMillis() > 0) ? i : d; + } + + public void hardLub() { + java.util.List list = new java.util.ArrayList(); + java.util.Set set = new java.util.HashSet(); + + lombok.val thisShouldBeCollection = (System.currentTimeMillis() > 0) ? list : set; + thisShouldBeCollection.add(""); + String foo = thisShouldBeCollection.iterator().next(); + } +} -- cgit