--- 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);