From c7852feb55a6425d45245f31d0433a5dca81c772 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sun, 31 Mar 2024 19:22:25 +0200 Subject: [PATCH] fix another bug in detecting when a repo method param is multivalued Signed-off-by: Gavin King --- .../annotation/AnnotationMetaEntity.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java index 62be8e880b..317d4cb2bc 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java @@ -1244,7 +1244,7 @@ public class AnnotationMetaEntity extends AnnotationMeta { sessionType, operation, context.addNonnullAnnotation(), - declaredType != parameterType, + isIterableLifecycleParameter(parameterType), returnArgument ) ); @@ -1252,6 +1252,19 @@ public class AnnotationMetaEntity extends AnnotationMeta { } } + private static boolean isIterableLifecycleParameter(TypeMirror parameterType) { + switch (parameterType.getKind()) { + case ARRAY: + return true; + case DECLARED: + final DeclaredType declaredType = (DeclaredType) parameterType; + final TypeElement typeElement = (TypeElement) declaredType.asElement(); + return typeElement.getQualifiedName().contentEquals(LIST); + default: + return false; + } + } + private static boolean isVoid(TypeMirror returnType) { switch (returnType.getKind()) { case VOID: