Repository navigation
improve error message for modules with duplicate names - #1758
Open
SamuelAdigos wants to merge 2 commits into
Open
SamuelAdigos wants to merge 2 commits into
SamuelAdigos wants to merge 2 commits into
Conversation
So far, if multiple modules ended up with the same name, `ArchModules`
threw an exception like `Found multiple modules with the same name: []`.
This was hard to understand, especially if the duplicate name was empty,
e.g. when using jMolecules' `@Module("Foo")` with
`definedByAnnotation(Module.class)`, where `name()` is `""` because the
value was given via the `value` alias. The message looked like an empty
list and didn't mention which modules were conflicting.
We now quote each duplicate name and list the (sorted) identifiers
of the conflicting modules.
Resolves: TNG#1520
Signed-off-by: Samuel Vila <svila.smr@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
So far, if multiple modules ended up with the same name,
ArchModulesthrew an exception likeFound multiple modules with the same name: [].This was hard to understand, especially if the duplicate name was empty, e.g. when using jMolecules'
@Module("Foo")withdefinedByAnnotation(Module.class), wherename()is""because the value was given via thevaluealias. The message looked like an empty list and didn't mention which modules were conflicting.We now quote each duplicate name and list the (sorted) identifiers of the conflicting modules, e.g.
This change only affects the error message. Deriving the name from
value()by default, as also suggested in the issue, is left out for now, sincedefinedByAnnotation(Module.class, Module::value)already covers that use case and changing the default would be a behavioral change worth discussing separately.Verified with
./gradlew clean build -PallTests.Resolves #1520