Skip to content

Conversation

wassertim
Copy link
Owner

Summary

Fixes #6 - Prevents multi-round annotation processing bug where List<Integer> fields incorrectly generated ListMapper dependencies.

Problem

The annotation processor was running in multiple rounds:

  1. First round: Generated correct inline NUMBER_LIST mapping for List<Integer>
  2. Second round: Regenerated files with incorrect ListMapper dependency
  3. Type information from javax.lang.model API behaves differently between rounds

This caused UnsatisfiedResolutionException: Unsatisfied dependency for type ListMapper when starting Quarkus applications.

Solution

Modified AnnotationProcessor.java to only process in the first round:

  • Added Set<String> processedTypes to track already-processed types
  • Skip processing if roundEnv.processingOver() returns true (final round)
  • Skip processing if roundEnv.getRootElements().isEmpty() (subsequent round with no new sources)
  • Skip processing if !processedTypes.isEmpty() (already processed in first round)

Added DEBUG_MARKER to MapperGenerator.java for build verification.

Testing

✅ Verified no ListMapper references in generated code
✅ Confirmed inline NUMBER_LIST mapping for List<Integer> fields:

if (routeInstruction.getWaypointIndices() != null) {
    List<AttributeValue> waypointIndicesList = routeInstruction.getWaypointIndices().stream()
        .map(val -> AttributeValue.builder().n(String.valueOf(val)).build())
        .collect(Collectors.toList());
    attributes.put("waypointIndices", AttributeValue.builder().l(waypointIndicesList).build());
}

✅ Single timestamp in generated files (processor runs only once)
✅ DEBUG_MARKER present showing local build is being used

Files Changed

  • src/main/java/com/github/wassertim/dynamodb/toolkit/processor/AnnotationProcessor.java
  • src/main/java/com/github/wassertim/dynamodb/toolkit/generation/MapperGenerator.java

Closes #6

Fixes issue #6 where List<Integer> fields were incorrectly generating
ListMapper dependencies due to multi-round annotation processing.

Problem:
- Annotation processor was running in multiple rounds
- First round: Correct inline NUMBER_LIST mapping
- Second round: Incorrect ListMapper dependency
- Type information behaves differently in subsequent rounds

Solution:
- Track processed types to avoid reprocessing
- Skip processing in subsequent rounds (processingOver, empty rootElements)
- Only process in the first round for consistent type information
- Add DEBUG_MARKER for build verification

Testing:
- Verified no ListMapper references in generated code
- Confirmed inline NUMBER_LIST mapping for List<Integer>
- Single timestamp showing processor runs only once

Closes #6
@wassertim wassertim merged commit 44ac70d into main Oct 5, 2025
2 checks passed
@wassertim wassertim deleted the fix/multi-round-annotation-processing branch October 5, 2025 20:12
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.

Missing ListMapper generation for List<T> fields
1 participant