openrewrite / rewrite-kotlin

Work-in-progress implementation of Kotlin language support for OpenRewrite.
Apache License 2.0
38 stars 11 forks source link

Type mapping issue: Incorrect method type on SAM constructors #527

Closed traceyyoshima closed 6 months ago

traceyyoshima commented 6 months ago
                 val s = java.util.function.Supplier<String> {
                     @Suppress("UNCHECKED_CAST")
                     requireNotNull("x")
                 }
traceyyoshima commented 6 months ago

TODO: Identify the method type from the Java compiler so that we can reproduce the type in Kotlin type mapping. Confirmed that Java creates a constructor method type. Java creates a unique name for each anonymous class that has a unique name $1, $2,$3`. Kotlin doesn't create unique names, which can lead to type issues due to two types sharing the same cache key.