changeset 2014:7dce985a1464

Add support for class-based metafactory bridging Todo: we need to migrate from class-based calculation to type-based calculation.
author mcimadamore
date Mon, 22 Apr 2013 16:59:05 +0100
parents 9ed0fc56586e
children 472273f5522d
files src/share/classes/com/sun/tools/javac/code/Types.java src/share/classes/com/sun/tools/javac/comp/TransTypes.java
diffstat 2 files changed, 218 insertions(+), 197 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/code/Types.java	Mon Apr 22 14:14:03 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Mon Apr 22 16:59:05 2013 +0100
@@ -35,6 +35,7 @@
 import java.util.WeakHashMap;
 
 import javax.lang.model.type.TypeKind;
+import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.code.Attribute.RetentionPolicy;
 import com.sun.tools.javac.code.Lint.LintCategory;
@@ -347,9 +348,11 @@
 
         class FunctionDescriptor {
             Symbol descSym;
-
-            FunctionDescriptor(Symbol descSym) {
+            List<Symbol> descOverrides;
+
+            FunctionDescriptor(Symbol descSym, TypeSymbol origin) {
                 this.descSym = descSym;
+                descOverrides = descOverrides(origin);
             }
 
             public Symbol getSymbol() {
@@ -365,6 +368,36 @@
                 }
                 return memberType(site, descSym);
             }
+            
+            public List<Symbol> descOverrides(TypeSymbol origin) {
+                Symbol newDesc =
+                        new MethodSymbol(descSym.flags_field, descSym.name, memberType(origin.type, descSym), origin);
+                CompoundScope members = membersClosure(origin.type, false);
+                ListBuffer<Symbol> overridden = ListBuffer.lb();
+                outer: for (Symbol m2 : members.getElementsByName(newDesc.name, bridgeFilter)) {
+                    if (newDesc.overrides(m2, origin, Types.this, false)) {
+                        for (Symbol m3 : overridden) {
+                            if (isSameType(m3.erasure(Types.this), m2.erasure(Types.this)) ||
+                                    (m3.overrides(m2, origin, Types.this, false) &&
+                                    ((((ClassSymbol)m3.owner).sourcefile.getKind() == JavaFileObject.Kind.SOURCE) ||
+                                    (((MethodSymbol)m2).binaryImplementation((ClassSymbol)m3.owner, Types.this) != null)))) {
+                                continue outer;
+                            }
+                        }
+                        overridden.add(m2);
+                    }
+                }
+                return overridden.toList();
+            }
+            //where
+                private Filter<Symbol> bridgeFilter = new Filter<Symbol>() {
+                    public boolean accepts(Symbol t) {
+                        return t.kind == Kinds.MTH &&
+                                t.name != names.init &&
+                                t.name != names.clinit &&
+                                (t.flags() & SYNTHETIC) == 0;
+                    }
+                };
         }
 
         class Entry {
@@ -423,7 +456,7 @@
                 throw failure("not.a.functional.intf.1", origin,
                             diags.fragment("no.abstracts", Kinds.kindName(origin), origin));
             } else if (abstracts.size() == 1) {
-                return new FunctionDescriptor(abstracts.first());
+                return new FunctionDescriptor(abstracts.first(), origin);
             } else { // size > 1
                 FunctionDescriptor descRes = mergeDescriptors(origin, abstracts.toList());
                 if (descRes == null) {
@@ -508,7 +541,7 @@
             }
 
             final List<Type> thrown1 = thrown;
-            return new FunctionDescriptor(bestSoFar) {
+            return new FunctionDescriptor(bestSoFar, origin) {
                 @Override
                 public Type getType(Type origin) {
                     Type mt = memberType(origin, getSymbol());
@@ -549,6 +582,15 @@
     public Type findDescriptorType(Type origin) throws FunctionDescriptorLookupError {
         return descCache.get(origin.tsym).getType(origin);
     }
+    
+    /**
+     * Find the minimal set of methods that are overridden by the functional
+     * descriptor in 'origin'. All returned methods are assumed to have different
+     * erased signatures.
+     */
+    public List<Symbol> findDescriptorOverrides(TypeSymbol origin) throws FunctionDescriptorLookupError {
+        return descCache.get(origin).descOverrides;
+    }
 
     /**
      * Is given type a functional interface?
@@ -2908,6 +2950,17 @@
      *  changing all recursive bounds from old to new list.
      */
     public List<Type> newInstances(List<Type> tvars) {
+        return newInstances(tvars, identityNewInstanceFun);
+    }
+    //where
+        private NewInstanceFun identityNewInstanceFun = new NewInstanceFun() {
+            @Override
+            public TypeSymbol tsym(TypeSymbol tsym, Type newType) {
+                return tsym;
+            }
+        };
+    
+    public List<Type> newInstances(List<Type> tvars, NewInstanceFun newInstanceFun) {
         List<Type> tvars1 = Type.map(tvars, newInstanceFun);
         for (List<Type> l = tvars1; l.nonEmpty(); l = l.tail) {
             TypeVar tv = (TypeVar) l.head;
@@ -2915,9 +2968,20 @@
         }
         return tvars1;
     }
-    private static final Mapping newInstanceFun = new Mapping("newInstanceFun") {
-            public Type apply(Type t) { return new TypeVar(t.tsym, t.getUpperBound(), t.getLowerBound()); }
-        };
+    
+    public static abstract class NewInstanceFun extends Mapping {
+        public NewInstanceFun() {
+            super("newInstanceFun");
+        }
+
+        public Type apply(Type t) {
+            TypeVar tv = new TypeVar(null, t.getUpperBound(), t.getLowerBound());
+            tv.tsym = tsym(t.tsym, t);
+            return tv;
+        }
+
+        public abstract TypeSymbol tsym(TypeSymbol tsym, Type newType);
+    }
     // </editor-fold>
 
     public Type createMethodTypeWithParameters(Type original, List<Type> newParams) {
--- a/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Mon Apr 22 14:14:03 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Mon Apr 22 16:59:05 2013 +0100
@@ -29,6 +29,7 @@
 
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.code.Type.ForAll;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.*;
@@ -38,6 +39,7 @@
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.*;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
+import static com.sun.tools.javac.code.TypeTag.FORALL;
 import static com.sun.tools.javac.code.TypeTag.TYPEVAR;
 import static com.sun.tools.javac.code.TypeTag.VOID;
 
@@ -242,15 +244,15 @@
                    MethodSymbol impl,
                    ClassSymbol origin,
                    boolean hypothetical,
-                   ListBuffer<JCTree> bridges,
-                   Bridger bridger) {
+                   ListBuffer<JCTree> bridges) {
         make.at(pos);
         Type origType = types.memberType(origin.type, meth);
         Type origErasure = erasure(origType);
 
         // Create a bridge method symbol and a bridge definition without a body.
         Type bridgeType = meth.erasure(types);
-        long flags = impl.flags() & AccessFlags | SYNTHETIC | BRIDGE | bridger.bridgeFlags();
+        long flags = impl.flags() & AccessFlags | SYNTHETIC | BRIDGE |
+                (origin.isInterface() ? DEFAULT : 0);
         if (hypothetical) flags |= HYPOTHETICAL;
         MethodSymbol bridge = new MethodSymbol(flags,
                                                meth.name,
@@ -311,8 +313,7 @@
     void addBridgeIfNeeded(DiagnosticPosition pos,
                            Symbol sym,
                            ClassSymbol origin,
-                           ListBuffer<JCTree> bridges,
-                           Bridger bridger) {
+                           ListBuffer<JCTree> bridges) {
         if (sym.kind == MTH &&
             sym.name != names.init &&
             (sym.flags() & (PRIVATE | STATIC)) == 0 &&
@@ -320,14 +321,14 @@
             sym.isMemberOf(origin, types))
         {
             MethodSymbol meth = (MethodSymbol)sym;
-            MethodSymbol bridge = bridger.binaryImplementation(meth, origin);
-            MethodSymbol impl = bridger.implementation(meth, origin);
+            MethodSymbol bridge = meth.binaryImplementation(origin, types);
+            MethodSymbol impl = meth.implementation(origin, types, true, overrideBridgeFilter);
             if (bridge == null ||
                 bridge == meth ||
                 (impl != null && !bridge.owner.isSubClass(impl.owner, types))) {
                 // No bridge was added yet.
                 if (impl != null && isBridgeNeeded(meth, impl, origin.type)) {
-                    addBridge(pos, meth, impl, origin, bridge==impl, bridges, bridger);
+                    addBridge(pos, meth, impl, origin, bridge==impl, bridges);
                 } else if (impl == meth
                            && impl.owner != origin
                            && (impl.flags() & FINAL) == 0
@@ -335,7 +336,7 @@
                            && (origin.flags() & PUBLIC) > (impl.owner.flags() & PUBLIC)) {
                     // this is to work around a horrible but permanent
                     // reflection design error.
-                    addBridge(pos, meth, impl, origin, false, bridges, bridger);
+                    addBridge(pos, meth, impl, origin, false, bridges);
                 }
             } else if (!allowInterfaceBridges) {
                 //close gaps left open during type-checking
@@ -363,6 +364,12 @@
         }
     }
     // where
+        private Filter<Symbol> overrideBridgeFilter = new Filter<Symbol>() {
+            public boolean accepts(Symbol s) {
+                return (s.flags() & (SYNTHETIC | OVERRIDE_BRIDGE)) != SYNTHETIC;
+            }
+        };
+
         /**
          * @param method The symbol for which a bridge might have to be added
          * @param impl The implementation of method
@@ -416,12 +423,11 @@
     void addBridges(DiagnosticPosition pos,
                     TypeSymbol i,
                     ClassSymbol origin,
-                    ListBuffer<JCTree> bridges,
-                    Bridger bridger) {
+                    ListBuffer<JCTree> bridges) {
         for (Scope.Entry e = i.members().elems; e != null; e = e.sibling)
-            addBridgeIfNeeded(pos, e.sym, origin, bridges, bridger);
+            addBridgeIfNeeded(pos, e.sym, origin, bridges);
         for (List<Type> l = types.interfaces(i.type); l.nonEmpty(); l = l.tail)
-            addBridges(pos, l.head.tsym, origin, bridges, bridger);
+            addBridges(pos, l.head.tsym, origin, bridges);
     }
 
     /** Add all necessary bridges to some class appending them to list buffer.
@@ -429,16 +435,16 @@
      *  @param origin  The class in which the bridges go.
      *  @param bridges The list buffer to which the bridges are added.
      */
-    void addBridges(DiagnosticPosition pos, ClassSymbol origin, ListBuffer<JCTree> bridges, Bridger bridger) {
+    void addBridges(DiagnosticPosition pos, ClassSymbol origin, ListBuffer<JCTree> bridges) {
         Type st = types.supertype(origin.type);
         while (st.hasTag(CLASS)) {
 //          if (isSpecialization(st))
-            addBridges(pos, st.tsym, origin, bridges, bridger);
+            addBridges(pos, st.tsym, origin, bridges);
             st = types.supertype(st);
         }
         for (List<Type> l = types.interfaces(origin.type); l.nonEmpty(); l = l.tail)
 //          if (isSpecialization(l.head))
-            addBridges(pos, l.head.tsym, origin, bridges, bridger);
+            addBridges(pos, l.head.tsym, origin, bridges);
     }
 
 /* ************************************************************************
@@ -448,6 +454,10 @@
     /** Visitor argument: proto-type.
      */
     private Type pt;
+    
+    /** Visitor argument: additional synthetic functional interfaces.
+     */
+    private List<JCTree> bridgedFunctionalInterfaces;
 
     /** Visitor method: perform a type translation on tree.
      */
@@ -556,12 +566,99 @@
             tree.params = translate(tree.params);
             tree.body = translate(tree.body, null);
             tree.type = erasure(tree.type);
+            bridgeFunctionalInfoIfNeeded(tree);
             result = tree;
         }
         finally {
             currentMethod = prevMethod;
         }
     }
+    
+    /**
+     * Replace target type info associated with a functional expression if the
+     * target type requires bridging. If the functional descriptor requires one
+     * or more bridges, a synthetic interface is generated containing all required
+     * bridges.
+     */
+    private void bridgeFunctionalInfoIfNeeded(JCTree.JCFunctionalExpression funcExpr) {
+        if (!allowInterfaceBridges ||
+                types.findDescriptorOverrides(funcExpr.targets.head).length() <= 1) return;
+        Assert.error("cant get here? " + funcExpr.targets.head);
+        //create synthetic interface symbol
+        long cflags = INTERFACE | ABSTRACT;
+        ClassSymbol csym = new ClassSymbol(cflags, syntheticBridgedInterfaceName(),
+                env.enclClass.sym.outermostClass());
+        //compute new type arguments
+        List<Type> formalTypeParameters = List.nil();
+        for (TypeSymbol tsym : funcExpr.targets) {
+            formalTypeParameters =
+                    formalTypeParameters.appendList(tsym.type.getTypeArguments());
+        }
+        List<Type> newTypeParameters = types.newInstances(formalTypeParameters,
+                new NewOwnerInstanceFun(csym));
+        Type.ClassType ctype = new Type.ClassType(Type.noType, newTypeParameters, csym);
+        ListBuffer<Type> newInterfaces = ListBuffer.lb();
+        for (TypeSymbol tsym : funcExpr.targets) {
+            newInterfaces.append(types.subst(tsym.type, formalTypeParameters, newTypeParameters));
+        }
+        //compute supertypes
+        ctype.supertype_field = syms.objectType;
+        ctype.interfaces_field = newInterfaces.toList();
+        csym.type = ctype;
+        //fill in scope
+        csym.members_field = new Scope(csym);
+        MethodSymbol funcDescSym = (MethodSymbol)types.findDescriptorSymbol(funcExpr.targets.head);
+        final MethodSymbol newDescSym = new MethodSymbol(funcDescSym.flags(), funcDescSym.name, null, csym);
+        Type newDescType = types.subst(types.memberType(funcExpr.targets.head.type, funcDescSym),
+                formalTypeParameters, newTypeParameters);
+        if (funcExpr.descriptorType.hasTag(FORALL)) {
+            ForAll fa = (ForAll)funcExpr.descriptorType;
+            List<Type> newMethodTypeParameters =
+                    types.newInstances(fa.tvars, new NewOwnerInstanceFun(newDescSym));
+            newDescType = new Type.ForAll(newMethodTypeParameters,
+                    types.subst(newDescType.asMethodType(), fa.tvars, newMethodTypeParameters));
+        }
+        newDescSym.type = newDescType;
+        csym.members_field.enter(newDescSym);
+        //finish up symbol
+        csym.sourcefile = env.enclClass.sym.outermostClass().sourcefile;
+        csym.completer = null;
+        //create an interface def
+        JCClassDecl idecl = make.ClassDef(make.Modifiers(cflags),
+                csym.name, make.TypeParams(newTypeParameters), null,
+                make.Types(types.interfaces(csym.type)), null);
+        idecl.sym = csym;
+        idecl.type = csym.type;
+        //create method def
+        JCMethodDecl imeth = make.MethodDef(newDescSym, null);
+        idecl.defs = List.<JCTree>of(imeth);
+        //compute bridges and analyze results
+        translateClass(idecl);
+        //add synthetic interface to enclosing class scope
+        env.enclClass.sym.outermostClass().members().enter(csym);
+        bridgedFunctionalInterfaces = bridgedFunctionalInterfaces.prepend(idecl);
+        //update functional info
+        funcExpr.descriptorType = types.findDescriptorType(csym.type);
+        funcExpr.targets = List.<TypeSymbol>of(csym);
+        funcExpr.type = csym.type;
+    }
+    //where
+        private class NewOwnerInstanceFun extends Types.NewInstanceFun {
+            Symbol newOwner;
+
+            NewOwnerInstanceFun(Symbol newOwner) {
+                this.newOwner = newOwner;
+            }
+
+            @Override
+            public TypeSymbol tsym(TypeSymbol tsym, Type newType) {
+                return new TypeSymbol(0, tsym.name, newType, newOwner);
+            }
+        }
+
+        private Name syntheticBridgedInterfaceName() {
+            return names.fromString("I$" + bridgedFunctionalInterfaces.length());
+        }
 
     public void visitSwitch(JCSwitch tree) {
         Type selsuper = types.supertype(tree.selector.type);
@@ -799,6 +896,7 @@
     public void visitReference(JCMemberReference tree) {
         tree.expr = translate(tree.expr, null);
         tree.type = erasure(tree.type);
+        bridgeFunctionalInfoIfNeeded(tree);
         result = tree;
     }
 
@@ -933,186 +1031,45 @@
         try {
             env = myEnv;
             // class has not been translated yet
-
-            TreeMaker savedMake = make;
-            Type savedPt = pt;
-            make = make.forToplevel(env.toplevel);
-            pt = null;
-            try {
-                JCClassDecl tree = (JCClassDecl) env.tree;
-                tree.typarams = List.nil();
-                super.visitClassDef(tree);
-                make.at(tree.pos);
-                if (addBridges) {
-                    ListBuffer<JCTree> bridges = new ListBuffer<JCTree>();
-                    if (false) //see CR: 6996415
-                        bridges.appendList(addOverrideBridgesIfNeeded(tree, c));
-                    boolean bridgeInterface = (tree.sym.flags() & INTERFACE) != 0;
-                    if (!bridgeInterface || allowInterfaceBridges) {
-                        addBridges(tree.pos(), tree.sym, bridges,
-                            bridgeInterface ? interfaceBridger : classBridger);
-                    }
-                    tree.defs = bridges.toList().prependList(tree.defs);
-                }
-                tree.type = erasure(tree.type);
-            } finally {
-                make = savedMake;
-                pt = savedPt;
-            }
+            translateClass((JCClassDecl)env.tree);
         } finally {
             env = oldEnv;
         }
     }
     
-    /**
-     * This is an helper object is used by the bridge generation logic routine.
-     */
-    interface Bridger {
-        /**
-         * Is there another method in the class hierarchy induced by {@code origin}
-         * that is binary equivalent with a given method {@code m)?
-         */
-        MethodSymbol binaryImplementation(MethodSymbol m, ClassSymbol origin);
-        /**
-         * Is a given method {@code m) overridden in the class hierarchy induced
-         * by {@code origin} ?
-         */
-        MethodSymbol implementation(MethodSymbol m, ClassSymbol origin);
-        /**
-         * What are the flags that should be appended to the bridge method?
-         */
-        public long bridgeFlags();
+    void translateClass(JCClassDecl tree) {
+        TreeMaker savedMake = make;
+        Type savedPt = pt;
+        List<JCTree> savedBridgedFunctionalInterfaces =
+                bridgedFunctionalInterfaces;
+        make = make.forToplevel(env.toplevel);
+        pt = null;
+        if (tree.sym.outermostClass() == tree.sym) {
+            bridgedFunctionalInterfaces = List.nil();
+        }
+        try {
+            tree.typarams = List.nil();
+            super.visitClassDef(tree);
+            make.at(tree.pos);
+            if (addBridges) {
+                ListBuffer<JCTree> bridges = new ListBuffer<JCTree>();
+                if (false) //see CR: 6996415
+                    bridges.appendList(addOverrideBridgesIfNeeded(tree, tree.sym));
+                if (allowInterfaceBridges || (tree.sym.flags() & INTERFACE) == 0) {
+                    addBridges(tree.pos(), tree.sym, bridges);
+                }
+                tree.defs = bridges.toList().prependList(tree.defs);
+            }
+            if (tree.sym.outermostClass() == tree.sym) {
+                tree.defs = tree.defs.appendList(bridgedFunctionalInterfaces);
+            }
+            tree.type = erasure(tree.type);
+        } finally {
+            make = savedMake;
+            pt = savedPt;
+            bridgedFunctionalInterfaces = savedBridgedFunctionalInterfaces;
+        }
     }
-    
-    /**
-     * This is the standard bridge helper class for class hierarchies.
-     */
-    Bridger classBridger = new Bridger() {
-        @Override
-        public MethodSymbol binaryImplementation(MethodSymbol m, ClassSymbol origin) {
-            return m.binaryImplementation(origin, types);
-        }
-
-        @Override
-        public MethodSymbol implementation(MethodSymbol m, ClassSymbol origin) {
-            return types.implementation(m, origin, true, overrideBridgeFilter);
-        }
-        //where
-            private Filter<Symbol> overrideBridgeFilter = new Filter<Symbol>() {
-                public boolean accepts(Symbol s) {
-                    return (s.flags() & (SYNTHETIC | OVERRIDE_BRIDGE)) != SYNTHETIC;
-                }
-            };
-        
-        @Override
-        public long bridgeFlags() {
-            return 0;
-        }
-    };
-        
-    /**
-     * This is an alternate bridge helper class that is used in order to bridge
-     * interface hierarchies.
-     */
-    Bridger interfaceBridger = new Bridger() {
-        @Override
-        public MethodSymbol binaryImplementation(MethodSymbol m, ClassSymbol origin) {
-            ClassSymbol fakeOrigin = makeSyntheticClass(origin);
-            return base(classBridger.binaryImplementation(m, fakeOrigin));
-        }
-
-        @Override
-        public MethodSymbol implementation(MethodSymbol m, ClassSymbol origin) {
-            ClassSymbol fakeOrigin = makeSyntheticClass(origin);
-            return base(classBridger.implementation(m, fakeOrigin));
-        }
-        
-        public long bridgeFlags() {
-            return DEFAULT | ABSTRACT;
-        }
-        
-        /**
-         * Get base symbol for a given method symbol (if other than null)
-         */
-        private MethodSymbol base(MethodSymbol s) {
-            return s == null ? null : (MethodSymbol)s.baseSymbol();
-        }
-        
-        /**
-         * Creates a synthetic abstract class from interface if needed (see below).
-         * This step is required to allow bridge calculation logic to work uniformly
-         * on interfaces.
-         */
-        private ClassSymbol makeSyntheticClass(ClassSymbol origin) {
-            Entry _e = syntheticClasses.get(origin);
-            Scope.CompoundScope cs = types.membersClosure(origin.type, false);
-            if (_e == null || !_e.isValid(cs.getMark())) {
-                ClassSymbol csym = makeSyntheticClassInternal(origin);
-                syntheticClasses.put(origin, new Entry(csym, cs.getMark()));
-                return csym;
-            } else {
-                return _e.csym;
-            }
-        }
-        
-        /**
-         * Creates a synthetic abstract class from a given interface. The synthetic
-         * abstract class will contain all the method symbols defined in the original
-         * interface. Those symbols will be copied over as new symbols which will
-         * point back to the original symbols using {@code Symbol.baseSymbol}.
-         */
-        private ClassSymbol makeSyntheticClassInternal(ClassSymbol origin) {
-            long cflags = (origin.flags() & ~INTERFACE) | STATIC | ABSTRACT | PUBLIC;
-            ClassSymbol csym = new ClassSymbol(cflags, origin.name, origin.owner);
-            csym.completer = null;
-            csym.members_field = new Scope(csym);
-            for (Symbol s : origin.members().getElements(new Filter<Symbol>() {
-                public boolean accepts(Symbol t) {
-                    //all interface methods can be bridged
-                    return t.kind == MTH;
-                }
-            })) {
-                final MethodSymbol msym = (MethodSymbol)s;
-                long mflags = msym.flags() & ~DEFAULT;
-                csym.members_field.enter(new MethodSymbol(mflags, msym.name, msym.type, csym) {
-                    @Override
-                    public Symbol baseSymbol() {
-                        return msym;
-                    }
-                });
-            }
-            Type.ClassType ctype = new Type.ClassType(origin.type.getEnclosingType(), origin.type.getTypeArguments(), csym);
-            ctype.supertype_field = syms.objectType;
-            ctype.interfaces_field = types.interfaces(origin.type);
-            csym.type = ctype;
-            return csym;
-        }
-        
-        /**
-         * Entry used to cache synthetic classes generated by this bridger object.
-         * An entry is characterized by a mark which is used to tell as to whether
-         * the synthetic class needs to be recalculated (this can happen if
-         * the original interface scope has changed between subsequent
-         * bridge calculations).
-         */
-        class Entry {
-            ClassSymbol csym;
-            int mark;
-
-            Entry(ClassSymbol csym, int mark) {
-                this.csym = csym;
-                this.mark = mark;
-            }
-            
-            boolean isValid(int mark) {
-                return mark == this.mark;
-            }
-        }
-        
-        /** Synthetic abstract class cache */
-        private WeakHashMap<ClassSymbol, Entry> syntheticClasses =
-                new WeakHashMap<ClassSymbol, Entry>();
-    };
 
     /** Translate a toplevel class definition.
      *  @param cdef    The definition to be translated.