< prev index next >

src/java.base/share/classes/java/lang/invoke/ClassSpecializer.java

Print this page




 442                 if (!topClassIsSuper) {
 443                     throw newInternalError("must override if the top class cannot serve as a super class");
 444                 }
 445             }
 446             return topc;
 447         }
 448     }
 449 
 450     protected abstract S newSpeciesData(K key);
 451 
 452     protected K topSpeciesKey() {
 453         return null;  // null means don't report a top species
 454     }
 455 
 456     /**
 457      * Code generation support for instances.
 458      * Subclasses can modify the behavior.
 459      */
 460     public class Factory {
 461         /**





 462          * Get a concrete subclass of the top class for a given combination of bound types.
 463          *
 464          * @param speciesData the species requiring the class, not yet linked
 465          * @return a linked version of the same species
 466          */
 467         S loadSpecies(S speciesData) {
 468             String className = speciesData.deriveClassName();
 469             assert(className.indexOf('/') < 0) : className;
 470             Class<?> salvage = null;
 471             try {
 472                 salvage = BootLoader.loadClassOrNull(className);
 473                 if (TRACE_RESOLVE && salvage != null) {
 474                     // Used by jlink species pregeneration plugin, see
 475                     // jdk.tools.jlink.internal.plugins.GenerateJLIClassesPlugin
 476                     System.out.println("[SPECIES_RESOLVE] " + className + " (salvaged)");
 477                 }
 478             } catch (Error ex) {
 479                 if (TRACE_RESOLVE) {
 480                     System.out.println("[SPECIES_FRESOLVE] " + className + " (Error) " + ex.getMessage());
 481                 }




 442                 if (!topClassIsSuper) {
 443                     throw newInternalError("must override if the top class cannot serve as a super class");
 444                 }
 445             }
 446             return topc;
 447         }
 448     }
 449 
 450     protected abstract S newSpeciesData(K key);
 451 
 452     protected K topSpeciesKey() {
 453         return null;  // null means don't report a top species
 454     }
 455 
 456     /**
 457      * Code generation support for instances.
 458      * Subclasses can modify the behavior.
 459      */
 460     public class Factory {
 461         /**
 462          * Construct a factory.
 463          */
 464         Factory() {}
 465 
 466         /**
 467          * Get a concrete subclass of the top class for a given combination of bound types.
 468          *
 469          * @param speciesData the species requiring the class, not yet linked
 470          * @return a linked version of the same species
 471          */
 472         S loadSpecies(S speciesData) {
 473             String className = speciesData.deriveClassName();
 474             assert(className.indexOf('/') < 0) : className;
 475             Class<?> salvage = null;
 476             try {
 477                 salvage = BootLoader.loadClassOrNull(className);
 478                 if (TRACE_RESOLVE && salvage != null) {
 479                     // Used by jlink species pregeneration plugin, see
 480                     // jdk.tools.jlink.internal.plugins.GenerateJLIClassesPlugin
 481                     System.out.println("[SPECIES_RESOLVE] " + className + " (salvaged)");
 482                 }
 483             } catch (Error ex) {
 484                 if (TRACE_RESOLVE) {
 485                     System.out.println("[SPECIES_FRESOLVE] " + className + " (Error) " + ex.getMessage());
 486                 }


< prev index next >