@@ -31,7 +31,7 @@ public TypeDefinition(Types types, TypeMirror type) {
3131 }
3232
3333 public String toSourceCode (boolean kt ) {
34- return toSourceCode (this , kt );
34+ return toSourceCode (this , kt , false );
3535 }
3636
3737 public String getArgumentsString (boolean kt , boolean convertTypeVar , Set <TypeKind > kinds ) {
@@ -54,7 +54,7 @@ public String getArgumentsString(boolean kt, boolean convertTypeVar, Set<TypeKin
5454 .collect (Collectors .joining (", " , "<" , "> " ));
5555 }
5656
57- private static String toSourceCode (TypeDefinition type , boolean kt ) {
57+ private static String toSourceCode (TypeDefinition type , boolean kt , boolean generics ) {
5858 if (type .isParameterizedType ()) {
5959 var buffer = new StringBuilder ();
6060 var methodName =
@@ -78,12 +78,16 @@ private static String toSourceCode(TypeDefinition type, boolean kt) {
7878 .append (", " );
7979 }
8080 for (TypeDefinition arg : type .getArguments ()) {
81- buffer .append (toSourceCode (arg , kt )).append (separator );
81+ // Generics are always wrapper
82+ buffer .append (toSourceCode (arg , kt , true )).append (separator );
8283 }
8384 buffer .setLength (buffer .length () - separator .length ());
8485 buffer .append (").getType()" );
8586 return buffer .toString ();
8687 } else {
88+ if (generics && kt ) {
89+ return type .getRawType ().toString ().replace ("java.lang." , "" ) + clazz (kt );
90+ }
8791 return CodeBlock .type (kt , type .getRawType ().toString ()) + clazz (kt );
8892 }
8993 }
0 commit comments