Questions tagged [jvm-default]

2 questions
49
votes
5 answers

@JvmDefault and how add compiler option

I need to make a default void method in a Kotlin interface. I ran into a problem and a hint said Usage of @JvmDefault is only allowed with -Xjvm-default option. Where do I need to write this Xjvm-default?
Evgesha
  • 491
  • 1
  • 4
  • 4
0
votes
0 answers

@JvmDefault not found sourceCompatibility/targetCompatibility assigned by project variable

I want to provide default implementation for method in my Kotlin interface: interface INavItem : Comparable { val order: Int @JvmDefault override fun compareTo(other: INavItem): Int = order.compareTo(other.order) } but…