-
Notifications
You must be signed in to change notification settings - Fork 270
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
Fix call to findResources returns empty. #837
Conversation
src/main/java/net/fabricmc/loader/impl/launch/knot/KnotClassLoader.java
Outdated
Show resolved
Hide resolved
public Enumeration<URL> findResources(String name) throws IOException { | ||
Objects.requireNonNull(name); | ||
|
||
return urlLoader.findResources(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not also include any results from originalLoader
? Or at least if urlLoader
doesn't return any results, like getResources
does below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This current implementation is consistent with findResource(String).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This current implementation is consistent with findResource(String).
When multiple Models contain resources with the same path, findResource can only display one of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not also include any results from
originalLoader
? Or at least ifurlLoader
doesn't return any results, likegetResources
does below.
My understanding is that findResource and findResources are designed to find resources within the current ClassLoader implementation, while getResource is designed to query the parent ClassLoader and query within the current ClassLoader.
You can see that the findResources implemented by URLClassLoader does not query the results of the parent ClassLoader.
Fix the issue that findResources returns empty due to not overriding findResources.
Added getUrlLoader() to allow developers to access other URLClassLoader methods that are not overridden by KnotClassLoader.