@@ -0,0 +1,1094 @@
+%0Apackage net.restlesscoder.sandbox;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.HashSet;%0Aimport java.util.List;%0Aimport java.util.Set;%0Aimport java.util.function.Function;%0A%0Apublic class RawGenericsWeirdness %7B%0A%0A%09public static %3CT%3E List%3CSet%3CT%3E%3E makeSets( //%0A%09%09final Function%3CInteger, Set%3CT%3E%3E setFactory, int count)%0A%09%7B%0A%09%09final List%3CSet%3CT%3E%3E sets = new ArrayList%3C%3E();%0A%09%09for (int i=0; i%3Ccount; i++) %7B%0A%09%09%09sets.add(setFactory.apply(10));%0A%09%09%7D%0A%09%09return sets;%0A%09%7D%0A%0A%09//%09NB: Same weirdness occurs with Img instead of Set.%0A%09public static void createSomeSets() %7B%0A%09%09Function%3CInteger, Set%3CFloat%3E%3E mySetFactory = i -%3E %7B Set%3CFloat%3E set = new HashSet%3C%3E(); set.add(i.floatValue()); return set; %7D;%0A//%09%09List%3CSet%3C?%3E%3E sets = makeSets(mySetFactory, 3); // Type mismatch: cannot convert from List%3CSet%3CFloat%3E%3E to List%3CSet%3C?%3E%3E%0A%09%09Set%3C?%3E firstSet = makeSets(mySetFactory, 5).get(0);%0A%0A%09%09Function myRawSetFactory = mySetFactory;%0A%09%09List%3CSet%3C?%3E%3E sets = makeSets(myRawSetFactory, 3);%0A//%09%09Set%3C?%3E firstSet = makeSets(myRawSetFactory, 5).get(0); // Type mismatch: cannot convert from Object to Set%3C?%3E%0A%0A%09%09System.out.println(sets);%0A%09%7D%0A%7D%0A

Add example of weird raw generics compile errors