import java.util.ArrayList; import java.util.List; class Test { List queue = new ArrayList<>(); ArrayList l = new ArrayList<>(8); } class HMCopy { private Entry[] table; class Entry { Entry(int h, K k, V v, Entry n) { } } void addEntry(int hash, K key, V value, int bucketIndex) { Entry e = table[bucketIndex]; table[bucketIndex] = new Entry<>(hash, key, value, e); } } class DD { P1> l = new L() { @Override void f() { } }; P1> l1 = new L<>(); P1> foo() { return new L<>(); } String s = ""; } class L extends P1> { void f() { } } class P1 extends P { } class P { } class Test1 { void bar() { foo(new FF<>()); } void foo(F> p) {} } class FF extends F{} class F {} class MyTest { static class Foo { Foo(X x) {} } static interface Base {} static class A extends Exception implements Base {} static class B extends Exception implements Base {} void m() throws B { try { if (true) { throw new A(); } else { throw new B(); } } catch (A ex) { Foo> foo1 = new Foo<>(ex); // ok Foo> foo2 = new Foo<>(ex); // should be error } } } class NonParameterized { void foo() { new NonParameterized<>(); } } interface I { T m(); } class FI1 { I i1 = new I<>() { @Override public String m() { return null; } }; I i2 = new I<>() { @Override public Object m() { return null; } }; } class Super { private Super(Integer i, Y y, X x) {} public Super(Number n, X x, Y y) {} } class TestMySuper { Super ssi1 = new Super<>(1, "", 2); } class TestLocal { class Member { } static class Nested {} void test() { class Local {} Member m = new Member<>(); Nested n = new Nested<>(); Local l = new Local<>(); } } class QualifiedTest { java.util.Map s = new java.util.HashMap<>(); } class TZ { } class ParenthTest { public ParenthTest(T x) { } public T z = null; public int a() { ParenthTest x = (new ParenthTest<>(null)); //red code is here return 1; } } class TestWildcardInference { interface A { } class B implements A { B(C v) { } } class C {} class U { void foo() { C x = null; A y = new B<>(x); } } } class PredefinedErrorsOverRaw { PredefinedErrorsOverRaw(T t) { } void test() { PredefinedErrorsOverRaw mc = new PredefinedErrorsOverRaw<>(""); } } class Outer { class Inner {} } class Outer1 {} class Outer2 { class Inner2 {} } class Another { public static void main(String[] args) { Outer o = new Outer(); Outer.Inner i = o.new Inner<>(); Outer.Inner i1 = m().new Inner<>(); Outer.Inner i2 = m1().new Inner<>(); Outer.Inner i3 = m2().new Inner<>(); System.out.println(i); Outer2.Inner2 i5 = new Outer2<>().new Inner2<>(); } static Outer m() {return null;} static T m1() {return null;} static T m2() {return null;} } class TypeParamsExtendsList { { new TypeWithGeneric<>(); } private static class A {} private static class TypeWithGeneric extends ArrayList { } }