Skip to content

fix: answer no builder for scope-excluded beans in MapStruct SPI (#383) - #395

Merged
AndreasIgel merged 4 commits into
java-helpers:mainfrom
igel-devin-ai:devin/1794290179-mapstruct-scope-miss
Nov 10, 2026
Merged

AndreasIgel merged 4 commits into
java-helpers:mainfrom
igel-devin-ai:devin/1794290179-mapstruct-scope-miss

Conversation

@igel-devin-ai

Copy link
Copy Markdown
Contributor

Summary

Fixes #383.

MapStructBuilderProvider deferred every unpublished bean while the simple-builders registry was unfinished. When BuilderProcessor plans nothing (every marked bean outside builderGenerationPackages) it generates no source, javac starts no further round, and MapStruct 1.6.3 does not retry deferred lookups in processing-over — the mapper fails with "No implementation was created".

The provider now answers "no builder" immediately when planning can never produce one:

  • a marked bean whose effective builderGenerationPackages scope excludes its package (compiler option plus annotation/inherited/template overrides via BuilderConfigurationReader),
  • JDK types (java.*, javax.*, jdk.*) that MapStruct probes for property types.

MapStructAdditionalSupportedOptionsProvider declares builderGenerationPackages so MapStruct forwards -Asimplebuilder.builderGenerationPackages into SPI environments. BuilderConfigurationReader gained SPI-usable readers for compiler options and per-element generation scope.

Test-first: mapStruct_processorOrderReversed_markedBeanOutsideGenerationScope_shouldMapViaSetters failed before the fix with the MapStruct "No implementation was created" diagnostic and passes after; MapStructSpiProbeTest now expects the immediate empty answer for scope-excluded beans. mvn clean install is green (486 processor tests).

@AndreasIgel
AndreasIgel merged commit dca038f into java-helpers:main Nov 10, 2026
5 checks passed
@devin-ai-integration
devin-ai-integration Bot deleted the devin/1794290179-mapstruct-scope-miss branch November 22, 2026 14:24
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.

MapStruct integration: mapper fails when MapStruct runs first and every marked bean is outside builderGenerationPackages

2 participants