Skip to content

Add empty constructors for Java generation - #891

Open
empwilli wants to merge 1 commit into
mainfrom
empwilli/add_empty_java_constructors
Open

empwilli wants to merge 1 commit into
mainfrom
empwilli/add_empty_java_constructors

Conversation

@empwilli

Copy link
Copy Markdown
Contributor

Until now the code generation for Java did not emit empty constructors. As Java does not permit to elide optional arguments, this made the construction of classes with only optional attributes tedious: users either had to use builders, or they had to provide a series of "null" values on construction. Furthermore, the pattern was inconsistent with how parameters are handled in general: we already generate constructors with only mandatory parameters, leaving out the optional ones. With this we address the issue and additionally generate empty constructors for classes for that all attributes are optinal.

Until now the code generation for Java did not emit empty constructors.
As Java does not permit to elide optional arguments, this made the
construction of classes with only optional attributes tedious: users
either had to use builders, or they had to provide a series of "null"
values on construction. Furthermore, the pattern was inconsistent with
how parameters are handled in general: we already generate constructors
with only mandatory parameters, leaving out the optional ones. With this
we address the issue and additionally generate empty constructors for
classes for that all attributes are optinal.
@empwilli
empwilli requested a review from mristin November 18, 2026 14:02
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 44319915812

Coverage remained the same at 90.319%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 5 of 5 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 52358
Covered Lines: 47289
Line Coverage: 90.32%
Coverage Strength: 2.71 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants