Skip to content

Commit

Permalink
Merge pull request #338 from ropalka/jdk11-cleanups
Browse files Browse the repository at this point in the history
Another round of not only Jdk11 related cleanups
  • Loading branch information
ropalka committed Mar 18, 2024
2 parents 7f88c96 + b24db7b commit 439c5e3
Show file tree
Hide file tree
Showing 13 changed files with 237 additions and 346 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/jboss/modules/ClassLoaderLocalLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
final class ClassLoaderLocalLoader implements LocalLoader {

static final LocalLoader SYSTEM = JDKSpecific.getSystemLocalLoader();
static final LocalLoader SYSTEM = Utils.getSystemLocalLoader();

private final ClassLoader classLoader;
private final AccessControlContext context;
Expand Down Expand Up @@ -78,7 +78,7 @@ public List<Resource> loadResourceLocal(final String name) {
ClassLoader classLoader = this.classLoader;
try {
if (classLoader == null) {
urls = JDKSpecific.getSystemResources(name);
urls = Utils.getSystemResources(name);
} else {
urls = classLoader.getResources(name);
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/jboss/modules/ConcurrentClassLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected ConcurrentClassLoader() {
* @param name the name of this class loader, or {@code null} if it is unnamed
*/
protected ConcurrentClassLoader(final ConcurrentClassLoader parent, final String name) {
super(parent == null ? JDKSpecific.getPlatformClassLoader() : parent, name);
super(parent == null ? Utils.getPlatformClassLoader() : parent, name);
if (! isRegisteredAsParallelCapable()) {
throw new Error("Cannot instantiate non-parallel subclass");
}
Expand All @@ -97,7 +97,7 @@ protected ConcurrentClassLoader(final ConcurrentClassLoader parent, final String
* @param name the name of this class loader, or {@code null} if it is unnamed
*/
protected ConcurrentClassLoader(String name) {
super(JDKSpecific.getPlatformClassLoader(), name);
super(Utils.getPlatformClassLoader(), name);
if (! isRegisteredAsParallelCapable()) {
throw new Error("Cannot instantiate non-parallel subclass");
}
Expand Down Expand Up @@ -247,7 +247,7 @@ protected final Class<?> findClass(final String moduleName, final String classNa
public final URL getResource(final String name) {
for (String s : Module.systemPaths) {
if (name.startsWith(s)) {
return JDKSpecific.getSystemResource(name);
return Utils.getSystemResource(name);
}
}
return findResource(name, false);
Expand All @@ -265,7 +265,7 @@ public final URL getResource(final String name) {
public final Enumeration<URL> getResources(final String name) throws IOException {
for (String s : Module.systemPaths) {
if (name.startsWith(s)) {
return JDKSpecific.getSystemResources(name);
return Utils.getSystemResources(name);
}
}
return findResources(name, false);
Expand Down Expand Up @@ -360,7 +360,7 @@ protected InputStream findResourceAsStream(final String name, final boolean expo
public final InputStream getResourceAsStream(final String name) {
for (String s : Module.systemPaths) {
if (name.startsWith(s)) {
return JDKSpecific.getSystemResourceAsStream(name);
return Utils.getSystemResourceAsStream(name);
}
}
return findResourceAsStream(name, false);
Expand Down Expand Up @@ -390,7 +390,7 @@ private Class<?> performLoadClass(String className, boolean exportsOnly, final b
}
for (String s : Module.systemPackages) {
if (className.startsWith(s)) {
return JDKSpecific.getSystemClass(this, className);
return Utils.getSystemClass(this, className);
}
}
return performLoadClassUnchecked(className, exportsOnly, resolve);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public ModuleSpec findModule(final String name, final ModuleLoader delegateLoade
fatModuleLoader = new DelegatingModuleLoader(baseModuleLoader, new LocalModuleFinder(new File[]{ path.resolve(MODULES_DIR).toFile() }));
} else {
// assume some kind of JAR file
final JarFile jarFile = JDKSpecific.getJarFile(path.toFile(), true);
final JarFile jarFile = new JarFile(path.toFile(), true, JarFile.OPEN_READ, JarFile.runtimeVersion());
try {
try {
manifest = jarFile.getManifest();
Expand Down
11 changes: 1 addition & 10 deletions src/main/java/org/jboss/modules/JDKModuleFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,7 @@ public ModuleSpec findModule(final String name, final ModuleLoader delegateLoade
if (module.isNamed()) {
packages = module.getPackages();
} else {
packages = Set.of(
"org.jboss.modules",
"org.jboss.modules.filter",
"org.jboss.modules.log",
"org.jboss.modules.management",
"org.jboss.modules.maven",
"org.jboss.modules.ref",
"org.jboss.modules.security",
"org.jboss.modules.xml"
);
packages = Utils.MODULES_PACKAGES;
}
} else {
final Optional<Module> moduleOptional = layer.findModule(name);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jboss/modules/JDKPaths.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class JDKPaths {
static final Set<String> JDK;

static {
final Set<String> pathSet = JDKSpecific.getJDKPaths();
final Set<String> pathSet = Utils.getJDKPaths();
if (pathSet.size() == 0) throw new IllegalStateException("Something went wrong with system paths set up");
JDK = Collections.unmodifiableSet(pathSet);
}
Expand Down
247 changes: 0 additions & 247 deletions src/main/java/org/jboss/modules/JDKSpecific.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/java/org/jboss/modules/JarModuleFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public ModuleSpec findModule(final String name, final ModuleLoader delegateLoade
// assume a JAR
JarFile childJarFile;
try {
childJarFile = JDKSpecific.getJarFile(root, true);
childJarFile = new JarFile(root, true, JarFile.OPEN_READ, JarFile.runtimeVersion());
} catch (IOException e) {
// ignore and continue
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jboss/modules/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ public static <T> Iterable<T> findServices(final Class<T> type, final Predicate<
if (loader == null) {
throw new IllegalArgumentException("loader is null");
}
return JDKSpecific.findServices(type, filter, loader);
return Utils.findServices(type, filter, loader);
}

static void initBootModuleLoader(ModuleLoader loader) {
Expand Down

0 comments on commit 439c5e3

Please sign in to comment.