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

Improve LibClassLoader to load child first libraries #2318

Merged
merged 1 commit into from
Jan 31, 2025
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 @@ -74,4 +74,24 @@ private static boolean addFiles(ArrayList urls, final File libFiles) throws Malf
}
}

@Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
// Check if the class has already been loaded
Class<?> clazz = findLoadedClass(name);

if (clazz == null) {
try {
// Try to find the class in the current class loader
clazz = findClass(name);
} catch (ClassNotFoundException e) {
// If not found, delegate to parent class loader
clazz = super.loadClass(name, resolve);
}
}

if (resolve) {
resolveClass(clazz);
}
return clazz;
}
}
Loading