changeset 1104:f6c783e18bdf jdk8-b10

Merge
author lana
date Mon, 17 Oct 2011 19:07:26 -0700
parents 510d09ddc861 5010ffc61eda
children 4bf01f1c4e34
files
diffstat 3 files changed, 60 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Oct 13 10:35:50 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Oct 17 19:07:26 2011 -0700
@@ -1169,12 +1169,17 @@
             if (lint.isEnabled(LintCategory.RAW) &&
                 tree.type.tag == CLASS &&
                 !TreeInfo.isDiamond(tree) &&
-                !env.enclClass.name.isEmpty() &&  //anonymous or intersection
+                !withinAnonConstr(env) &&
                 tree.type.isRaw()) {
                 log.warning(LintCategory.RAW,
                         tree.pos(), "raw.class.use", tree.type, tree.type.tsym.type);
             }
         }
+
+        boolean withinAnonConstr(Env<AttrContext> env) {
+            return env.enclClass.name.isEmpty() &&
+                    env.enclMethod != null && env.enclMethod.name == names.init;
+        }
     }
 
 /* *************************************************************************
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/warnings/7090499/T7090499.java	Mon Oct 17 19:07:26 2011 -0700
@@ -0,0 +1,37 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 7094099
+ * @summary -Xlint:rawtypes
+ * @compile/fail/ref=T7090499.out -XDrawDiagnostics -Xlint:rawtypes T7090499.java
+ */
+
+
+class T7090499<E> {
+
+    static class B<X> {}
+
+    class A<X> {
+        class X {}
+        class Z<Y> {}
+    }
+
+    T7090499 t = new T7090499() { //raw warning (2)
+
+        A.X x1;//raw warning
+        A.Z z1;//raw warning
+
+        T7090499.B<Integer> b1;//ok
+        T7090499.B b2;//raw warning
+
+        A<String>.X x2;//ok
+        A<String>.Z<Integer> z2;//ok
+        A<B>.Z<A<B>> z3;//raw warning (2)
+
+        void test(Object arg1, B arg2) {//raw warning
+            boolean b = arg1 instanceof A;//ok
+            Object a = (A)arg1;//ok
+            A a2 = new A() {};//raw warning (2)
+            a2.new Z() {};//raw warning
+        }
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/warnings/7090499/T7090499.out	Mon Oct 17 19:07:26 2011 -0700
@@ -0,0 +1,17 @@
+T7090499.java:18:5: compiler.warn.raw.class.use: T7090499, T7090499<E>
+T7090499.java:18:22: compiler.warn.raw.class.use: T7090499, T7090499<E>
+T7090499.java:20:10: compiler.warn.raw.class.use: T7090499.A.X, T7090499<E>.A<X>.X
+T7090499.java:21:10: compiler.warn.raw.class.use: T7090499.A.Z, T7090499<E>.A<X>.Z<Y>
+T7090499.java:24:17: compiler.warn.raw.class.use: T7090499.B, T7090499.B<X>
+T7090499.java:26:10: compiler.err.improperly.formed.type.inner.raw.param
+T7090499.java:27:10: compiler.err.improperly.formed.type.inner.raw.param
+T7090499.java:28:18: compiler.warn.raw.class.use: T7090499.B, T7090499.B<X>
+T7090499.java:28:17: compiler.err.improperly.formed.type.inner.raw.param
+T7090499.java:28:11: compiler.warn.raw.class.use: T7090499.B, T7090499.B<X>
+T7090499.java:28:10: compiler.err.improperly.formed.type.inner.raw.param
+T7090499.java:30:32: compiler.warn.raw.class.use: T7090499.B, T7090499.B<X>
+T7090499.java:33:13: compiler.warn.raw.class.use: T7090499.A, T7090499<E>.A<X>
+T7090499.java:33:24: compiler.warn.raw.class.use: T7090499.A, T7090499<E>.A<X>
+T7090499.java:34:20: compiler.warn.raw.class.use: T7090499.A.Z, T7090499<E>.A<X>.Z<Y>
+4 errors
+11 warnings