Java: Improve test and fix a few missing cases.#6130
Conversation
javaGenerated file changes for java
- Java Standard Library,``java.*``,3,315,17,13,,,,,,4
+ Java Standard Library,``java.*``,3,317,17,13,,,,,,4
- Totals,,84,1622,181,13,6,6,,33,1,58
+ Totals,,84,1624,181,13,6,6,,33,1,58
- java.util,,,283,,,,,,,,,,,,,,15,268
+ java.util,,,285,,,,,,,,,,,,,,15,270 |
smowton
left a comment
There was a problem hiding this comment.
Otherwise looks good, will look to include stuff like this in test-generator v2
| static <K,V> Map<K,V> storeMapKey(K obj) { Map<K,V> m = new TreeMap<K,V>(); m.put(obj,null); return m; } | ||
|
|
||
| static <K,V> Map.Entry<K,V> storeMapValueEntry(V obj) { return Map.entry(null,obj); } | ||
| static <K,V> Map<K,V> storeMapValue(V obj) { Map<K,V> m = 1==1?new TreeMap<K,V>():new ConcurrentHashMap<K,V>(); m.put(null,obj); return m; } |
There was a problem hiding this comment.
Seems quite likely javac might delete one of the arms here? Perhaps use System.currentTimeMillis as a source of nondeterminism?
There was a problem hiding this comment.
No, I don't believe javac does that kind of optimisation. At the very least this does make it into the db, because if you simplify it then type pruning will remove some results (since the result of storeMapValue is cast to a ConcurrentMap, which is incompatible with TreeMap).
This gets rid of most of the "magic" to improve the credibility of the test. Also, fixes a few missing cases.