< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/PoolWriter.java

Print this page
*** 49,13 ***
--- 49,15 ---
  
  import java.io.IOException;
  import java.io.OutputStream;
  import java.util.ArrayDeque;
  import java.util.HashMap;
+ import java.util.HashSet;
  import java.util.LinkedHashMap;
  import java.util.LinkedHashSet;
  import java.util.Map;
+ import java.util.Set;
  
  import static com.sun.tools.javac.code.Kinds.Kind.TYP;
  import static com.sun.tools.javac.code.TypeTag.ARRAY;
  import static com.sun.tools.javac.code.TypeTag.CLASS;
  import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Class;

*** 92,10 ***
--- 94,12 ---
      final SharedSignatureGenerator signatureGen;
  
      /** The inner classes to be written, as an ordered set (enclosing first). */
      LinkedHashSet<ClassSymbol> innerClasses = new LinkedHashSet<>();
  
+     Set<ClassSymbol> preloadClasses = new HashSet<>();
+ 
      /** The list of entries in the BootstrapMethods attribute. */
      Map<BsmKey, Integer> bootstrapMethods = new LinkedHashMap<>();
  
      public PoolWriter(Types types, Names names) {
          this.types = types;

*** 230,10 ***
--- 234,20 ---
              enterInner(c.owner.enclClass());
              innerClasses.add(c);
          }
      }
  
+     /** Enter a value class into the `preloadClasses' set.
+      */
+     void enterPreloadClass(ClassSymbol c) {
+         if (c.type.isCompound()) {
+             throw new AssertionError("Unexpected intersection type: " + c.type);
+         }
+         c.complete();
+         preloadClasses.add(c);
+     }
+ 
      /**
       * Create a new Utf8 entry representing a descriptor for given (member) symbol.
       */
      private Type descriptorType(Symbol s) {
          return s.kind == Kind.MTH ? s.externalType(types) : s.erasure(types);

*** 510,9 ***
--- 524,10 ---
          return signatureGen.toName();
      }
  
      void reset() {
          innerClasses.clear();
+         preloadClasses.clear();
          bootstrapMethods.clear();
          pool.reset();
      }
  }
< prev index next >