Report JVM signature clashes from JVM_IR

Also:

* Do not rename public ABI fields
This includes backing fields for const, lateinit, @JvmField properties,
and instance fields for objects.

* FAKE_OVERRIDE declarations for static members of parent Java classes
Required to report cases when a Kotlin function accidentally overrides
Java class member.
This commit is contained in:
Dmitry Petrov
2020-02-10 11:27:48 +03:00
parent c1db9b6d40
commit 866f188120
233 changed files with 4487 additions and 44 deletions
@@ -0,0 +1,6 @@
enum class E {
ENTRY;
fun <!VIRTUAL_MEMBER_HIDDEN!>getDeclaringClass<!>() {}
fun <!VIRTUAL_MEMBER_HIDDEN!>finalize<!>() {}
}
@@ -0,0 +1,20 @@
package
public final enum class E : kotlin.Enum<E> {
enum entry ENTRY
private constructor E()
public final override /*1*/ /*fake_override*/ val name: kotlin.String
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: E): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
public final override /*1*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): kotlin.Unit
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): E
public final /*synthesized*/ fun values(): kotlin.Array<E>
}
@@ -0,0 +1,20 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// TARGET_BACKEND: JVM_IR
// KT-7174 Report error on members with the same signature as non-overridable methods from mapped Java types (like Object.wait/notify)
class A {
<!ACCIDENTAL_OVERRIDE!>fun notify()<!> {}
<!ACCIDENTAL_OVERRIDE!>fun notifyAll()<!> {}
<!ACCIDENTAL_OVERRIDE!>fun wait()<!> {}
<!ACCIDENTAL_OVERRIDE!>fun wait(l: Long)<!> {}
<!ACCIDENTAL_OVERRIDE!>fun wait(l: Long, i: Int)<!> {}
<!ACCIDENTAL_OVERRIDE!>fun getClass(): Class<Any><!> = null!!
}
<!ACCIDENTAL_OVERRIDE!>fun notify()<!> {}
<!ACCIDENTAL_OVERRIDE!>fun notifyAll()<!> {}
<!ACCIDENTAL_OVERRIDE!>fun wait()<!> {}
<!ACCIDENTAL_OVERRIDE!>fun wait(l: Long)<!> {}
<!ACCIDENTAL_OVERRIDE!>fun wait(l: Long, i: Int)<!> {}
<!ACCIDENTAL_OVERRIDE!>fun getClass(): Class<Any><!> = null!!
@@ -0,0 +1,21 @@
package
public fun getClass(): java.lang.Class<kotlin.Any>
public fun notify(): kotlin.Unit
public fun notifyAll(): kotlin.Unit
public fun wait(): kotlin.Unit
public fun wait(/*0*/ l: kotlin.Long): kotlin.Unit
public fun wait(/*0*/ l: kotlin.Long, /*1*/ i: kotlin.Int): kotlin.Unit
public final class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun getClass(): java.lang.Class<kotlin.Any>
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final fun notify(): kotlin.Unit
public final fun notifyAll(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final fun wait(): kotlin.Unit
public final fun wait(/*0*/ l: kotlin.Long): kotlin.Unit
public final fun wait(/*0*/ l: kotlin.Long, /*1*/ i: kotlin.Int): kotlin.Unit
}
@@ -0,0 +1,20 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// TARGET_BACKEND: JVM_OLD
// KT-7174 Report error on members with the same signature as non-overridable methods from mapped Java types (like Object.wait/notify)
class A {
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun notify()<!> {}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun notifyAll()<!> {}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait()<!> {}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait(l: Long)<!> {}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait(l: Long, i: Int)<!> {}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun getClass(): Class<Any><!> = null!!
}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun notify()<!> {}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun notifyAll()<!> {}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait()<!> {}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait(l: Long)<!> {}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait(l: Long, i: Int)<!> {}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun getClass(): Class<Any><!> = null!!
@@ -0,0 +1,21 @@
package
public fun getClass(): java.lang.Class<kotlin.Any>
public fun notify(): kotlin.Unit
public fun notifyAll(): kotlin.Unit
public fun wait(): kotlin.Unit
public fun wait(/*0*/ l: kotlin.Long): kotlin.Unit
public fun wait(/*0*/ l: kotlin.Long, /*1*/ i: kotlin.Int): kotlin.Unit
public final class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun getClass(): java.lang.Class<kotlin.Any>
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final fun notify(): kotlin.Unit
public final fun notifyAll(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final fun wait(): kotlin.Unit
public final fun wait(/*0*/ l: kotlin.Long): kotlin.Unit
public final fun wait(/*0*/ l: kotlin.Long, /*1*/ i: kotlin.Int): kotlin.Unit
}