Skip to content

fix: support wildcard type arguments in the processor (#435) - #436

Merged
AndreasIgel merged 6 commits into
java-helpers:mainfrom
igel-devin-ai:fix/processor-wildcard-type-arguments
Nov 22, 2026
Merged

AndreasIgel merged 6 commits into
java-helpers:mainfrom
igel-devin-ai:fix/processor-wildcard-type-arguments

Conversation

@igel-devin-ai

@igel-devin-ai igel-devin-ai commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Closes #435.

  • JavaLangMapper.extractType() maps ?, ? extends X and ? super X recursively.
  • New TypeNameWildcard in codegen-core, rendered by RoasterMapper. ImportCollector follows the wildcard bounds instead of treating the wildcard as a class name.
  • Helpers that write elements or create instances (e.g. add2List, Supplier-based element creation) are not generated for a direct wildcard argument, because List<? extends Number> cannot accept elements. Setter, supplier and consumer/updater signatures keep the exact wildcard type. Nested cases such as List<Foo<?>> keep the collection helpers.

Tests: exact generated declarations, plus compilation, for 8 wildcard variants. Also model, mapper, Roaster and import tests. With the old mapper restored, all 8 processor tests fail.

Verified: mvn clean verify and mvn -pl example clean compile pass. Generated examples are unchanged.

Prerequisite for #429 (codegen DTO builders with collection setters).

Wildcard check: TypeName.hasWildcardArguments() returns false by default and is overridden by TypeNameGeneric. Each helper generator skips wildcard types with one line, if (field.getFieldType().hasWildcardArguments()) return false;, and keeps its own reason as a comment. No dispatcher-level filter is used, because the setter, supplier and updater generators must still apply to wildcard types.

@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

Quality Gate Failed Quality Gate failed

Failed conditions
5.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@AndreasIgel
AndreasIgel merged commit 0c768ea into java-helpers:main Nov 22, 2026
5 checks passed
devin-ai-integration Bot added a commit to igel-devin-ai/simple-builders-devin-fork that referenced this pull request Nov 24, 2026
…dcard handling, suppress CodeQL override warning

- ProcessorDtoBuildersTest: add MIT license header (fixes license:check CI failure)
- ImportCollector: revert early-return for TypeNameWildcard; addImport already
  unwraps bounds since java-helpers#436, so the block was a no-op
- BuilderToStringStyle: justify and suppress java/confusing-method-signature;
  the exact @OverRide is required to unwrap TrackedValue fields
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.

Processor fails with 'Unexpected type mirror: ?' on wildcard type arguments

3 participants