From 96855d05256a5eafbeb036e0c6dcfd0bd02c32f2 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sat, 6 Apr 2024 21:35:26 +0200 Subject: [PATCH] retain type use annotation in return types and simplify code Signed-off-by: Gavin King --- .../annotation/AbstractCriteriaMethod.java | 9 ++- .../annotation/AbstractFinderMethod.java | 43 +++++------ .../annotation/AbstractQueryMethod.java | 9 ++- .../annotation/AnnotationMetaEntity.java | 50 ++++++++----- .../annotation/CriteriaDeleteMethod.java | 20 ++--- .../annotation/CriteriaFinderMethod.java | 62 ++++++++-------- .../processor/annotation/IdFinderMethod.java | 8 +- .../annotation/NaturalIdFinderMethod.java | 8 +- .../processor/annotation/QueryMethod.java | 73 +++++++++---------- 9 files changed, 145 insertions(+), 137 deletions(-) diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractCriteriaMethod.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractCriteriaMethod.java index 103e86fcfd..dd389f31eb 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractCriteriaMethod.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractCriteriaMethod.java @@ -33,9 +33,10 @@ public abstract class AbstractCriteriaMethod extends AbstractFinderMethod { boolean addNonnullAnnotation, boolean convertToDataExceptions, List multivalued, - List paramPatterns) { + List paramPatterns, + String fullReturnType) { super(annotationMetaEntity, method, methodName, entity, belongsToDao, sessionType, sessionName, fetchProfiles, - paramNames, paramTypes, orderBys, addNonnullAnnotation, convertToDataExceptions); + paramNames, paramTypes, orderBys, addNonnullAnnotation, convertToDataExceptions, fullReturnType); this.multivalued = multivalued; this.paramPatterns = paramPatterns; } @@ -46,7 +47,7 @@ public abstract class AbstractCriteriaMethod extends AbstractFinderMethod { final StringBuilder declaration = new StringBuilder(); comment( declaration ); modifiers( declaration ); - preamble( declaration, returnType(), paramTypes ); + preamble( declaration, paramTypes ); chainSession( declaration ); nullChecks( paramTypes, declaration ); createBuilder(declaration); @@ -64,7 +65,7 @@ public abstract class AbstractCriteriaMethod extends AbstractFinderMethod { abstract String createCriteriaMethod(); - abstract String returnType(); +// abstract String returnType(); abstract String createQueryMethod(); diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractFinderMethod.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractFinderMethod.java index 20ea52dcee..c7c208c42f 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractFinderMethod.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractFinderMethod.java @@ -13,7 +13,6 @@ import java.util.List; import java.util.Locale; import static org.hibernate.processor.util.Constants.HIB_SESSION; -import static org.hibernate.processor.util.Constants.UNI; import static org.hibernate.processor.util.StringUtil.getUpperUnderscoreCaseFromLowerCamelCase; /** @@ -36,14 +35,16 @@ public abstract class AbstractFinderMethod extends AbstractQueryMethod { List paramTypes, List orderBys, boolean addNonnullAnnotation, - boolean convertToDataExceptions) { + boolean convertToDataExceptions, + String fullReturnType) { super( annotationMetaEntity, method, methodName, paramNames, paramTypes, entity, sessionType, sessionName, belongsToDao, orderBys, addNonnullAnnotation, - convertToDataExceptions ); + convertToDataExceptions, + fullReturnType ); this.entity = entity; this.fetchProfiles = fetchProfiles; } @@ -173,16 +174,6 @@ public abstract class AbstractFinderMethod extends AbstractQueryMethod { return unwrapped; } - void preamble(StringBuilder declaration) { - modifiers( declaration ); - entityType( declaration ); - declaration - .append(" ") - .append(methodName); - parameters( paramTypes, declaration ) ; - declaration.append(" {\n"); - } - void tryReturn(StringBuilder declaration) { if (dataRepository) { declaration @@ -193,19 +184,19 @@ public abstract class AbstractFinderMethod extends AbstractQueryMethod { .append(sessionName); } - private void entityType(StringBuilder declaration) { - if ( isReactive() ) { - declaration - .append(annotationMetaEntity.importType(UNI)) - .append('<'); - } - declaration - .append(annotationMetaEntity.importType(entity)); - if ( isReactive() ) { - declaration - .append('>'); - } - } +// private void returnType(StringBuilder declaration) { +// if ( isReactive() ) { +// declaration +// .append(annotationMetaEntity.importType(UNI)) +// .append('<'); +// } +// declaration +// .append(annotationMetaEntity.importType(entity)); +// if ( isReactive() ) { +// declaration +// .append('>'); +// } +// } void modifiers(StringBuilder declaration) { declaration diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractQueryMethod.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractQueryMethod.java index b8dd55dce2..34a03fa76d 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractQueryMethod.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractQueryMethod.java @@ -49,6 +49,7 @@ public abstract class AbstractQueryMethod extends AbstractAnnotatedMethod { final List orderBys; final boolean addNonnullAnnotation; final boolean dataRepository; + final String fullReturnType; AbstractQueryMethod( AnnotationMetaEntity annotationMetaEntity, @@ -61,7 +62,8 @@ public abstract class AbstractQueryMethod extends AbstractAnnotatedMethod { boolean belongsToDao, List orderBys, boolean addNonnullAnnotation, - boolean dataRepository) { + boolean dataRepository, + String fullReturnType) { super(annotationMetaEntity, method, sessionName, sessionType); this.methodName = methodName; this.paramNames = paramNames; @@ -71,6 +73,7 @@ public abstract class AbstractQueryMethod extends AbstractAnnotatedMethod { this.orderBys = orderBys; this.addNonnullAnnotation = addNonnullAnnotation; this.dataRepository = dataRepository; + this.fullReturnType = fullReturnType; } @Override @@ -107,9 +110,9 @@ public abstract class AbstractQueryMethod extends AbstractAnnotatedMethod { return type.endsWith("...") ? stripped + "..." : stripped; } - void preamble(StringBuilder declaration, String returnType, List paramTypes) { + void preamble(StringBuilder declaration, List paramTypes) { declaration - .append(returnType) + .append(annotationMetaEntity.importType(fullReturnType)) .append(" ") .append(methodName); parameters( paramTypes, declaration ); 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 aa022b18ef..165fbd03e2 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 @@ -593,7 +593,7 @@ public class AnnotationMetaEntity extends AnnotationMeta { } else { // For Panache subtypes, we look at the session type, but no DAO, we want static methods - sessionType = getter.getReturnType().toString(); + sessionType = fullReturnType(getter); } } else if ( element.getKind() == ElementKind.INTERFACE @@ -702,7 +702,7 @@ public class AnnotationMetaEntity extends AnnotationMeta { * it. */ private String addDaoConstructor(@Nullable ExecutableElement method) { - final String sessionType = method == null ? this.sessionType : method.getReturnType().toString(); + final String sessionType = method == null ? this.sessionType : fullReturnType(method); final String sessionVariableName = getSessionVariableName( sessionType ); final String name = method == null ? sessionVariableName : method.getSimpleName().toString(); @@ -1110,10 +1110,7 @@ public class AnnotationMetaEntity extends AnnotationMeta { } private void addQueryMethod(ExecutableElement method) { - final ExecutableType methodType = - (ExecutableType) context.getTypeUtils() - .asMemberOf((DeclaredType) element.asType(), method); - final TypeMirror returnType = methodType.getReturnType(); + final TypeMirror returnType = memberMethodType(method).getReturnType(); final TypeKind kind = returnType.getKind(); if ( kind == TypeKind.VOID || kind == TypeKind.ARRAY || kind.isPrimitive() ) { addQueryMethod( method, returnType, null ); @@ -1562,7 +1559,8 @@ public class AnnotationMetaEntity extends AnnotationMeta { enabledFetchProfiles( method ), orderByList( method, entity ), context.addNonnullAnnotation(), - jakartaDataRepository + jakartaDataRepository, + fullReturnType(method) ) ); } @@ -1608,7 +1606,6 @@ public class AnnotationMetaEntity extends AnnotationMeta { this, method, methodName, entity.getQualifiedName().toString(), - returnType.toString(), paramNames, paramTypes, parameterNullability(method, entity), @@ -1618,7 +1615,8 @@ public class AnnotationMetaEntity extends AnnotationMeta { sessionType[0], sessionType[1], context.addNonnullAnnotation(), - jakartaDataRepository + jakartaDataRepository, + fullReturnType(method) ) ); } @@ -1806,7 +1804,8 @@ public class AnnotationMetaEntity extends AnnotationMeta { sessionType[1], enabledFetchProfiles( method ), context.addNonnullAnnotation(), - jakartaDataRepository + jakartaDataRepository, + fullReturnType(method) ) ); } @@ -1829,7 +1828,8 @@ public class AnnotationMetaEntity extends AnnotationMeta { enabledFetchProfiles( method ), orderByList( method, entity ), context.addNonnullAnnotation(), - jakartaDataRepository + jakartaDataRepository, + fullReturnType(method) ) ); } @@ -1862,7 +1862,8 @@ public class AnnotationMetaEntity extends AnnotationMeta { sessionType[1], profiles, context.addNonnullAnnotation(), - jakartaDataRepository + jakartaDataRepository, + fullReturnType(method) ) ); break; @@ -1880,7 +1881,8 @@ public class AnnotationMetaEntity extends AnnotationMeta { sessionType[1], profiles, context.addNonnullAnnotation(), - jakartaDataRepository + jakartaDataRepository, + fullReturnType(method) ) ); break; @@ -1907,7 +1909,8 @@ public class AnnotationMetaEntity extends AnnotationMeta { profiles, orderByList( method, entity ), context.addNonnullAnnotation(), - jakartaDataRepository + jakartaDataRepository, + fullReturnType(method) ) ); break; @@ -2265,11 +2268,16 @@ public class AnnotationMetaEntity extends AnnotationMeta { sessionType[1], orderBys, context.addNonnullAnnotation(), - jakartaDataRepository + jakartaDataRepository, + fullReturnType(method) ); putMember( attribute.getPropertyName() + paramTypes, attribute ); } + private String fullReturnType(ExecutableElement method) { + return typeAsString( memberMethodType(method).getReturnType() ); + } + private static String returnTypeClass(TypeMirror returnType) { switch (returnType.getKind()) { case DECLARED: @@ -2468,7 +2476,7 @@ public class AnnotationMetaEntity extends AnnotationMeta { } if ( reactive ) { // for reactive calls, don't use the returnType param, which has been ununi-ed, we want to check the full one - final String returnTypeName = method.getReturnType().toString(); + final String returnTypeName = fullReturnType(method); return returnTypeName.equals( UNI_VOID ) || returnTypeName.equals( UNI_BOOLEAN ) || returnTypeName.equals( UNI_INTEGER ); @@ -2824,10 +2832,7 @@ public class AnnotationMetaEntity extends AnnotationMeta { private TypeMirror parameterType(VariableElement parameter) { final ExecutableElement method = (ExecutableElement) parameter.getEnclosingElement(); - final ExecutableType methodType = - (ExecutableType) context.getTypeUtils() - .asMemberOf((DeclaredType) element.asType(), method); - final TypeMirror type = methodType.getParameterTypes() + final TypeMirror type = memberMethodType(method).getParameterTypes() .get( method.getParameters().indexOf(parameter) ); switch ( type.getKind() ) { case TYPEVAR: @@ -2844,6 +2849,11 @@ public class AnnotationMetaEntity extends AnnotationMeta { } } + private ExecutableType memberMethodType(ExecutableElement method) { + return (ExecutableType) context.getTypeUtils() + .asMemberOf((DeclaredType) element.asType(), method); + } + private static List parameterPatterns(ExecutableElement method) { return method.getParameters().stream() .map(param -> hasAnnotation(param, PATTERN)) diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/CriteriaDeleteMethod.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/CriteriaDeleteMethod.java index 7d828ac3a2..b40cb93a5a 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/CriteriaDeleteMethod.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/CriteriaDeleteMethod.java @@ -17,12 +17,11 @@ import static java.util.Collections.emptyList; public class CriteriaDeleteMethod extends AbstractCriteriaMethod { private final List paramNullability; - private final String returnType; CriteriaDeleteMethod( AnnotationMetaEntity annotationMetaEntity, ExecutableElement method, - String methodName, String entity, String returnType, + String methodName, String entity, List paramNames, List paramTypes, List paramNullability, @@ -32,11 +31,12 @@ public class CriteriaDeleteMethod extends AbstractCriteriaMethod { String sessionType, String sessionName, boolean addNonnullAnnotation, - boolean dataRepository) { + boolean dataRepository, + String fullReturnType) { super( annotationMetaEntity, method, methodName, entity, belongsToDao, sessionType, sessionName, emptyList(), - paramNames, paramTypes, emptyList(), addNonnullAnnotation, dataRepository, multivalued, paramPatterns ); + paramNames, paramTypes, emptyList(), addNonnullAnnotation, dataRepository, multivalued, paramPatterns, + fullReturnType); this.paramNullability = paramNullability; - this.returnType = returnType; } @Override @@ -49,10 +49,10 @@ public class CriteriaDeleteMethod extends AbstractCriteriaMethod { return true; } - @Override - String returnType() { - return returnType; - } +// @Override +// String returnType() { +// return returnType; +// } @Override void executeQuery(StringBuilder declaration, List paramTypes) { @@ -64,7 +64,7 @@ public class CriteriaDeleteMethod extends AbstractCriteriaMethod { void tryReturn(StringBuilder declaration) { declaration .append("\n\ttry {\n\t\t"); - if ( !"void".equals(returnType) ) { + if ( !"void".equals(fullReturnType) ) { declaration .append("return "); } diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/CriteriaFinderMethod.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/CriteriaFinderMethod.java index 9824ef93f2..1b609c1646 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/CriteriaFinderMethod.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/CriteriaFinderMethod.java @@ -7,8 +7,6 @@ package org.hibernate.processor.annotation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.hibernate.AssertionFailure; -import org.hibernate.processor.util.Constants; import javax.lang.model.element.ExecutableElement; import java.util.List; @@ -36,9 +34,11 @@ public class CriteriaFinderMethod extends AbstractCriteriaMethod { List fetchProfiles, List orderBys, boolean addNonnullAnnotation, - boolean dataRepository) { + boolean dataRepository, + String fullReturnType) { super( annotationMetaEntity, method, methodName, entity, belongsToDao, sessionType, sessionName, fetchProfiles, - paramNames, paramTypes, orderBys, addNonnullAnnotation, dataRepository, multivalued, paramPatterns ); + paramNames, paramTypes, orderBys, addNonnullAnnotation, dataRepository, multivalued, paramPatterns, + fullReturnType); this.containerType = containerType; this.paramNullability = paramNullability; } @@ -100,31 +100,31 @@ public class CriteriaFinderMethod extends AbstractCriteriaMethod { return "createQuery"; } - @Override - String returnType() { - final StringBuilder type = new StringBuilder(); - if ( "[]".equals(containerType) ) { - if ( returnTypeName == null ) { - throw new AssertionFailure("array return type, but no type name"); - } - type.append(annotationMetaEntity.importType(returnTypeName)).append("[]"); - } - else { - final boolean returnsUni = isReactive() && isUnifiableReturnType(containerType); - if ( returnsUni ) { - type.append(annotationMetaEntity.importType(Constants.UNI)).append('<'); - } - if ( containerType != null ) { - type.append(annotationMetaEntity.importType(containerType)).append('<'); - } - type.append(annotationMetaEntity.importType(entity)); - if ( containerType != null ) { - type.append('>'); - } - if ( returnsUni ) { - type.append('>'); - } - } - return type.toString(); - } +// @Override +// String returnType() { +// final StringBuilder type = new StringBuilder(); +// if ( "[]".equals(containerType) ) { +// if ( returnTypeName == null ) { +// throw new AssertionFailure("array return type, but no type name"); +// } +// type.append(annotationMetaEntity.importType(returnTypeName)).append("[]"); +// } +// else { +// final boolean returnsUni = isReactive() && isUnifiableReturnType(containerType); +// if ( returnsUni ) { +// type.append(annotationMetaEntity.importType(Constants.UNI)).append('<'); +// } +// if ( containerType != null ) { +// type.append(annotationMetaEntity.importType(containerType)).append('<'); +// } +// type.append(annotationMetaEntity.importType(entity)); +// if ( containerType != null ) { +// type.append('>'); +// } +// if ( returnsUni ) { +// type.append('>'); +// } +// } +// return type.toString(); +// } } diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/IdFinderMethod.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/IdFinderMethod.java index b165a0081c..ae98a01b0a 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/IdFinderMethod.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/IdFinderMethod.java @@ -30,9 +30,10 @@ public class IdFinderMethod extends AbstractFinderMethod { String sessionName, List fetchProfiles, boolean addNonnullAnnotation, - boolean dataRepository) { + boolean dataRepository, + String fullReturnType) { super( annotationMetaEntity, method, methodName, entity, belongsToDao, sessionType, sessionName, fetchProfiles, - paramNames, paramTypes, emptyList(), addNonnullAnnotation, dataRepository ); + paramNames, paramTypes, emptyList(), addNonnullAnnotation, dataRepository, fullReturnType ); int idParameter = idParameter(paramNames, paramTypes); this.paramName = paramNames.get(idParameter); this.paramType = paramTypes.get(idParameter); @@ -61,7 +62,8 @@ public class IdFinderMethod extends AbstractFinderMethod { public String getAttributeDeclarationString() { final StringBuilder declaration = new StringBuilder(); comment( declaration ); - preamble( declaration ); + modifiers( declaration ); + preamble( declaration, paramTypes ); if ( paramName != null && !isPrimitive(paramType) ) { nullCheck( declaration, paramName ); } diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/NaturalIdFinderMethod.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/NaturalIdFinderMethod.java index 6605e4a8f9..6124969505 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/NaturalIdFinderMethod.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/NaturalIdFinderMethod.java @@ -29,9 +29,10 @@ public class NaturalIdFinderMethod extends AbstractFinderMethod { String sessionName, List fetchProfiles, boolean addNonnullAnnotation, - boolean dataRepository) { + boolean dataRepository, + String fullReturnType) { super( annotationMetaEntity, method, methodName, entity, belongsToDao, sessionType, sessionName, fetchProfiles, - paramNames, paramTypes, emptyList(), addNonnullAnnotation, dataRepository ); + paramNames, paramTypes, emptyList(), addNonnullAnnotation, dataRepository, fullReturnType ); this.paramNullability = paramNullability; } @@ -50,7 +51,8 @@ public class NaturalIdFinderMethod extends AbstractFinderMethod { public String getAttributeDeclarationString() { final StringBuilder declaration = new StringBuilder(); comment( declaration ); - preamble( declaration ); + modifiers( declaration ); + preamble( declaration, paramTypes ); tryReturn( declaration ); unwrapSession( declaration ); if ( isReactive() ) { diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/QueryMethod.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/QueryMethod.java index d05417b5a2..88e9d7434e 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/QueryMethod.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/QueryMethod.java @@ -7,14 +7,12 @@ package org.hibernate.processor.annotation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.hibernate.AssertionFailure; import org.hibernate.internal.util.StringHelper; import javax.lang.model.element.ExecutableElement; import java.util.List; import static org.hibernate.processor.util.Constants.QUERY; -import static org.hibernate.processor.util.Constants.UNI; import static org.hibernate.processor.util.StringUtil.getUpperUnderscoreCaseFromLowerCamelCase; /** @@ -48,14 +46,16 @@ public class QueryMethod extends AbstractQueryMethod { String sessionName, List orderBys, boolean addNonnullAnnotation, - boolean dataRepository) { + boolean dataRepository, + String fullReturnType) { super( annotationMetaEntity, method, methodName, paramNames, paramTypes, returnTypeName, sessionType, sessionName, belongsToDao, orderBys, addNonnullAnnotation, - dataRepository ); + dataRepository, + fullReturnType ); this.queryString = queryString; this.returnTypeClass = returnTypeClass; this.containerType = containerType; @@ -86,15 +86,14 @@ public class QueryMethod extends AbstractQueryMethod { @Override public String getAttributeDeclarationString() { final List paramTypes = parameterTypes(); - final String returnType = returnType(); final StringBuilder declaration = new StringBuilder(); comment( declaration ); modifiers( paramTypes, declaration ); - preamble( declaration, returnType, paramTypes ); + preamble( declaration, paramTypes ); collectOrdering( declaration, paramTypes ); chainSession( declaration ); tryReturn( declaration, paramTypes, containerType ); - castResult( declaration, returnType ); + castResult( declaration ); createQuery( declaration ); setParameters( declaration, paramTypes, ""); handlePageParameters( declaration, paramTypes, containerType ); @@ -142,14 +141,14 @@ public class QueryMethod extends AbstractQueryMethod { } } - private void castResult(StringBuilder declaration, String returnType) { + private void castResult(StringBuilder declaration) { if ( isNative && returnTypeName != null && containerType == null && isUsingEntityManager() ) { // EntityManager.createNativeQuery() does not return TypedQuery, // so we need to cast to the entity type declaration .append("(") - .append(returnType) + .append(fullReturnType) .append(") "); } } @@ -211,34 +210,34 @@ public class QueryMethod extends AbstractQueryMethod { .append(")\n"); } - private String returnType() { - final StringBuilder type = new StringBuilder(); - if ( "[]".equals(containerType) ) { - if ( returnTypeName == null ) { - throw new AssertionFailure("array return type, but no type name"); - } - type.append(annotationMetaEntity.importType(returnTypeName)).append("[]"); - } - else { - final boolean returnsUni = isReactive() && isUnifiableReturnType(containerType); - if ( returnsUni ) { - type.append(annotationMetaEntity.importType(UNI)).append('<'); - } - if ( containerType != null ) { - type.append(annotationMetaEntity.importType(containerType)); - if ( returnTypeName != null ) { - type.append("<").append(annotationMetaEntity.importType(returnTypeName)).append(">"); - } - } - else if ( returnTypeName != null ) { - type.append(annotationMetaEntity.importType(returnTypeName)); - } - if ( returnsUni ) { - type.append('>'); - } - } - return type.toString(); - } +// private String returnType() { +// final StringBuilder type = new StringBuilder(); +// if ( "[]".equals(containerType) ) { +// if ( returnTypeName == null ) { +// throw new AssertionFailure("array return type, but no type name"); +// } +// type.append(annotationMetaEntity.importType(returnTypeName)).append("[]"); +// } +// else { +// final boolean returnsUni = isReactive() && isUnifiableReturnType(containerType); +// if ( returnsUni ) { +// type.append(annotationMetaEntity.importType(UNI)).append('<'); +// } +// if ( containerType != null ) { +// type.append(annotationMetaEntity.importType(containerType)); +// if ( returnTypeName != null ) { +// type.append("<").append(annotationMetaEntity.importType(returnTypeName)).append(">"); +// } +// } +// else if ( returnTypeName != null ) { +// type.append(annotationMetaEntity.importType(returnTypeName)); +// } +// if ( returnsUni ) { +// type.append('>'); +// } +// } +// return type.toString(); +// } private void comment(StringBuilder declaration) { declaration