langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
changeset 27851 5f28577d20f6
parent 27845 afce9de2de10
child 27856 d4711a6931e2
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Nov 20 14:23:31 2014 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Nov 21 12:36:21 2014 +0100
@@ -4490,14 +4490,15 @@
             super.visitTypeTest(tree);
         }
         public void visitNewClass(JCNewClass tree) {
-            if (tree.clazz.hasTag(ANNOTATED_TYPE)) {
-                checkForDeclarationAnnotations(((JCAnnotatedType) tree.clazz).annotations,
-                        tree.clazz.type.tsym);
-            }
-            if (tree.def != null) {
-                checkForDeclarationAnnotations(tree.def.mods.annotations, tree.clazz.type.tsym);
-            }
-            if (tree.clazz.type != null) {
+            if (tree.clazz != null && tree.clazz.type != null) {
+                if (tree.clazz.hasTag(ANNOTATED_TYPE)) {
+                    checkForDeclarationAnnotations(((JCAnnotatedType) tree.clazz).annotations,
+                            tree.clazz.type.tsym);
+                }
+                if (tree.def != null) {
+                    checkForDeclarationAnnotations(tree.def.mods.annotations, tree.clazz.type.tsym);
+                }
+
                 validateAnnotatedType(tree.clazz, tree.clazz.type);
             }
             super.visitNewClass(tree);