4397 if (st.tsym == syms.enumSym &&
4398 ((c.flags_field & (Flags.ENUM|Flags.COMPOUND)) == 0))
4399 log.error(env.tree.pos(), "enum.no.subclassing");
4400
4401 // Enums may not be extended by source-level classes
4402 if (st.tsym != null &&
4403 ((st.tsym.flags_field & Flags.ENUM) != 0) &&
4404 ((c.flags_field & (Flags.ENUM | Flags.COMPOUND)) == 0)) {
4405 log.error(env.tree.pos(), "enum.types.not.extensible");
4406 }
4407
4408 if (isSerializable(c.type)) {
4409 env.info.isSerializable = true;
4410 }
4411
4412 attribClassBody(env, c);
4413
4414 chk.checkDeprecatedAnnotation(env.tree.pos(), c);
4415 chk.checkClassOverrideEqualsAndHashIfNeeded(env.tree.pos(), c);
4416 chk.checkFunctionalInterface((JCClassDecl) env.tree, c);
4417 } finally {
4418 env.info.returnResult = prevReturnRes;
4419 log.useSource(prev);
4420 chk.setLint(prevLint);
4421 }
4422
4423 }
4424 }
4425
4426 public void visitImport(JCImport tree) {
4427 // nothing to do
4428 }
4429
4430 public void visitModuleDef(JCModuleDecl tree) {
4431 tree.sym.completeUsesProvides();
4432 }
4433
4434 /** Finish the attribution of a class. */
4435 private void attribClassBody(Env<AttrContext> env, ClassSymbol c) {
4436 JCClassDecl tree = (JCClassDecl)env.tree;
|
4397 if (st.tsym == syms.enumSym &&
4398 ((c.flags_field & (Flags.ENUM|Flags.COMPOUND)) == 0))
4399 log.error(env.tree.pos(), "enum.no.subclassing");
4400
4401 // Enums may not be extended by source-level classes
4402 if (st.tsym != null &&
4403 ((st.tsym.flags_field & Flags.ENUM) != 0) &&
4404 ((c.flags_field & (Flags.ENUM | Flags.COMPOUND)) == 0)) {
4405 log.error(env.tree.pos(), "enum.types.not.extensible");
4406 }
4407
4408 if (isSerializable(c.type)) {
4409 env.info.isSerializable = true;
4410 }
4411
4412 attribClassBody(env, c);
4413
4414 chk.checkDeprecatedAnnotation(env.tree.pos(), c);
4415 chk.checkClassOverrideEqualsAndHashIfNeeded(env.tree.pos(), c);
4416 chk.checkFunctionalInterface((JCClassDecl) env.tree, c);
4417 chk.checkLeaksNotAccessible(env, (JCClassDecl) env.tree);
4418 } finally {
4419 env.info.returnResult = prevReturnRes;
4420 log.useSource(prev);
4421 chk.setLint(prevLint);
4422 }
4423
4424 }
4425 }
4426
4427 public void visitImport(JCImport tree) {
4428 // nothing to do
4429 }
4430
4431 public void visitModuleDef(JCModuleDecl tree) {
4432 tree.sym.completeUsesProvides();
4433 }
4434
4435 /** Finish the attribution of a class. */
4436 private void attribClassBody(Env<AttrContext> env, ClassSymbol c) {
4437 JCClassDecl tree = (JCClassDecl)env.tree;
|