@@ -117,8 +117,7 @@ String specificationType() {
117117
118118	@ Override 
119119	void  createQuery (StringBuilder  declaration ) {
120- 		final  boolean  specification  = isUsingSpecification ();
121- 		if  ( specification  ) {
120+ 		if  ( isUsingSpecification () ) {
122121			if  ( isReactive () ) {
123122				declaration 
124123						.append (localSessionName ())
@@ -226,9 +225,8 @@ else if ( BOOLEAN.equals(returnTypeName) ) {
226225	@ Override 
227226	void  setParameters (StringBuilder  declaration , List <String > paramTypes , String  indent ) {
228227		for  ( int  i  = 0 ; i  < paramNames .size (); i ++ ) {
229- 			final  String  paramName  = paramNames .get (i );
230- 			final  String  paramType  = paramTypes .get (i );
231- 			if  ( !isSpecialParam (paramType ) ) {
228+ 			if  ( !isSpecialParam ( paramTypes .get (i ) ) ) {
229+ 				final  String  paramName  = paramNames .get (i );
232230				final  int  ordinal  = i +1 ;
233231				if  ( queryString .contains (":"  + paramName ) ) {
234232					declaration .append (indent );
@@ -291,8 +289,7 @@ private static void setNamedParameter(StringBuilder declaration, String paramNam
291289
292290	private  void  comment (StringBuilder  declaration ) {
293291		declaration 
294- 				.append ("\n /**" );
295- 		declaration 
292+ 				.append ("\n /**" )
296293				.append ("\n  * Execute the query {@value #" )
297294				.append (getConstantName ())
298295				.append ("}." )
@@ -303,7 +300,8 @@ private void comment(StringBuilder declaration) {
303300	}
304301
305302	private  void  modifiers (StringBuilder  declaration , List <String > paramTypes ) {
306- 		boolean  hasVarargs  = paramTypes .stream ().anyMatch (ptype  -> ptype .endsWith ("..." ));
303+ 		final  boolean  hasVarargs  =
304+ 				paramTypes .stream ().anyMatch (ptype  -> ptype .endsWith ("..." ));
307305		if  ( hasVarargs  ) {
308306			declaration 
309307					.append ("@SafeVarargs\n " );
@@ -326,15 +324,16 @@ void nullChecks(StringBuilder declaration, List<String> paramTypes) {
326324		for  ( int  i  = 0 ; i <paramNames .size (); i ++ ) {
327325			final  String  paramType  = paramTypes .get ( i  );
328326			// we don't do null checks on query parameters 
329- 			if  ( isSessionParameter (  paramType  ) ||  isSpecialParam (  paramType ) ) {
327+ 			if  ( isSpecialParam (paramType ) ) {
330328				nullCheck ( declaration , paramNames .get (i ) );
331329			}
332330		}
333331	}
334332
335333	@ Override 
336334	public  String  getAttributeNameDeclarationString () {
337- 		StringBuilder  declaration  = new  StringBuilder ( queryString .length () + 200  );
335+ 		final  StringBuilder  declaration  =
336+ 				new  StringBuilder ( queryString .length () + 200  );
338337		declaration 
339338				.append ("\n /**\n  * @see " )
340339				.append ("#" );
@@ -346,42 +345,33 @@ public String getAttributeNameDeclarationString() {
346345				.append ( " = \" "  );
347346		for  ( int  i  = 0 ; i  < queryString .length (); i ++ ) {
348347			final  char  c  = queryString .charAt ( i  );
349- 			switch  ( c  ) {
350- 				case  '\r' :
351- 					declaration .append ( "\\ r"  );
352- 					break ;
353- 				case  '\n' :
354- 					declaration .append ( "\\ n"  );
355- 					break ;
356- 				case  '\\' :
357- 					declaration .append ( "\\ \\ "  );
358- 					break ;
359- 				case  '"' :
360- 					declaration .append ( "\\ \" "  );
361- 					break ;
362- 				default :
363- 					declaration .append ( c  );
364- 					break ;
365- 			}
348+ 			declaration .append (switch  ( c  ) {
349+ 				case  '\r'  -> "\\ r" ;
350+ 				case  '\n'  -> "\\ n" ;
351+ 				case  '\\'  -> "\\ \\ " ;
352+ 				case  '"'  -> "\\ \" " ;
353+ 				default  -> c ;
354+ 			});
366355		}
367- 		return  declaration .append ("\" ;" ).toString ();
356+ 		return  declaration 
357+ 				.append ("\" ;" )
358+ 				.toString ();
368359	}
369360
370361	private  String  getConstantName () {
371362		final  String  stem  = getUpperUnderscoreCaseFromLowerCamelCase (methodName );
372- 		if  ( paramTypes .isEmpty () ) {
373- 			return  stem ;
374- 		}
375- 		else  {
376- 			return  stem  + "_" 
377- 					+ paramTypes .stream ()
378- 							.filter (type  -> !isSpecialParam (type ))
379- 							.map (type  -> type .indexOf ('<' )>0  ? type .substring (0 , type .indexOf ('<' )) : type )
380- 							.map (StringHelper ::unqualify )
381- 							.map (type  -> type .replace ("[]" , "Array" ))
382- 							.reduce ((x ,y ) -> x  + '_'  + y )
383- 							.orElse ("" );
384- 		}
363+ 		return  paramTypes .isEmpty ()
364+ 			|| paramTypes .stream ().allMatch (AbstractQueryMethod ::isSpecialParam )
365+ 				? stem 
366+ 				: stem  + "_"  + paramTypes .stream ()
367+ 						.filter ( type  -> !isSpecialParam (type ) )
368+ 						.map ( type  -> type .indexOf ('<' ) > 0 
369+ 								? type .substring (0 , type .indexOf ('<' ))
370+ 								: type  )
371+ 						.map ( StringHelper ::unqualify  )
372+ 						.map ( type  -> type .replace ("[]" , "Array" ) )
373+ 						.reduce ( (x , y ) -> x  + '_'  + y  )
374+ 						.orElseThrow ();
385375	}
386376
387377	public  String  getTypeDeclaration () {
0 commit comments