test/tools/javac/warnings/6747671/T6747671.java

Thu, 19 Aug 2010 11:52:58 +0100

author
mcimadamore
date
Thu, 19 Aug 2010 11:52:58 +0100
changeset 638
d6fe0ea070aa
parent 384
ed31953ca025
child 2038
8d1c48de706d
permissions
-rw-r--r--

6885255: Improve usability of raw warnings
Summary: raw warnings should be disabled in (i) instanceof expressions and (ii) when java.lang.Class is not parameterized
Reviewed-by: jjg

mcimadamore@122 1 /**
jjg@384 2 * @test /nodynamiccopyright/
mcimadamore@122 3 * @bug 6747671
mcimadamore@122 4 * @summary -Xlint:rawtypes
mcimadamore@122 5 * @compile/ref=T6747671.out -XDrawDiagnostics -Xlint:rawtypes T6747671.java
mcimadamore@122 6 */
mcimadamore@122 7
mcimadamore@122 8
mcimadamore@122 9 class T6747671<E> {
mcimadamore@122 10
mcimadamore@122 11 static class B<X> {}
mcimadamore@122 12
mcimadamore@122 13 class A<X> {
mcimadamore@122 14 class X {}
mcimadamore@122 15 class Z<Y> {}
mcimadamore@122 16 }
mcimadamore@122 17
mcimadamore@122 18
mcimadamore@122 19 A.X x1;//raw warning
mcimadamore@122 20 A.Z z1;//raw warning
mcimadamore@122 21
mcimadamore@122 22 T6747671.B<Integer> b1;//ok
mcimadamore@122 23 T6747671.B b2;//raw warning
mcimadamore@122 24
mcimadamore@122 25 A<String>.X x2;//ok
mcimadamore@122 26 A<String>.Z<Integer> z2;//ok
mcimadamore@122 27 A<B>.Z<A<B>> z3;//raw warning (2)
mcimadamore@122 28
mcimadamore@122 29 void test(Object arg1, B arg2) {//raw warning
mcimadamore@638 30 boolean b = arg1 instanceof A;//ok
mcimadamore@638 31 Object a = (A)arg1;//ok
mcimadamore@122 32 A a2 = new A() {};//raw warning (2)
mcimadamore@122 33 a2.new Z() {};//raw warning
mcimadamore@122 34 }
jjg@384 35 }

mercurial