Skip to content

JavaPackage.getSubPackages() does not include empty intermediate packages #1039

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

Closed
odrotbohm opened this issue Jan 25, 2025 · 0 comments
Closed
Assignees
Labels
in: core Core module meta model type: bug Something isn't working
Milestone

Comments

@odrotbohm
Copy link
Member

Given a source code arrangement as follows:

- example
- example.foo
- example.foo.bar
  - Foo.java

obtaining the sub-packages of example only returns example.foo.bar but not example.foo. This is because the traversing algorithm works by starting with the classes present in the hierarchy and inspecting their packages only. We need to make sure that we include the intermediate packages as well.

Related tickets

@odrotbohm odrotbohm added in: core Core module meta model type: bug Something isn't working labels Jan 25, 2025
@odrotbohm odrotbohm added this to the 1.4 M2 milestone Jan 25, 2025
@odrotbohm odrotbohm self-assigned this Jan 25, 2025
odrotbohm added a commit that referenced this issue Jan 25, 2025
odrotbohm added a commit that referenced this issue Mar 4, 2025
The fix for GH-1039 introduced a performance regression as the calculation of the sub-packages escaped the SingletonSupplier and thus is now included in every hashCode() calculation. Took the chance to significantly revamp the sub-package calculation for nested packages. In other words, the entire sub-package arrangement for a package is calculated once with pre-computed intermediaries held instead of re-computing them per sub-package.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Core module meta model type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant