fix(java-ast): deduplicate imports when references are used#10
Open
singhvishalkr wants to merge 1 commit intoamplication:mainfrom
Open
fix(java-ast): deduplicate imports when references are used#10singhvishalkr wants to merge 1 commit intoamplication:mainfrom
singhvishalkr wants to merge 1 commit intoamplication:mainfrom
Conversation
Writer stored ClassReference instances in a Set, so distinct objects for the same type were not collapsed. Store fully qualified names as strings and merge explicit imports with reference-derived imports in a single Set before rendering. Fixes amplication/amplication#9845
98e7a94 to
f07fb6f
Compare
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.
Problem
When multiple \ClassReference\ values pointed at the same type, \Writer\ emitted duplicate \import\ lines. \Set\ uses reference identity, so logically identical references were not merged.
Change
Verification
px nx run java-ast:test\ (all suites pass; \ComplexExample\ snapshot updated).
Fixes amplication/amplication#9845
Made with Cursor