Inspectopedia Help

Java methods should be replaced with Kotlin analog

Reports a Java method call that can be replaced with a Kotlin function, for example, System.out.println().

Replacing the code gets rid of the dependency to Java and makes the idiomatic Kotlin code.

The quick-fix replaces the Java method calls on the same Kotlin call.

Example:

import java.util.Arrays fun main() { val a = Arrays.asList(1, 3, null) }

After the quick-fix is applied:

fun main() { val a = listOf(1, 3, null) }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Kotlin, @snapshot@

Last modified: 13 July 2023