From df99e1c6261c26f9e665ab57179e4a1d3a1ddcb2 Mon Sep 17 00:00:00 2001
From: Knut Wannheden <knut@moderne.io>
Date: Thu, 7 Sep 2023 15:32:51 +0200
Subject: [PATCH] Let type mapper handle `Map<*, *>`

---
 .../openrewrite/kotlin/KotlinTypeSignatureBuilder.kt |  2 ++
 .../kotlin/tree/ClassDeclarationTest.java            | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/src/main/kotlin/org/openrewrite/kotlin/KotlinTypeSignatureBuilder.kt b/src/main/kotlin/org/openrewrite/kotlin/KotlinTypeSignatureBuilder.kt
index 0a6d37c88..e03ecce6c 100644
--- a/src/main/kotlin/org/openrewrite/kotlin/KotlinTypeSignatureBuilder.kt
+++ b/src/main/kotlin/org/openrewrite/kotlin/KotlinTypeSignatureBuilder.kt
@@ -376,6 +376,8 @@ class KotlinTypeSignatureBuilder(private val firSession: FirSession) : JavaTypeS
             }
             s.append(boundSigs)
             s.append("}")
+        } else if (type is ConeCapturedType && type.lowerType == null) {
+            s.append("*")
         } else {
             throw IllegalArgumentException("Unsupported ConeTypeProjection " + type.javaClass.getName())
         }
diff --git a/src/test/java/org/openrewrite/kotlin/tree/ClassDeclarationTest.java b/src/test/java/org/openrewrite/kotlin/tree/ClassDeclarationTest.java
index f901d0fc6..986098a29 100644
--- a/src/test/java/org/openrewrite/kotlin/tree/ClassDeclarationTest.java
+++ b/src/test/java/org/openrewrite/kotlin/tree/ClassDeclarationTest.java
@@ -552,4 +552,16 @@ class Inner
           )
         );
     }
+
+    @Test
+    void coneProjection() {
+        rewriteRun(
+          kotlin(
+            """
+              val map = mapOf(Pair("one", 1)) as? Map<*, *>
+              val s = map.orEmpty().entries.joinToString { (key, value) -> "$key: $value" }
+              """
+          )
+        );
+    }
 }