Skip to content

ApplicationModuleSource picks up module identifier from nested modules #1042

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 28, 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 package setup

+ com.acme.module
+ com.acme.module.nested
  - package-info.java // annotated with @ApplicationModule(id = "foo-bar")

the ApplicationModuleSource.from(…) with the package com.acme results in two instances returned, both with the calculated identifier foo-bar. This is due to the package containing all nested classes, and thus the lookup for the package-info.java finds the nested file and is interpreted as identifier source.

A simple fix would be to insert a call to JavaPackage.toSingle() to only consider the class present in the very package.

@odrotbohm odrotbohm added in: core Core module meta model type: bug Something isn't working labels Jan 28, 2025
@odrotbohm odrotbohm added this to the 1.4 M2 milestone Jan 28, 2025
@odrotbohm odrotbohm self-assigned this Jan 28, 2025
odrotbohm added a commit that referenced this issue Jan 28, 2025
Before this commit, ApplicationModuleSource inspected all package-info.java contained in given packages, including the sub-packages of those. That caused identifiers explicitly defined in an @ApplicationModule on a package-info.java in nested packages picked up for top-level packages. This is now fixed by only considering the files in the top-level packages.
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