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

make importPackages("") and importClasspath(..) consistent #954

Merged
merged 2 commits into from
Sep 12, 2022

Conversation

codecholeric
Copy link
Collaborator

So far ClassFileImporter.importPackages("") would only return classes that returns, but not classes derived from the set classpath. The reason is that this corner case has been overlooked in NormalizedResourceName.startsWith(..). I.e. if the prefix is empty, then the resource would only be included if it starts with a /, but resources in archives do not start with a /.

@codecholeric codecholeric requested a review from hankem September 10, 2022 15:02
Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
So far `ClassFileImporter.importPackages("")` would only return classes returned by `ClassLoader.getResources("")`, but not other classes derived from the configured URL classpath (as done for other prefixes like `com`, which would be searched through the whole classpath as well). The reason is that this corner case has been overlooked in `NormalizedResourceName.startsWith(..)`. I.e. if the prefix is empty, then the resource would only be included if it starts with a `/`, but resources in archives do not start with a `/`.

Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
@codecholeric codecholeric force-pushed the support-importing-default-package branch from fafabb3 to 2c66196 Compare September 11, 2022 12:05
Copy link
Member

@hankem hankem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable, thanks!

@codecholeric codecholeric merged commit 1dd8ac9 into main Sep 12, 2022
@codecholeric codecholeric deleted the support-importing-default-package branch September 12, 2022 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants