1 /*
   2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.internal.module;
  27 
  28 import java.lang.module.ModuleDescriptor;
  29 
  30 /*
  31  * SystemModules class will be generated at link time to create
  32  * ModuleDescriptor for the system modules directly to improve
  33  * the module descriptor reconstitution time.
  34  *
  35  * This will skip parsing of module-info.class file and validating
  36  * names such as module name, package name, service and provider type names.
  37  * It also avoids taking a defensive copy of any collection.
  38  *
  39  * @see jdk.tools.jlink.internal.plugins.SystemModulesPlugin
  40  */
  41 public final class SystemModules {
  42     /**
  43      * Name of the system modules.
  44      *
  45      * This array provides a way for SystemModuleFinder to fallback
  46      * and read module-info.class from the run-time image instead of
  47      * the fastpath.
  48      */
  49     public static final String[] MODULE_NAMES = new String[0];
  50 
  51     /**
  52      * Number of packages in the boot layer from the installed modules.
  53      *
  54      * Don't make it final to avoid inlining during compile time as
  55      * the value will be changed at jlink time.
  56      */
  57     public static int PACKAGES_IN_BOOT_LAYER = 1024;
  58 
  59     /**
  60      * Returns a non-empty array of ModuleDescriptors in the run-time image.
  61      *
  62      * When running an exploded image it returns an empty array.
  63      */
  64     public static ModuleDescriptor[] descriptors() {
  65         throw new InternalError("expected to be overridden at link time");
  66     }
  67 
  68     /**
  69      * Returns a non-empty array of ModuleHashes recorded in each module
  70      * in the run-time image.
  71      *
  72      * When running an exploded image it returns an empty array.
  73      */
  74     public static ModuleHashes[] hashes() {
  75         throw new InternalError("expected to be overridden at link time");
  76     }
  77 
  78     /**
  79      * Returns a non-empty array of ModuleResolutions in the run-time image.
  80      */
  81     public static ModuleResolution[] moduleResolutions() {
  82         throw new InternalError("expected to be overridden at link time");
  83     }
  84 }