Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ private TypeSpec buildMapperClass(TypeInfo typeInfo) {
.addAnnotation(ApplicationScoped.class)
.addJavadoc(createGeneratedJavadoc(
"Generated DynamoDB mapper for " + className + ".\n" +
"Provides bidirectional conversion between " + className + " and DynamoDB AttributeValue."
"Provides bidirectional conversion between " + className + " and DynamoDB AttributeValue.\n" +
"DEBUG_MARKER: Local build verification - " + System.currentTimeMillis()
));

// Add dependency injection (fields and constructor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public class AnnotationProcessor extends AbstractProcessor {
private FieldConstantsGenerator fieldConstantsGenerator;
private TableNameResolverGenerator tableNameResolverGenerator;

// Track processed types to avoid reprocessing in subsequent rounds
private final Set<String> processedTypes = new java.util.HashSet<>();

@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
super.init(processingEnv);
Expand All @@ -79,17 +82,40 @@ public synchronized void init(ProcessingEnvironment processingEnv) {

@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
// Skip processing if annotations are empty
if (annotations.isEmpty()) {
return false;
}

// CRITICAL FIX: Only process in the first round, skip all subsequent rounds
// This prevents multi-round processing bugs where type information changes between rounds
if (!roundEnv.processingOver() && roundEnv.getRootElements().isEmpty()) {
// This is a subsequent round with no new source files - skip it
return false;
}

// Skip the final processing-over round
if (roundEnv.processingOver()) {
return false;
}

// Only process if we haven't processed anything yet (first round only)
if (!processedTypes.isEmpty()) {
return false;
}

try {
// Collect all @DynamoMappable annotated elements
Set<? extends Element> annotatedElements = roundEnv.getElementsAnnotatedWith(DynamoMappable.class);

// Collect all @Table annotated elements
Set<? extends Element> tableElements = roundEnv.getElementsAnnotatedWith(Table.class);

// Mark all types as processed
for (Element element : annotatedElements) {
processedTypes.add(((TypeElement) element).getQualifiedName().toString());
}

// If no annotations to process, return false
if (annotatedElements.isEmpty() && tableElements.isEmpty()) {
return false;
Expand Down