From 3676a9249bb42243b0114ff9a576999b62d038e7 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Fri, 22 Mar 2024 19:53:56 +0100 Subject: [PATCH] aesthetic fix to the processor-generated jdoc --- .../annotation/AbstractFinderMethod.java | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) 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 5e561eac3f..de70d7ea18 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 @@ -92,34 +92,38 @@ public abstract class AbstractFinderMethod extends AbstractQueryMethod { .append("\n * Find ") .append("{@link ") .append(annotationMetaEntity.importType(entity)) - .append("} by "); + .append("}"); long paramCount = paramTypes.stream() .filter(type -> !isSpecialParam(type)) .count(); - int count = 0; - for (int i = 0; i < paramTypes.size(); i++) { - String type = paramTypes.get(i); - if ( !isSpecialParam(type) ) { - if ( count>0 ) { - if ( count + 1 == paramCount) { - declaration - .append(paramCount>2 ? ", and " : " and "); //Oxford comma - } - else { - declaration - .append(", "); + if ( paramCount> 0 ) { + declaration + .append(" by "); + int count = 0; + for (int i = 0; i < paramTypes.size(); i++) { + final String type = paramTypes.get(i); + if ( !isSpecialParam(type) ) { + if ( count>0 ) { + if ( count + 1 == paramCount) { + declaration + .append(paramCount>2 ? ", and " : " and "); //Oxford comma + } + else { + declaration + .append(", "); + } } + count++; + final String path = paramNames.get(i); + declaration + .append("{@link ") + .append(annotationMetaEntity.importType(entity)) + .append('#') + .append(qualifier(path)) + .append(' ') + .append(path) + .append("}"); } - count++; - final String path = paramNames.get(i); - declaration - .append("{@link ") - .append(annotationMetaEntity.importType(entity)) - .append('#') - .append(qualifier(path)) - .append(' ') - .append(path) - .append("}"); } } declaration