MCPcopy Index your code
hub / github.com/classgraph/classgraph / ModuleRef

Class ModuleRef

src/main/java/io/github/classgraph/ModuleRef.java:42–318  ·  view source on GitHub ↗

A ModuleReference proxy, written using reflection to preserve backwards compatibility with JDK 7 and 8.

Source from the content-addressed store, hash-verified

40
41/** A ModuleReference proxy, written using reflection to preserve backwards compatibility with JDK 7 and 8. */
42public class ModuleRef implements Comparable<ModuleRef> {
43 /** The name of the module. */
44 private final String name;
45
46 /** The ModuleReference for the module. */
47 private final Object reference;
48
49 /** The ModuleLayer for the module. */
50 private final Object layer;
51
52 /** The ModuleDescriptor for the module. */
53 private final Object descriptor;
54
55 /** The packages in the module. */
56 private final List<String> packages;
57
58 /** The location URI for the module (may be null). */
59 private final URI location;
60
61 /** The location URI for the module, as a cached string (may be null). */
62 private String locationStr;
63
64 /** A file formed from the location URI. The file will not exist if the location URI is a "jrt:" URI. */
65 private File locationFile;
66
67 /** The raw module version, or null if none. */
68 private String rawVersion;
69
70 /** The ClassLoader that loads classes in the module. May be null, to represent the bootstrap classloader. */
71 private final ClassLoader classLoader;
72
73 ReflectionUtils reflectionUtils;
74
75 /**
76 * Constructor.
77 *
78 * @param moduleReference
79 * The module reference, of JPMS type ModuleReference.
80 * @param moduleLayer
81 * The module layer, of JPMS type ModuleLayer
82 * @param reflectionUtils
83 * The ReflectionUtils instance.
84 */
85 public ModuleRef(final Object moduleReference, final Object moduleLayer,
86 final ReflectionUtils reflectionUtils) {
87 if (moduleReference == null) {
88 throw new IllegalArgumentException("moduleReference cannot be null");
89 }
90 if (moduleLayer == null) {
91 throw new IllegalArgumentException("moduleLayer cannot be null");
92 }
93 this.reference = moduleReference;
94 this.layer = moduleLayer;
95 this.reflectionUtils = reflectionUtils;
96
97 this.descriptor = reflectionUtils.invokeMethod(/* throwException = */ true, moduleReference, "descriptor");
98 if (this.descriptor == null) {
99 // Should not happen

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…