提交 22118a1b 编写于 作者: M mcimadamore

6861837: JCK compilation failures

Summary: Type-annotations processing is accessing type info before they are available in MemberEnter
Reviewed-by: jjg
Contributed-by: mali@csail.mit.edu
上级 55ef224b
......@@ -1040,15 +1040,6 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
try {
enterTypeAnnotations(annotations);
// enrich type parameter symbols... easier for annotation processors
if (tree instanceof JCTypeParameter) {
JCTypeParameter typeparam = (JCTypeParameter)tree;
ListBuffer<Attribute.Compound> buf = ListBuffer.lb();
for (JCTypeAnnotation anno : annotations)
buf.add(anno.attribute_field);
typeparam.type.tsym.attributes_field = buf.toList();
}
} finally {
log.useSource(prev);
}
......
......@@ -817,6 +817,23 @@ public class TransTypes extends TreeTranslator {
pop();
}
private boolean inClass = false;
@Override
public void visitClassDef(JCClassDecl tree) {
if (!inClass) {
// Do not recurse into nested and inner classes since
// TransTypes.visitClassDef makes an invocation for each class
// separately.
inClass = true;
try {
super.visitClassDef(tree);
} finally {
inClass = false;
}
}
}
private TypeAnnotationPosition resolveFrame(JCTree tree, JCTree frame,
List<JCTree> path, TypeAnnotationPosition p) {
switch (frame.getKind()) {
......
......@@ -30,9 +30,30 @@
*/
class InnerClass {
InnerClass() {}
InnerClass(Object o) {}
private void a() {
new Object() {
public <R> void method() { }
};
}
Object f1 = new InnerClass() {
<R> void method() { }
};
Object f2 = new InnerClass() {
<@A R> void method() { }
};
Object f3 = new InnerClass(null) {
<R> void method() { }
};
Object f4 = new InnerClass(null) {
<@A R> void method() { }
};
@interface A { }
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册