Skip to content

feat: add typed annotation member helpers - #476

Merged
AndreasIgel merged 10 commits into
java-helpers:mainfrom
igel-devin-ai:devin/1796081862-issue-447-typed-annotations
Dec 5, 2026
Merged

AndreasIgel merged 10 commits into
java-helpers:mainfrom
igel-devin-ai:devin/1796081862-issue-447-typed-annotations

Conversation

@igel-devin-ai

Copy link
Copy Markdown
Contributor

Closes #447.

Summary

  • Add typed annotation-member helpers for escaped strings, class literals, enum constants, and raw expressions while keeping the existing raw member API compatible.
  • Track referenced member types so imports are collected and colliding simple names are qualified by the Roaster backend.
  • Cover escaping, imports, collision handling, DTO-copy behavior, and update the showcase to the typed string helper.

Verification

  • mvn clean verify

@codecov

codecov Bot commented Dec 1, 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!

@AndreasIgel

This comment has been minimized.

…sue-447-typed-annotations

# Conflicts:
#	codegen-core/src/test/java/org/javahelpers/codegen/util/ImportCollectorTest.java
- introduce AnnotationMember (source expression + optional referenced type),
  replacing the parallel members/memberTypes maps in AnnotationDto
- rename typed helpers to addMemberString/addMemberClass/addMemberEnum,
  drop redundant add2RawMember (raw values go through member())
- adapt ImportCollector, RoasterMapper, RoasterCodeGenerator,
  FieldAnnotationExtractor and tests; textblock comparison in
  CodegenDtoBuildersTest; examples in mapAnnotationMemberValue javadoc
GeneratedAnnotationEnhancer, BuilderImplementationAnnotationEnhancer and
JacksonModuleGenerator now use addMemberString/addMemberClass instead of
hand-writing source literals, so referenced types flow through the typed
member import handling.
@AndreasIgel

This comment has been minimized.

…tions

- AnnotationMember gains a Kind (RAW/STRING/CLASS/ENUM_CONSTANT) defining
  how the value has to be interpreted; documented that the referenced
  type drives both import collection and collision qualification
- new addMemberInt/addMemberBoolean helpers; each escape in quote()
  documented with its purpose
- RoasterMapper.mapAnnotationMember is public for reuse in tests
- tests: common assert helpers (exact + contains) in
  CodegenDtoBuildersTest, comprehensive all-member-types tests on model
  and RoasterMapper level
- migrate manual escaping to typed helpers: WithInterfaceEnhancer
  (@SuppressWarnings("unchecked")), JacksonAnnotationEnhancer
  (withPrefix)
@igel-devin-ai

This comment has been minimized.

- NUMBER/BOOLEAN kinds on AnnotationMember; int/boolean helpers record them
- requireNonNull instead of manual null checks in AnnotationMember
- removed orphaned javadoc fragment in AnnotationDtoBuilder
- test helpers renamed to assertMembers/assertMembersContain
- RoasterMapperTest all-types assertion split into readable concatenated lines
the referenced type moved into AnnotationMember itself with the typed
model, leaving the annotation parameter unused (sonar java:S1172)
@sonarqubecloud

sonarqubecloud Bot commented Dec 5, 2026

Copy link
Copy Markdown

@AndreasIgel
AndreasIgel merged commit f3505d4 into java-helpers:main Dec 5, 2026
6 checks passed
devin-ai-integration Bot added a commit to igel-devin-ai/simple-builders-devin-fork that referenced this pull request Dec 5, 2026
devin-ai-integration Bot added a commit to igel-devin-ai/simple-builders-devin-fork that referenced this pull request Dec 5, 2026
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.

Typed annotation member values instead of raw Java source strings in AnnotationDto

3 participants