4376 if (st.tsym == syms.enumSym &&
4377 ((c.flags_field & (Flags.ENUM|Flags.COMPOUND)) == 0))
4378 log.error(env.tree.pos(), "enum.no.subclassing");
4379
4380 // Enums may not be extended by source-level classes
4381 if (st.tsym != null &&
4382 ((st.tsym.flags_field & Flags.ENUM) != 0) &&
4383 ((c.flags_field & (Flags.ENUM | Flags.COMPOUND)) == 0)) {
4384 log.error(env.tree.pos(), "enum.types.not.extensible");
4385 }
4386
4387 if (isSerializable(c.type)) {
4388 env.info.isSerializable = true;
4389 }
4390
4391 attribClassBody(env, c);
4392
4393 chk.checkDeprecatedAnnotation(env.tree.pos(), c);
4394 chk.checkClassOverrideEqualsAndHashIfNeeded(env.tree.pos(), c);
4395 chk.checkFunctionalInterface((JCClassDecl) env.tree, c);
4396 } finally {
4397 env.info.returnResult = prevReturnRes;
4398 log.useSource(prev);
4399 chk.setLint(prevLint);
4400 }
4401
4402 }
4403 }
4404
4405 public void visitImport(JCImport tree) {
4406 // nothing to do
4407 }
4408
4409 public void visitModuleDef(JCModuleDecl tree) {
4410 tree.sym.completeUsesProvides();
4411 }
4412
4413 /** Finish the attribution of a class. */
4414 private void attribClassBody(Env<AttrContext> env, ClassSymbol c) {
4415 JCClassDecl tree = (JCClassDecl)env.tree;
|
4376 if (st.tsym == syms.enumSym &&
4377 ((c.flags_field & (Flags.ENUM|Flags.COMPOUND)) == 0))
4378 log.error(env.tree.pos(), "enum.no.subclassing");
4379
4380 // Enums may not be extended by source-level classes
4381 if (st.tsym != null &&
4382 ((st.tsym.flags_field & Flags.ENUM) != 0) &&
4383 ((c.flags_field & (Flags.ENUM | Flags.COMPOUND)) == 0)) {
4384 log.error(env.tree.pos(), "enum.types.not.extensible");
4385 }
4386
4387 if (isSerializable(c.type)) {
4388 env.info.isSerializable = true;
4389 }
4390
4391 attribClassBody(env, c);
4392
4393 chk.checkDeprecatedAnnotation(env.tree.pos(), c);
4394 chk.checkClassOverrideEqualsAndHashIfNeeded(env.tree.pos(), c);
4395 chk.checkFunctionalInterface((JCClassDecl) env.tree, c);
4396 chk.checkUnexportedInApi(env, (JCClassDecl) env.tree);
4397 } finally {
4398 env.info.returnResult = prevReturnRes;
4399 log.useSource(prev);
4400 chk.setLint(prevLint);
4401 }
4402
4403 }
4404 }
4405
4406 public void visitImport(JCImport tree) {
4407 // nothing to do
4408 }
4409
4410 public void visitModuleDef(JCModuleDecl tree) {
4411 tree.sym.completeUsesProvides();
4412 }
4413
4414 /** Finish the attribution of a class. */
4415 private void attribClassBody(Env<AttrContext> env, ClassSymbol c) {
4416 JCClassDecl tree = (JCClassDecl)env.tree;
|