Quick Answer
Proper syntax for Java interop
Understanding the Issue
Kotlin treats Java static methods differently than Java instance methods. They appear as members of the companion object in Kotlin or need special syntax.
The Problem
This code demonstrates the issue:
Kotlin
Error
// Problem: Incorrect call
Collections.sort(list) // Error in Kotlin
The Solution
Here's the corrected code:
Kotlin
Fixed
// Solution 1: Use companion syntax
Collections.Sort(list)
// Solution 2: Kotlin alternative
list.sort()
// Solution 3: Import as extension
import java.util.Collections.sort
sort(list)
Key Takeaways
Use companion object syntax or Kotlin alternatives for Java static methods.