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

Update documentation with modular @IndexSubclasses gotcha #68

Open
pentlander opened this issue Aug 26, 2021 · 0 comments
Open

Update documentation with modular @IndexSubclasses gotcha #68

pentlander opened this issue Aug 26, 2021 · 0 comments

Comments

@pentlander
Copy link

When your project uses a module-info.java class, using @IndexSubclasses on the package-info.java class does not work out of the box. According to the javadoc:

Additionally, and except for the special case where the resource has a name ending with ".class", this method will only find resources in packages of named modules when the package is opened unconditionally (even if the caller of this method is in the same module as the resource).

This means that the user needs to add opens package.containing.package.info to the module-info.java in order for the ClassIndex.getPackageClasses function to work. I ran into this problem myself, so I thought it would be useful to document for others.

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

No branches or pull requests

1 participant