@@ -89,12 +89,12 @@ final class ClientMethodWriter {
8989 }
9090
9191 void addImportTypes (ControllerReader reader ) {
92- if (useJsonb ) {
92+ if (useInject ) {
93+ reader .addImportType ("io.avaje.inject.spi.GenericType" );
94+ } else if (useJsonb ) {
9395 reader .addImportType ("io.avaje.jsonb.Types" );
9496 } else if (useJackson ) {
9597 reader .addImportType ("com.fasterxml.jackson.core.type.TypeReference" );
96- } else if (useInject ) {
97- reader .addImportType ("io.avaje.inject.spi.GenericType" );
9898 }
9999 reader .addImportTypes (returnType .importTypes ());
100100 method .throwsList ().stream ()
@@ -263,18 +263,20 @@ private void writeResponse(UType type) {
263263 }
264264
265265 void writeGeneric (UType type ) {
266- if (type .isGeneric () && useJsonb ) {
266+ if (type .isGeneric () && useInject ) {
267+ writer .append ("new GenericType<%s>() {}.type()" , type .shortType ());
268+ } else if (type .isGeneric () && useJsonb ) {
267269 final var params =
268- type .importTypes ().stream ()
269- .skip (1 )
270- .map (Util ::shortName )
271- .collect (Collectors .joining (".class, " ));
272-
273- writer .append ("Types.newParameterizedType(%s.class, %s.class)" , Util .shortName (type .mainType ()), params );
270+ type .importTypes ().stream ()
271+ .skip (1 )
272+ .map (Util ::shortName )
273+ .collect (Collectors .joining (".class, " ));
274+
275+ writer .append (
276+ "Types.newParameterizedType(%s.class, %s.class)" ,
277+ Util .shortName (type .mainType ()), params );
274278 } else if (type .isGeneric () && useJackson ) {
275279 writer .append ("new TypeReference<%s>() {}.getType()" , type .shortType ());
276- } else if (type .isGeneric () && useInject ) {
277- writer .append ("new GenericType<%s>() {}.getType()" , type .shortType ());
278280 } else {
279281 writer .append ("%s.class" , Util .shortName (type .mainType ()));
280282 }
0 commit comments