quick questions: 1. How can I find out whether th...
# kontributors
d
quick questions: 1. How can I find out whether the context in which my
AbstractKotlinInspection
is taking place has
java.util.EnumMap
(e.g. not js platform)? 2. My replacement pattern is
java.util.EnumMap
, but I think it would be more idiomatic to add an import and use
EnumMap
directly. I couldn't find any examples of this, which classes should I be looking at? 3. I have a
KotlinType
of which I want to create a fragment
E::class.java
, but using toString looks nasty here, what would be a better approach?
call.replace(factory.createExpressionByPattern("java.util.EnumMap($0::class.java)", enumClass.toString()))
Thanks!
d
1. I think we have
platform
extension on pretty much everything that can theoretically have a platform. In particular, there’s a
KtElement.platform
in
Platform.kt
2. Check
ImportInsertHelper
3. Does
toString
approach work for you at all? I was under impression that
KotlinType.toString
produces pretty verbose debug output that is not suited to be pasted into Kotlin sources.