Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ClassLoader hacks for JDK 8 now that we've moved to Java 11 #16614

Merged
merged 1 commit into from
Apr 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class QuarkusClassLoader extends ClassLoader implements Closeable {
private volatile boolean driverLoaded;

private QuarkusClassLoader(Builder builder) {
super(new GetPackageBlockingClassLoader(builder.parent));
super(builder.parent);
this.name = builder.name;
this.elements = builder.elements;
this.bannedElements = builder.bannedElements;
Expand Down Expand Up @@ -354,7 +354,7 @@ public InputStream getResourceAsStream(String unsanitisedName) {
* @param name
* @return
*/
//@Override
@Override
protected Class<?> findClass(String moduleName, String name) {
try {
return loadClass(name, false);
Expand Down Expand Up @@ -706,23 +706,4 @@ static final class ClassLoaderState {
}
}

/**
* Horrible JDK8 hack
*
* getPackage() on JDK8 will always delegate to the parent, so QuarkusClassLoader will never define a package,
* which can cause issues if you then try and read package annotations as they will be from the wrong ClassLoader.
*
* We add this ClassLoader into the mix to block the getPackage() delegation.
*/
private static class GetPackageBlockingClassLoader extends ClassLoader {

protected GetPackageBlockingClassLoader(ClassLoader parent) {
super(parent);
}

@Override
protected Package getPackage(String name) {
return null;
}
}
}