src/share/classes/com/sun/tools/javac/comp/Attr.java

changeset 1269
37dc15c68760
parent 1268
af6a4c24f4e3
child 1296
cddc2c894cc6
equal deleted inserted replaced
1268:af6a4c24f4e3 1269:37dc15c68760
698 log.error(tree.pos(), 698 log.error(tree.pos(),
699 "cant.inherit.from.final", t.tsym); 699 "cant.inherit.from.final", t.tsym);
700 } 700 }
701 chk.checkNonCyclic(tree.pos(), t); 701 chk.checkNonCyclic(tree.pos(), t);
702 return t; 702 return t;
703 }
704
705 Type attribIdentAsEnumType(Env<AttrContext> env, JCIdent id) {
706 Assert.check((env.enclClass.sym.flags() & ENUM) != 0);
707 id.type = env.info.scope.owner.type;
708 id.sym = env.info.scope.owner;
709 return id.type;
703 } 710 }
704 711
705 public void visitClassDef(JCClassDecl tree) { 712 public void visitClassDef(JCClassDecl tree) {
706 // Local classes have not been entered yet, so we need to do it now: 713 // Local classes have not been entered yet, so we need to do it now:
707 if ((env.info.scope.owner.kind & (VAR | MTH)) != 0) 714 if ((env.info.scope.owner.kind & (VAR | MTH)) != 0)
1655 clazz = clazzid1; 1662 clazz = clazzid1;
1656 } 1663 }
1657 1664
1658 // Attribute clazz expression and store 1665 // Attribute clazz expression and store
1659 // symbol + type back into the attributed tree. 1666 // symbol + type back into the attributed tree.
1660 Type clazztype = attribType(clazz, env); 1667 Type clazztype = TreeInfo.isEnumInit(env.tree) ?
1668 attribIdentAsEnumType(env, (JCIdent)clazz) :
1669 attribType(clazz, env);
1670
1661 clazztype = chk.checkDiamond(tree, clazztype); 1671 clazztype = chk.checkDiamond(tree, clazztype);
1662 chk.validate(clazz, localEnv); 1672 chk.validate(clazz, localEnv);
1663 if (tree.encl != null) { 1673 if (tree.encl != null) {
1664 // We have to work in this case to store 1674 // We have to work in this case to store
1665 // symbol + type back into the attributed tree. 1675 // symbol + type back into the attributed tree.

mercurial