src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
Print this page
@@ -471,48 +471,10 @@
make.Type(syms.stringType), null)),
List.<JCExpression>nil(), // thrown
null, //make.Block(0, Tree.emptyList.prepend(make.Return(make.Ident(names._null)))),
null);
memberEnter(valueOf, env);
-
- // the remaining members are for bootstrapping only
- if (!target.compilerBootstrap(tree.sym)) return;
-
- // public final int ordinal() { return ???; }
- JCMethodDecl ordinal = make.at(tree.pos).
- MethodDef(make.Modifiers(Flags.PUBLIC|Flags.FINAL),
- names.ordinal,
- make.Type(syms.intType),
- List.<JCTypeParameter>nil(),
- List.<JCVariableDecl>nil(),
- List.<JCExpression>nil(),
- null,
- null);
- memberEnter(ordinal, env);
-
- // public final String name() { return ???; }
- JCMethodDecl name = make.
- MethodDef(make.Modifiers(Flags.PUBLIC|Flags.FINAL),
- names._name,
- make.Type(syms.stringType),
- List.<JCTypeParameter>nil(),
- List.<JCVariableDecl>nil(),
- List.<JCExpression>nil(),
- null,
- null);
- memberEnter(name, env);
-
- // public int compareTo(E other) { return ???; }
- MethodSymbol compareTo = new
- MethodSymbol(Flags.PUBLIC,
- names.compareTo,
- new MethodType(List.of(tree.sym.type),
- syms.intType,
- List.<Type>nil(),
- syms.methodClass),
- tree.sym);
- memberEnter(make.MethodDef(compareTo, null), env);
}
public void visitTopLevel(JCCompilationUnit tree) {
if (tree.starImportScope.elems != null) {
// we must have already processed this toplevel
@@ -934,11 +896,11 @@
// Determine supertype.
Type supertype =
(tree.extending != null)
? attr.attribBase(tree.extending, baseEnv, true, false, true)
- : ((tree.mods.flags & Flags.ENUM) != 0 && !target.compilerBootstrap(c))
+ : ((tree.mods.flags & Flags.ENUM) != 0)
? attr.attribBase(enumBase(tree.pos, c), baseEnv,
true, false, false)
: (c.fullname == names.java_lang_Object)
? Type.noType
: syms.objectType;
@@ -947,20 +909,10 @@
// Determine interfaces.
ListBuffer<Type> interfaces = new ListBuffer<Type>();
ListBuffer<Type> all_interfaces = null; // lazy init
Set<Type> interfaceSet = new HashSet<Type>();
List<JCExpression> interfaceTrees = tree.implementing;
- if ((tree.mods.flags & Flags.ENUM) != 0 && target.compilerBootstrap(c)) {
- // add interface Comparable<T>
- interfaceTrees =
- interfaceTrees.prepend(make.Type(new ClassType(syms.comparableType.getEnclosingType(),
- List.of(c.type),
- syms.comparableType.tsym)));
- // add interface Serializable
- interfaceTrees =
- interfaceTrees.prepend(make.Type(syms.serializableType));
- }
for (JCExpression iface : interfaceTrees) {
Type i = attr.attribBase(iface, baseEnv, false, true, true);
if (i.hasTag(CLASS)) {
interfaces.append(i);
if (all_interfaces != null) all_interfaces.append(i);
@@ -1399,12 +1351,11 @@
List<JCVariableDecl> params = make.Params(argtypes, syms.noSymbol);
List<JCStatement> stats = List.nil();
if (c.type != syms.objectType)
stats = stats.prepend(SuperCall(make, typarams, params, based));
if ((c.flags() & ENUM) != 0 &&
- (types.supertype(c.type).tsym == syms.enumSym ||
- target.compilerBootstrap(c))) {
+ (types.supertype(c.type).tsym == syms.enumSym)) {
// constructors of true enums are private
flags = (flags & ~AccessFlags) | PRIVATE | GENERATEDCONSTR;
} else
flags |= (c.flags() & AccessFlags) | GENERATEDCONSTR;
if (c.name.isEmpty()) flags |= ANONCONSTR;