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

Print this page




3992             while (lintEnv.info.lint == null)
3993                 lintEnv = lintEnv.next;
3994 
3995             // Having found the enclosing lint value, we can initialize the lint value for this class
3996             env.info.lint = lintEnv.info.lint.augment(c.annotations, c.flags());
3997 
3998             Lint prevLint = chk.setLint(env.info.lint);
3999             JavaFileObject prev = log.useSource(c.sourcefile);
4000             ResultInfo prevReturnRes = env.info.returnResult;
4001 
4002             try {
4003                 env.info.returnResult = null;
4004                 // java.lang.Enum may not be subclassed by a non-enum
4005                 if (st.tsym == syms.enumSym &&
4006                     ((c.flags_field & (Flags.ENUM|Flags.COMPOUND)) == 0))
4007                     log.error(env.tree.pos(), "enum.no.subclassing");
4008 
4009                 // Enums may not be extended by source-level classes
4010                 if (st.tsym != null &&
4011                     ((st.tsym.flags_field & Flags.ENUM) != 0) &&
4012                     ((c.flags_field & (Flags.ENUM | Flags.COMPOUND)) == 0) &&
4013                     !target.compilerBootstrap(c)) {
4014                     log.error(env.tree.pos(), "enum.types.not.extensible");
4015                 }
4016                 attribClassBody(env, c);
4017 
4018                 chk.checkDeprecatedAnnotation(env.tree.pos(), c);
4019                 chk.checkClassOverrideEqualsAndHashIfNeeded(env.tree.pos(), c);
4020             } finally {
4021                 env.info.returnResult = prevReturnRes;
4022                 log.useSource(prev);
4023                 chk.setLint(prevLint);
4024             }
4025 
4026         }
4027     }
4028 
4029     public void visitImport(JCImport tree) {
4030         // nothing to do
4031     }
4032 
4033     /** Finish the attribution of a class. */




3992             while (lintEnv.info.lint == null)
3993                 lintEnv = lintEnv.next;
3994 
3995             // Having found the enclosing lint value, we can initialize the lint value for this class
3996             env.info.lint = lintEnv.info.lint.augment(c.annotations, c.flags());
3997 
3998             Lint prevLint = chk.setLint(env.info.lint);
3999             JavaFileObject prev = log.useSource(c.sourcefile);
4000             ResultInfo prevReturnRes = env.info.returnResult;
4001 
4002             try {
4003                 env.info.returnResult = null;
4004                 // java.lang.Enum may not be subclassed by a non-enum
4005                 if (st.tsym == syms.enumSym &&
4006                     ((c.flags_field & (Flags.ENUM|Flags.COMPOUND)) == 0))
4007                     log.error(env.tree.pos(), "enum.no.subclassing");
4008 
4009                 // Enums may not be extended by source-level classes
4010                 if (st.tsym != null &&
4011                     ((st.tsym.flags_field & Flags.ENUM) != 0) &&
4012                     ((c.flags_field & (Flags.ENUM | Flags.COMPOUND)) == 0)) {

4013                     log.error(env.tree.pos(), "enum.types.not.extensible");
4014                 }
4015                 attribClassBody(env, c);
4016 
4017                 chk.checkDeprecatedAnnotation(env.tree.pos(), c);
4018                 chk.checkClassOverrideEqualsAndHashIfNeeded(env.tree.pos(), c);
4019             } finally {
4020                 env.info.returnResult = prevReturnRes;
4021                 log.useSource(prev);
4022                 chk.setLint(prevLint);
4023             }
4024 
4025         }
4026     }
4027 
4028     public void visitImport(JCImport tree) {
4029         // nothing to do
4030     }
4031 
4032     /** Finish the attribution of a class. */