Skip to content

Commit

Permalink
Merge pull request #42161 from gayaldassanayake/fix-custom-loader
Browse files Browse the repository at this point in the history
Exclude cli and picocli from childfirst loading in CustomToolClassLoader
  • Loading branch information
gayaldassanayake authored Feb 16, 2024
2 parents c0c8613 + 81a2808 commit 91e7d41
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundE
Class<?> loadedClass = findLoadedClass(name);
if (loadedClass == null) {
try {
// First, try to load the class from the URLs
loadedClass = findClass(name);
// Load from parent if cli or picocli classes. This is to avoid SPI and class loading issues
if (name.startsWith("io.ballerina.cli") || name.startsWith("picocli")) {
loadedClass = super.loadClass(name, resolve);
} else {
// Try to load the class from the URLs
loadedClass = findClass(name);
}
} catch (ClassNotFoundException e) {
try {
// If not found, delegate to the parent
Expand Down

0 comments on commit 91e7d41

Please sign in to comment.