openrewrite / rewrite-kotlin

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

Let `Autodetect` handle unqualified function imports #589

Closed knutwannheden closed 5 months ago

knutwannheden commented 5 months ago

Unqualified function imports are modelled in a peculiar way, as J.Import currently requires a J.FieldAccess. This modelling with a J.Empty later leads to a ClassCastException when calling packageName() on the import.

Until a proper fix is here (changing the model), this commit changes Autodetect so that it doesn't provoke the ClassCastException.