1.1 --- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Sun Oct 20 12:01:43 2013 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Sun Oct 20 12:46:12 2013 -0700 1.3 @@ -323,7 +323,16 @@ 1.4 if (type == null) { 1.5 // When type is null, put the type annotations to the symbol. 1.6 // This is used for constructor return annotations, for which 1.7 - // no appropriate type exists. 1.8 + // we use the type of the enclosing class. 1.9 + type = sym.getEnclosingElement().asType(); 1.10 + 1.11 + // Declaration annotations are always allowed on constructor returns. 1.12 + // Therefore, use typeAnnotations instead of onlyTypeAnnos. 1.13 + type = typeWithAnnotations(typetree, type, typeAnnotations, typeAnnotations); 1.14 + // Note that we don't use the result, the call to 1.15 + // typeWithAnnotations side-effects the type annotation positions. 1.16 + // This is important for constructors of nested classes. 1.17 + 1.18 sym.appendUniqueTypeAttributes(typeAnnotations); 1.19 return; 1.20 }