Skip to content

fix: preserve type-use annotations on Roaster field and return types (#433) - #434

Merged
AndreasIgel merged 2 commits into
java-helpers:mainfrom
igel-devin-ai:fix/roaster-type-use-annotations
Nov 22, 2026
Merged

AndreasIgel merged 2 commits into
java-helpers:mainfrom
igel-devin-ai:fix/roaster-type-use-annotations

Conversation

@igel-devin-ai

Copy link
Copy Markdown
Contributor

Closes #433. Follow-up to #111 (type-use support) and #139 (Roaster migration).

RoasterCodeGenerator no longer uses Roaster's FieldSource.setType / MethodSource.setReturnType, because they drop a leading type-use annotation and turn List<@Nullable String> return types into void (see #433 for the Roaster internals). Fields and methods are now created from a declaration string (addField("<type> <name>;"), addMethod("<returnType> <name>();")), which Roaster parses completely. All other configuration (visibility, parameters, body, Javadoc) is unchanged.

Tests: three exact text-block regressions in RoasterCodeGeneratorTest (field annotation, return-type annotation, annotated generic return type). The generated source is compiled, and all three fail without the fix. mvn clean verify passes, and the regenerated examples are unchanged.

@codecov

codecov Bot commented Nov 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@sonarqubecloud

Copy link
Copy Markdown

@AndreasIgel
AndreasIgel merged commit 9aef983 into java-helpers:main Nov 22, 2026
6 checks passed
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.

Roaster backend drops or corrupts type-use annotations on field and return types

2 participants