Add new codgen processor to throw ModelInvalidException on naming case and type collisions instead of NPE#7167
Open
RanVaknin wants to merge 2 commits into
Open
Add new codgen processor to throw ModelInvalidException on naming case and type collisions instead of NPE#7167RanVaknin wants to merge 2 commits into
ModelInvalidException on naming case and type collisions instead of NPE#7167RanVaknin wants to merge 2 commits into
Conversation
RanVaknin
marked this pull request as ready for review
July 20, 2026 21:55
RanVaknin
force-pushed
the
rvaknin/fix-codgen-naming-collisions
branch
from
July 20, 2026 22:41
a88192f to
9e8733f
Compare
ModelInvalidException on naming case and type collisions instead of NPE
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.
Adds a codegen processor that throws a typed exception when a model has two shapes whose names differ only in the case of their first letter AND have different types.
Example:
Codegen capitalizes the first letter of each shape name to derive its Java class name, so both
Endpointandendpointmap to the classEndpoint.java. Codegen keys its shape map by that class name, so one shape silently overwrites the other, and a member still referencing the lost shape later can cause a codegen time error (observed as an NPE).The processor only flags collisions where the two shapes have different types. Same type collisions produce equivalent output, so the overwrite is harmless.
The new processor detects when two shapes of different types map to the same generated class name, and throws a single
ModelInvalidExceptionlisting every collision found.