47 import java.util.Map;
48 import java.util.Set;
49 import java.util.function.Supplier;
50
51 import jdk.internal.misc.JavaLangModuleAccess;
52 import jdk.internal.misc.SharedSecrets;
53
54 import static jdk.internal.module.ClassFileConstants.*;
55
56
57 /**
58 * Read module information from a {@code module-info} class file.
59 *
60 * @implNote The rationale for the hand-coded reader is startup performance
61 * and fine control over the throwing of InvalidModuleDescriptorException.
62 */
63
64 public final class ModuleInfo {
65
66 private final int JAVA_MIN_SUPPORTED_VERSION = 53;
67 private final int JAVA_MAX_SUPPORTED_VERSION = 55;
68
69 private static final JavaLangModuleAccess JLMA
70 = SharedSecrets.getJavaLangModuleAccess();
71
72 // supplies the set of packages when ModulePackages attribute not present
73 private final Supplier<Set<String>> packageFinder;
74
75 // indicates if the ModuleHashes attribute should be parsed
76 private final boolean parseHashes;
77
78 private ModuleInfo(Supplier<Set<String>> pf, boolean ph) {
79 packageFinder = pf;
80 parseHashes = ph;
81 }
82
83 private ModuleInfo(Supplier<Set<String>> pf) {
84 this(pf, true);
85 }
86
87 /**
|
47 import java.util.Map;
48 import java.util.Set;
49 import java.util.function.Supplier;
50
51 import jdk.internal.misc.JavaLangModuleAccess;
52 import jdk.internal.misc.SharedSecrets;
53
54 import static jdk.internal.module.ClassFileConstants.*;
55
56
57 /**
58 * Read module information from a {@code module-info} class file.
59 *
60 * @implNote The rationale for the hand-coded reader is startup performance
61 * and fine control over the throwing of InvalidModuleDescriptorException.
62 */
63
64 public final class ModuleInfo {
65
66 private final int JAVA_MIN_SUPPORTED_VERSION = 53;
67 private final int JAVA_MAX_SUPPORTED_VERSION = 56;
68
69 private static final JavaLangModuleAccess JLMA
70 = SharedSecrets.getJavaLangModuleAccess();
71
72 // supplies the set of packages when ModulePackages attribute not present
73 private final Supplier<Set<String>> packageFinder;
74
75 // indicates if the ModuleHashes attribute should be parsed
76 private final boolean parseHashes;
77
78 private ModuleInfo(Supplier<Set<String>> pf, boolean ph) {
79 packageFinder = pf;
80 parseHashes = ph;
81 }
82
83 private ModuleInfo(Supplier<Set<String>> pf) {
84 this(pf, true);
85 }
86
87 /**
|