Report error on declaring 'getClass' in class or package

#KT-14147 Fixed
This commit is contained in:
Alexander Udalov
2016-10-03 10:44:57 +03:00
parent dca094e971
commit 597912824b
4 changed files with 8 additions and 3 deletions
@@ -43,6 +43,7 @@ private val EXTERNAL_SOURCES_KINDS = arrayOf(
) )
private val PREDEFINED_SIGNATURES = listOf( private val PREDEFINED_SIGNATURES = listOf(
"getClass()Ljava/lang/Class;",
"notify()V", "notify()V",
"notifyAll()V", "notifyAll()V",
"wait()V", "wait()V",
@@ -8,6 +8,7 @@ class A {
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait()<!> {} <!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait()<!> {}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait(l: Long)<!> {} <!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait(l: Long)<!> {}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait(l: Long, i: Int)<!> {} <!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 notify()<!> {}
@@ -15,3 +16,4 @@ class A {
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait()<!> {} <!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait()<!> {}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait(l: Long)<!> {} <!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait(l: Long)<!> {}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait(l: Long, i: Int)<!> {} <!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun wait(l: Long, i: Int)<!> {}
<!CONFLICTING_INHERITED_JVM_DECLARATIONS!>fun getClass(): Class<Any><!> = null!!
@@ -1,5 +1,6 @@
package package
public fun getClass(): java.lang.Class<kotlin.Any>
public fun notify(): kotlin.Unit public fun notify(): kotlin.Unit
public fun notifyAll(): kotlin.Unit public fun notifyAll(): kotlin.Unit
public fun wait(): kotlin.Unit public fun wait(): kotlin.Unit
@@ -9,6 +10,7 @@ public fun wait(/*0*/ l: kotlin.Long, /*1*/ i: kotlin.Int): kotlin.Unit
public final class A { public final class A {
public constructor A() public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean 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 open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final fun notify(): kotlin.Unit public final fun notify(): kotlin.Unit
public final fun notifyAll(): kotlin.Unit public final fun notifyAll(): kotlin.Unit
@@ -6278,9 +6278,9 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName); doTest(fileName);
} }
@TestMetadata("waitNotify.kt") @TestMetadata("waitNotifyGetClass.kt")
public void testWaitNotify() throws Exception { public void testWaitNotifyGetClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature/finalMembersFromBuiltIns/waitNotify.kt"); String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature/finalMembersFromBuiltIns/waitNotifyGetClass.kt");
doTest(fileName); doTest(fileName);
} }
} }