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
2 changes: 1 addition & 1 deletion processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<!-- Dependency Versions -->
<auto-service.version>1.1.1</auto-service.version>
<javapoet.version>0.8.0</javapoet.version>
<javapoet.version>0.9.0</javapoet.version>
<commons-lang.version>3.20.0</commons-lang.version>
<commons-collections.version>4.5.0</commons-collections.version>
<junit-jupiter.version>6.0.1</junit-jupiter.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ public static TypeName map2ParameterType(
instanceof org.javahelpers.simple.builders.processor.dtos.TypeNameVariable typeVariable) {
return TypeVariableName.get(typeVariable.getClassName());
}
ClassName classNameParameter =
ClassName.get(parameterType.getPackageName(), parameterType.getClassName());
if (parameterType instanceof TypeNameArray parameterTypeArray) {
return ArrayTypeName.of(map2ParameterType(parameterTypeArray.getTypeOfArray()));
} else if (parameterType instanceof TypeNamePrimitive parameterTypePrim) {
// Handle primitives BEFORE calling ClassName.get() to avoid IllegalArgumentException in
// JavaPoet 0.9.0+
if (parameterType instanceof TypeNamePrimitive parameterTypePrim) {
return switch (parameterTypePrim.getType()) {
case BOOLEAN -> TypeName.BOOLEAN;
case BYTE -> TypeName.BYTE;
Expand All @@ -93,7 +91,14 @@ public static TypeName map2ParameterType(
case SHORT -> TypeName.SHORT;
default -> null;
};
} else if (parameterType instanceof TypeNameGeneric param) {
}
if (parameterType instanceof TypeNameArray parameterTypeArray) {
return ArrayTypeName.of(map2ParameterType(parameterTypeArray.getTypeOfArray()));
}
// Now safe to call ClassName.get() for non-primitive types
ClassName classNameParameter =
ClassName.get(parameterType.getPackageName(), parameterType.getClassName());
if (parameterType instanceof TypeNameGeneric param) {
// Handle raw types (e.g., List without <T>) - return just the class name
if (param.getInnerTypeArguments().isEmpty()) {
return classNameParameter;
Expand Down
Loading