From f9de31801d2c9a210dfaa2528663f8e15b7f03fe Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 2 Dec 2026 07:56:26 +0000 Subject: [PATCH 1/2] fix: keep array dimensions in method signatures --- .../codegen/model/method/MethodDto.java | 7 +---- .../model/method/BuilderMethodDto.java | 7 +---- .../processor/BuilderProcessorTest.java | 8 ++---- .../MethodConflictResolutionTest.java | 28 +++++++++++++++++++ 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/codegen-core/src/main/java/org/javahelpers/codegen/model/method/MethodDto.java b/codegen-core/src/main/java/org/javahelpers/codegen/model/method/MethodDto.java index d712e1ba..59760158 100644 --- a/codegen-core/src/main/java/org/javahelpers/codegen/model/method/MethodDto.java +++ b/codegen-core/src/main/java/org/javahelpers/codegen/model/method/MethodDto.java @@ -29,7 +29,6 @@ import java.util.List; import java.util.Locale; import java.util.Optional; -import org.apache.commons.lang3.StringUtils; import org.javahelpers.codegen.enums.AccessModifier; import org.javahelpers.codegen.model.annotation.AnnotationDto; import org.javahelpers.codegen.model.javadoc.JavadocDto; @@ -257,11 +256,7 @@ public String getSignatureKey() { for (int i = 0; i < parameters.size(); i++) { if (i > 0) sb.append(','); TypeName tn = parameters.get(i).getParameterType(); - // Handle null package names - if (StringUtils.isNoneBlank(tn.getPackageName())) { - sb.append(tn.getPackageName()).append('.'); - } - sb.append(tn.getClassName()); + sb.append(tn.getRawQualifiedName()); } sb.append(')'); return sb.toString(); diff --git a/processor/src/main/java/org/javahelpers/simple/builders/processor/model/method/BuilderMethodDto.java b/processor/src/main/java/org/javahelpers/simple/builders/processor/model/method/BuilderMethodDto.java index e7fae4dd..4a5dd1d1 100644 --- a/processor/src/main/java/org/javahelpers/simple/builders/processor/model/method/BuilderMethodDto.java +++ b/processor/src/main/java/org/javahelpers/simple/builders/processor/model/method/BuilderMethodDto.java @@ -29,7 +29,6 @@ import java.util.List; import java.util.Locale; import java.util.Optional; -import org.apache.commons.lang3.StringUtils; import org.javahelpers.codegen.enums.AccessModifier; import org.javahelpers.codegen.model.annotation.AnnotationDto; import org.javahelpers.codegen.model.javadoc.JavadocCodeBlockDto; @@ -383,11 +382,7 @@ public String getSignatureKey() { for (int i = 0; i < parameters.size(); i++) { if (i > 0) sb.append(','); TypeName tn = parameters.get(i).getParameterType(); - // Handle null package names - if (StringUtils.isNoneBlank(tn.getPackageName())) { - sb.append(tn.getPackageName()).append('.'); - } - sb.append(tn.getClassName()); + sb.append(tn.getRawQualifiedName()); } sb.append(')'); return sb.toString(); diff --git a/processor/src/test/java/org/javahelpers/simple/builders/processor/BuilderProcessorTest.java b/processor/src/test/java/org/javahelpers/simple/builders/processor/BuilderProcessorTest.java index 54b8d2d2..7d1cd2a8 100644 --- a/processor/src/test/java/org/javahelpers/simple/builders/processor/BuilderProcessorTest.java +++ b/processor/src/test/java/org/javahelpers/simple/builders/processor/BuilderProcessorTest.java @@ -131,12 +131,8 @@ void shouldReportExistingParameterizedCollectionWarnings(String property) { Compilation compilation = compileOwnerProperty(property); assertThat(compilation).succeeded(); assertThat(compilation).hadWarningCount(1); - if (property.contains("java.util.List valueSupplier) { d -> System.out.println("✓ Lower priority dropped correctly: " + d.getMessage(null))); } + /** + * Array dimensions are part of the erased parameter type, so nested lists keep varargs helpers. + */ + @Test + void shouldKeepVarargsForNestedList() { + JavaFileObject sourceFile = + ProcessorTestUtils.simpleBuilderClass( + "test", + "NestedListDto", + """ + private java.util.List> value; + public java.util.List> getValue() { return value; } + public void setValue(java.util.List> value) { this.value = value; } + """); + + Compilation compilation = compile(sourceFile); + + assertThat(compilation).succeeded(); + String generatedCode = loadGeneratedSource(compilation, "NestedListDtoBuilder"); + ProcessorAsserts.assertContaining( + generatedCode, + "public NestedListDtoBuilder value(List> value)", + "public NestedListDtoBuilder value(List... value)"); + Assertions.assertFalse( + compilation.diagnostics().stream() + .anyMatch(d -> d.getMessage(null).contains("Method conflict resolved"))); + } + /** * In verbose mode warnings must be emitted without element attachment — javac would otherwise * prepend {@code File.java:[line,col]} mid-line and break the hierarchical layout. Instead the From e0b5b78db3c095a23a82150ba0c75425539d4798 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 3 Dec 2026 21:43:12 +0000 Subject: [PATCH 2/2] test: centralize absent diagnostic assertion --- .../codegen/testing/ProcessorAsserts.java | 17 +++++++++++++++++ .../codegen/testing/ProcessorAssertsTest.java | 13 +++++++++++++ .../processor/MethodConflictResolutionTest.java | 4 +--- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/codegen-testing/src/main/java/org/javahelpers/codegen/testing/ProcessorAsserts.java b/codegen-testing/src/main/java/org/javahelpers/codegen/testing/ProcessorAsserts.java index 6f91af8f..0715aaac 100644 --- a/codegen-testing/src/main/java/org/javahelpers/codegen/testing/ProcessorAsserts.java +++ b/codegen-testing/src/main/java/org/javahelpers/codegen/testing/ProcessorAsserts.java @@ -191,6 +191,23 @@ public static void assertDiagnosticsHaveNoSourcePosition( } } + /** + * Asserts that no diagnostic message contains the given text. + * + * @param compilation the compilation result + * @param text text that must not occur in any diagnostic message + */ + public static void assertNoDiagnosticsContaining(Compilation compilation, String text) { + List matching = + compilation.diagnostics().stream() + .map(d -> d.getMessage(null)) + .filter(message -> message.contains(text)) + .toList(); + Assertions.assertTrue( + matching.isEmpty(), + "Expected no diagnostic containing '" + text + "', but found: " + matching); + } + /** * Asserts that no generated source file for the given type exists in the compilation. * diff --git a/codegen-testing/src/test/java/org/javahelpers/codegen/testing/ProcessorAssertsTest.java b/codegen-testing/src/test/java/org/javahelpers/codegen/testing/ProcessorAssertsTest.java index 5c9e5090..c60a9a78 100644 --- a/codegen-testing/src/test/java/org/javahelpers/codegen/testing/ProcessorAssertsTest.java +++ b/codegen-testing/src/test/java/org/javahelpers/codegen/testing/ProcessorAssertsTest.java @@ -141,6 +141,19 @@ void assertDiagnosticsHaveNoSourcePosition_passesForElementLessWarnings() { compilation, Diagnostic.Kind.WARNING, "floating warning"); } + @Test + void assertNoDiagnosticsContaining_checksAllDiagnostics() { + Compilation compilation = + compileWithDiagnostics( + (env, dto) -> + env.getMessager().printMessage(Diagnostic.Kind.WARNING, "floating warning")); + + ProcessorAsserts.assertNoDiagnosticsContaining(compilation, "not emitted"); + assertThrows( + AssertionError.class, + () -> ProcessorAsserts.assertNoDiagnosticsContaining(compilation, "floating warning")); + } + @Test void assertNoSourceGenerated_failsWhenFileExists() { Compilation compilation = diff --git a/processor/src/test/java/org/javahelpers/simple/builders/processor/MethodConflictResolutionTest.java b/processor/src/test/java/org/javahelpers/simple/builders/processor/MethodConflictResolutionTest.java index 48b74d64..e22c7bbb 100644 --- a/processor/src/test/java/org/javahelpers/simple/builders/processor/MethodConflictResolutionTest.java +++ b/processor/src/test/java/org/javahelpers/simple/builders/processor/MethodConflictResolutionTest.java @@ -444,9 +444,7 @@ void shouldKeepVarargsForNestedList() { generatedCode, "public NestedListDtoBuilder value(List> value)", "public NestedListDtoBuilder value(List... value)"); - Assertions.assertFalse( - compilation.diagnostics().stream() - .anyMatch(d -> d.getMessage(null).contains("Method conflict resolved"))); + ProcessorAsserts.assertNoDiagnosticsContaining(compilation, "Method conflict resolved"); } /**