import java.util.*; public class Test { static List asList(T... tt) { System.out.println(tt); return null; } @SafeVarargs static List asListSuppressed(T... tt) { System.out.println(tt); return null; } static List asStringList(List... tt) { return tt[0]; } static List asQList(List... tt) { return tt[0]; } static List asIntList(int... tt) { System.out.println(tt); return null; } public static void main(String[] args) { asList(new ArrayList()); asListSuppressed(new ArrayList()); //noinspection unchecked asList(new ArrayList()); asStringList(new ArrayList()); asQList(new ArrayList()); asIntList(1); final ArrayList list = new ArrayList(); asList(list); } public static void join(V[] list) { Arrays.asList(list); } } class NoWarngs { static final SemKey FILE_DESCRIPTION_KEY = SemKey.createKey("FILE_DESCRIPTION_KEY"); void f() { OCM o = new OCM<>("", true, new Condition(){ @Override public boolean val(String s) { return false; } }, Condition.TRUE); System.out.println(o); } } class SemKey { private final String myDebugName; private final SemKey[] mySupers; private SemKey(String debugName, SemKey... supers) { myDebugName = debugName; System.out.println(myDebugName); mySupers = supers; System.out.println(mySupers); } public static SemKey createKey(String debugName, SemKey... supers) { return new SemKey(debugName, supers); } public SemKey subKey(String debugName, SemKey... otherSupers) { if (otherSupers.length == 0) { return new SemKey(debugName, this); } return new SemKey(debugName, append(otherSupers, this)); } public static T[] append(final T[] src, final T element) { return append(src, element, (Class)src.getClass().getComponentType()); } public static T[] append(T[] src, final T element, Class componentType) { int length = src.length; T[] result = (T[])java.lang.reflect.Array.newInstance(componentType, length + 1); System.arraycopy(src, 0, result, 0, length); result[length] = element; return result; } } interface Condition { boolean val(T t); Condition TRUE = new Condition() { @Override public boolean val(Object o) { return true; } }; } class OCM { OCM(T s, boolean b, Condition... c) { System.out.println(s); System.out.println(b); System.out.println(c); } OCM(T s, Condition... c) { this(s, false, c); } } class TPSubstitution { public void f(T... args) { System.out.println(args); } public void g() { new TPSubstitution().f(); } }