File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
plugins/kotlin/src/main/java/org/vineflower/kotlin/util Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,16 @@ public static String getKotlinType(VarType type, boolean includeOuterClasses) {
166166 }
167167
168168 private static String mapJavaTypeToKotlin (String type ) {
169+ if (type .startsWith ("?" )) {
170+ if (type .equals ("?" )) {
171+ return "*" ;
172+ } else if (type .startsWith ("? extends " )) {
173+ return "out " + type .substring ("? extends " .length ());
174+ } else if (type .startsWith ("? super " )) {
175+ return "in " + type .substring ("? super " .length ());
176+ }
177+ }
178+
169179 if (type .endsWith ("[]" )) {
170180 String baseType = type .substring (0 , type .length () - 2 );
171181 return switch (baseType ) {
@@ -191,6 +201,12 @@ private static String mapJavaTypeToKotlin(String type) {
191201 boolean appendDot = false ;
192202 for (String part : parts ) {
193203 Matcher matcher = GENERICS_PATTERN .matcher (part );
204+
205+ if (appendDot ) {
206+ sb .append ("." );
207+ }
208+ appendDot = true ;
209+
194210 if (matcher .matches ()) {
195211 sb .append (mapJavaTypeToKotlin (matcher .group (1 )));
196212 sb .append ("<" );
@@ -204,11 +220,7 @@ private static String mapJavaTypeToKotlin(String type) {
204220 }
205221 sb .append (">" );
206222 } else {
207- if (appendDot ) {
208- sb .append ("." );
209- }
210223 sb .append (part );
211- appendDot = true ;
212224 }
213225 }
214226 yield sb .toString ();
You can’t perform that action at this time.
0 commit comments