mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 14:16:11 +00:00
added tests for lub and val (lub = finding the common supertype, for example in a ternary expression).
This commit is contained in:
1 parent
7bd3851f68
commit
b8e1f3bdeb
3 files changed
+62
No files matched your search
@@ -0,0 +1,23 @@
|
||||
class ValLub {
|
||||
public void easyLub() {
|
||||
java.util.Map<String, Number> m = java.util.Collections.emptyMap();
|
||||
|
||||
lombok.val foo = (System.currentTimeMillis() > 0) ? m : java.util.Collections.<String, Number>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<String> list = new java.util.ArrayList<String>();
|
||||
java.util.Set<String> set = new java.util.HashSet<String>();
|
||||
|
||||
lombok.val thisShouldBeCollection = (System.currentTimeMillis() > 0) ? list : set;
|
||||
thisShouldBeCollection.add("");
|
||||
String foo = thisShouldBeCollection.iterator().next();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user