diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java index fce442143c5e8..da469231ba265 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java @@ -478,8 +478,8 @@ public Set getProvidedResources() { } @Override - public ProtectionDomain getProtectionDomain(ClassLoader classLoader) { - return delegate.getProtectionDomain(classLoader); + public ProtectionDomain getProtectionDomain() { + return delegate.getProtectionDomain(); } @Override diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathElement.java index 26ade4b620f43..eefce68aa5f66 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathElement.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathElement.java @@ -65,7 +65,7 @@ default ArtifactKey getDependencyKey() { * * @return The protection domain that should be used to define classes from this element */ - ProtectionDomain getProtectionDomain(ClassLoader classLoader); + ProtectionDomain getProtectionDomain(); Manifest getManifest(); @@ -115,7 +115,7 @@ public Set getProvidedResources() { } @Override - public ProtectionDomain getProtectionDomain(ClassLoader classLoader) { + public ProtectionDomain getProtectionDomain() { return null; } diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java index ad71f5d817fab..ea78be461995f 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java @@ -160,7 +160,7 @@ public void accept(Path path) { } @Override - public ProtectionDomain getProtectionDomain(ClassLoader classLoader) { + public ProtectionDomain getProtectionDomain() { URL url = null; try { URI uri = root.toUri(); @@ -169,8 +169,7 @@ public ProtectionDomain getProtectionDomain(ClassLoader classLoader) { throw new RuntimeException("Unable to create protection domain for " + root, e); } CodeSource codesource = new CodeSource(url, (Certificate[]) null); - ProtectionDomain protectionDomain = new ProtectionDomain(codesource, null, classLoader, null); - return protectionDomain; + return new ProtectionDomain(codesource, null); } @Override diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/FilteredClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/FilteredClassPathElement.java index 5e362a7e27d33..a72fcee9259ff 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/FilteredClassPathElement.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/FilteredClassPathElement.java @@ -58,8 +58,8 @@ public Set getProvidedResources() { } @Override - public ProtectionDomain getProtectionDomain(ClassLoader classLoader) { - return delegate.getProtectionDomain(classLoader); + public ProtectionDomain getProtectionDomain() { + return delegate.getProtectionDomain(); } @Override diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/JarClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/JarClassPathElement.java index 4ffbabf05a7ae..1c2aad6399a03 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/JarClassPathElement.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/JarClassPathElement.java @@ -256,7 +256,7 @@ public Set apply(JarFile jarFile) { } @Override - public ProtectionDomain getProtectionDomain(ClassLoader classLoader) { + public ProtectionDomain getProtectionDomain() { final URL url; try { url = jarPath.toURI().toURL(); @@ -264,7 +264,7 @@ public ProtectionDomain getProtectionDomain(ClassLoader classLoader) { throw new RuntimeException("Unable to create protection domain for " + jarPath, e); } CodeSource codesource = new CodeSource(url, (Certificate[]) null); - return new ProtectionDomain(codesource, null, classLoader, null); + return new ProtectionDomain(codesource, null, null, null); } @Override diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java index 4458602ae5730..b77b6dbf18168 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java @@ -111,7 +111,7 @@ public Set getProvidedResources() { } @Override - public ProtectionDomain getProtectionDomain(ClassLoader classLoader) { + public ProtectionDomain getProtectionDomain() { URL url = null; try { url = new URL(null, "quarkus:/", new MemoryUrlStreamHandler("quarkus:/")); @@ -119,8 +119,7 @@ public ProtectionDomain getProtectionDomain(ClassLoader classLoader) { throw new RuntimeException("Unable to create protection domain for memory element", e); } CodeSource codesource = new CodeSource(url, (Certificate[]) null); - ProtectionDomain protectionDomain = new ProtectionDomain(codesource, null, classLoader, null); - return protectionDomain; + return new ProtectionDomain(codesource, null); } @Override diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/PathTreeClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/PathTreeClassPathElement.java index cba6b34e0c08b..6f05de1707e71 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/PathTreeClassPathElement.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/PathTreeClassPathElement.java @@ -159,7 +159,7 @@ protected Manifest readManifest() { } @Override - public ProtectionDomain getProtectionDomain(ClassLoader classLoader) { + public ProtectionDomain getProtectionDomain() { URL url = null; final Path root = getRoot(); try { @@ -168,8 +168,7 @@ public ProtectionDomain getProtectionDomain(ClassLoader classLoader) { throw new RuntimeException("Unable to create protection domain for " + root, e); } CodeSource codesource = new CodeSource(url, (Certificate[]) null); - ProtectionDomain protectionDomain = new ProtectionDomain(codesource, null, classLoader, null); - return protectionDomain; + return new ProtectionDomain(codesource, null); } @Override diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java index bc2323fb2c056..e1b20fe85d657 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java @@ -506,7 +506,7 @@ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundE byte[] data = classPathElementResource.getData(); definePackage(name, classPathElement); Class cl = defineClass(name, data, 0, data.length, - protectionDomains.computeIfAbsent(classPathElement, (ce) -> ce.getProtectionDomain(this))); + protectionDomains.computeIfAbsent(classPathElement, ClassPathElement::getProtectionDomain)); if (Driver.class.isAssignableFrom(cl)) { driverLoaded = true; } diff --git a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/ClassLoadingResource.java b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/ClassLoadingResource.java index 58bae161452b2..a6a2540601a2d 100644 --- a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/ClassLoadingResource.java +++ b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/ClassLoadingResource.java @@ -9,7 +9,7 @@ public interface ClassLoadingResource { * A lifecycle hook that should be called when the ClassLoader to which this resource belongs to * is constructed */ - void init(ClassLoader runnerClassLoader); + void init(); byte[] getResourceData(String resource); diff --git a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/JarResource.java b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/JarResource.java index 0a8ff83203eb3..6b8a6117414f3 100644 --- a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/JarResource.java +++ b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/JarResource.java @@ -52,7 +52,7 @@ public JarResource(ManifestInfo manifestInfo, Path jarPath) { } @Override - public void init(ClassLoader runnerClassLoader) { + public void init() { final URL url; try { String path = jarPath.toAbsolutePath().toString(); @@ -64,7 +64,7 @@ public void init(ClassLoader runnerClassLoader) { } catch (URISyntaxException | MalformedURLException e) { throw new RuntimeException("Unable to create protection domain for " + jarPath, e); } - this.protectionDomain = new ProtectionDomain(new CodeSource(url, (Certificate[]) null), null, runnerClassLoader, null); + this.protectionDomain = new ProtectionDomain(new CodeSource(url, (Certificate[]) null), null); } @Override diff --git a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/SerializedApplication.java b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/SerializedApplication.java index fab316850bd73..1ba0a0fbbaf12 100644 --- a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/SerializedApplication.java +++ b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/SerializedApplication.java @@ -162,7 +162,7 @@ public static SerializedApplication read(InputStream inputStream, Path appRoot) resourceDirectoryTracker.getResult(), parentFirstPackages, nonExistentResources, FULLY_INDEXED_PATHS, directlyIndexedResourcesIndexMap); for (ClassLoadingResource classLoadingResource : allClassLoadingResources) { - classLoadingResource.init(runnerClassLoader); + classLoadingResource.init(); } return new SerializedApplication(runnerClassLoader, mainClass); }