Repository navigation
feat: validate generation targets before rendering (#465) - #479
Merged
AndreasIgel merged 6 commits intoDec 5, 2026
Merged
AndreasIgel merged 6 commits into
AndreasIgel merged 6 commits into
Conversation
AndreasIgel
reviewed
Dec 3, 2026
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
AndreasIgel
reviewed
Dec 3, 2026
This comment has been minimized.
This comment has been minimized.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
devin-ai-integration
Bot
force-pushed
the
issue-465-generation-target-validation
branch
from
December 4, 2026 21:49
e0d7c87 to
bff2d52
Compare
AndreasIgel
reviewed
Dec 4, 2026
Comment on lines
+94
to
+96
| GenerationTargetClassDto target, String targetName, List<String> violations) { | ||
| Set<String> seen = new HashSet<>(); | ||
| for (ClassFieldDto field : target.getClassFields()) { |
Collaborator
There was a problem hiding this comment.
Passing list of fields instead of target would be better, follow other calls and it would provide the possibility to reuse this function for validating fields of nested types.
Contributor
Author
There was a problem hiding this comment.
Done — validateFields now takes List<ClassFieldDto> and the call site passes target.getClassFields(), so the function can be reused for validating fields of nested types.
devin-ai-integration
Bot
force-pushed
the
issue-465-generation-target-validation
branch
from
December 4, 2026 22:09
bff2d52 to
5ff27ed
Compare
This was referenced Dec 4, 2026
Extends and moves GenerationTargetValidator into codegen-core (org.javahelpers.codegen.validation): duplicate parameter names, duplicate method/constructor signatures (erasure-aware via JavaSignatures), duplicate field names, nested-type collisions, simple-name collisions of referenced types, reserved words and illegal identifiers. Collects all violations into one exception. Stacked on java-signature-erasure: the signature calculation is split into its own PR.
- validateFields takes the field list so it can be reused for nested type validation - static imports are checked for member-name collisions across different owners
- nested-type validation now recurses into fields and constructors, not just methods (model support added in java-helpers#487/java-helpers#488) - nested interfaces declaring constructors or fields are rejected: constructors are impossible in interfaces, fields are implicit constants and cannot be generated as declared
devin-ai-integration
Bot
force-pushed
the
issue-465-generation-target-validation
branch
from
December 5, 2026 08:40
0479a9c to
3b48790
Compare
The static entry point now creates a validator instance holding the collected violations, the validation context and the type-variable bounds, so the private validation methods no longer repeat targetName and violations in every signature. Nested-type recursion scopes context and type-variable bounds with save/restore.
AndreasIgel
reviewed
Dec 5, 2026
|
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.



Summary
Extends the existing
GenerationTargetValidator(introduced in #470) and moves it into codegen-core (org.javahelpers.codegen.validation), implementing the full rule set of #465 before rendering:JavaSignaturesfrom refactor: centralize erasure-aware Java signature calculation #486)java.util.Datevsjava.sql.Date)All violations are collected and reported in one
CodeGenerationExceptioninstead of failing on the first.Rebased onto main after #486 and #488 merged — the diff is now the validator alone.