Report the error when a declaration in Kotlin accidentally overrides a static member from Java
This commit is contained in:
+15
-7
@@ -29,11 +29,14 @@ import org.jetbrains.kotlin.fileClasses.JvmFileClassesProvider
|
|||||||
import org.jetbrains.kotlin.fileClasses.isInsideJvmMultifileClassFile
|
import org.jetbrains.kotlin.fileClasses.isInsideJvmMultifileClassFile
|
||||||
import org.jetbrains.kotlin.idea.MainFunctionDetector
|
import org.jetbrains.kotlin.idea.MainFunctionDetector
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.SamAdapterDescriptor
|
import org.jetbrains.kotlin.load.java.descriptors.SamAdapterDescriptor
|
||||||
|
import org.jetbrains.kotlin.load.java.descriptors.getParentJavaStaticClassScope
|
||||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
||||||
import org.jetbrains.kotlin.psi.JetNamedFunction
|
import org.jetbrains.kotlin.psi.JetNamedFunction
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.*
|
import org.jetbrains.kotlin.resolve.jvm.diagnostics.*
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
||||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@@ -105,14 +108,14 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
|||||||
if (origins.size() <= 1) continue
|
if (origins.size() <= 1) continue
|
||||||
|
|
||||||
var memberElement: PsiElement? = null
|
var memberElement: PsiElement? = null
|
||||||
var nonFakeCount = 0
|
var ownNonFakeCount = 0
|
||||||
for (origin in origins) {
|
for (origin in origins) {
|
||||||
val member = origin.descriptor as? CallableMemberDescriptor?
|
val member = origin.descriptor as? CallableMemberDescriptor?
|
||||||
if (member != null && member.getKind() != FAKE_OVERRIDE) {
|
if (member != null && member.containingDeclaration == classOrigin.descriptor && member.getKind() != FAKE_OVERRIDE) {
|
||||||
nonFakeCount++
|
ownNonFakeCount++
|
||||||
// If there's more than one real element, the clashing signature is already reported.
|
// If there's more than one real element, the clashing signature is already reported.
|
||||||
// Only clashes between fake overrides are interesting here
|
// Only clashes between fake overrides are interesting here
|
||||||
if (nonFakeCount > 1) continue@signatures
|
if (ownNonFakeCount > 1) continue@signatures
|
||||||
|
|
||||||
if (member.getKind() != DELEGATION) {
|
if (member.getKind() != DELEGATION) {
|
||||||
// Delegates don't have declarations in the code
|
// Delegates don't have declarations in the code
|
||||||
@@ -158,8 +161,13 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (member in descriptor.getDefaultType().getMemberScope().getDescriptors()) {
|
descriptor.defaultType.memberScope.getDescriptors().forEach(::processMember)
|
||||||
processMember(member)
|
descriptor.getParentJavaStaticClassScope()?.run {
|
||||||
|
getDescriptors(DescriptorKindFilter.FUNCTIONS)
|
||||||
|
.filter {
|
||||||
|
it is FunctionDescriptor && Visibilities.isVisible(ReceiverValue.IRRELEVANT_RECEIVER, it, descriptor)
|
||||||
|
}
|
||||||
|
.forEach(::processMember)
|
||||||
}
|
}
|
||||||
|
|
||||||
return groupedBySignature
|
return groupedBySignature
|
||||||
@@ -171,4 +179,4 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
|||||||
return descriptor.getKind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE
|
return descriptor.getKind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE
|
||||||
&& descriptor.getOverriddenDescriptors().all { isOrOverridesSamAdapter(it) }
|
&& descriptor.getOverriddenDescriptors().all { isOrOverridesSamAdapter(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+30
@@ -68,6 +68,36 @@ public class JetDiagnosticsWithJava8TestGenerated extends AbstractJetDiagnostics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/testsWithJava8/duplicateJvmSignature")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class DuplicateJvmSignature extends AbstractJetDiagnosticsWithFullJdkTest {
|
||||||
|
public void testAllFilesPresentInDuplicateJvmSignature() throws Exception {
|
||||||
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithJava8/duplicateJvmSignature"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/testsWithJava8/duplicateJvmSignature/statics")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class Statics extends AbstractJetDiagnosticsWithFullJdkTest {
|
||||||
|
public void testAllFilesPresentInStatics() throws Exception {
|
||||||
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithJava8/duplicateJvmSignature/statics"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("jjk.kt")
|
||||||
|
public void testJjk() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJava8/duplicateJvmSignature/statics/jjk.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("jk.kt")
|
||||||
|
public void testJk() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJava8/duplicateJvmSignature/statics/jk.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithJava8/statics")
|
@TestMetadata("compiler/testData/diagnostics/testsWithJava8/statics")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
// FILE: A.java
|
||||||
|
|
||||||
|
public class A {
|
||||||
|
public static void foo() {}
|
||||||
|
public static void baz(String s) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.java
|
||||||
|
|
||||||
|
public class B extends A {
|
||||||
|
public static void bar(int i) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: K.kt
|
||||||
|
|
||||||
|
open class K : B() {
|
||||||
|
<!ACCIDENTAL_OVERRIDE!>fun foo()<!> {}
|
||||||
|
fun foo(a: Any) {}
|
||||||
|
<!ACCIDENTAL_OVERRIDE!>fun bar(i: Int)<!> {}
|
||||||
|
fun bar(i: String) {}
|
||||||
|
fun baz(i: Int) {}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun foo() {}
|
||||||
|
fun bar(i: Int) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public open class 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 hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public open fun baz(/*0*/ s: kotlin.String!): kotlin.Unit
|
||||||
|
public open fun foo(): kotlin.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class B : A {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public open fun bar(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun baz(/*0*/ s: kotlin.String!): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class K : B {
|
||||||
|
public constructor K()
|
||||||
|
public final fun bar(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public final fun bar(/*0*/ i: kotlin.String): kotlin.Unit
|
||||||
|
public final fun baz(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(): kotlin.Unit
|
||||||
|
public final fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public companion object Companion {
|
||||||
|
private constructor Companion()
|
||||||
|
public final fun bar(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
// FILE: A.java
|
||||||
|
|
||||||
|
public class A {
|
||||||
|
public static int a = 1
|
||||||
|
public static void foo() {}
|
||||||
|
public static void baz(String s) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: K.kt
|
||||||
|
|
||||||
|
open class K : A() {
|
||||||
|
val a = 1
|
||||||
|
<!ACCIDENTAL_OVERRIDE!>fun foo()<!> {}
|
||||||
|
fun foo(i: Int) {}
|
||||||
|
fun baz(i: Int) {}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun foo() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public open class 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 hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public final var a: kotlin.Int
|
||||||
|
public open fun baz(/*0*/ s: kotlin.String!): kotlin.Unit
|
||||||
|
public open fun foo(): kotlin.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class K : A {
|
||||||
|
public constructor K()
|
||||||
|
public final val a: kotlin.Int = 1
|
||||||
|
public final fun baz(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(): kotlin.Unit
|
||||||
|
public final fun foo(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public companion object Companion {
|
||||||
|
private constructor Companion()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
// FILE: A.java
|
||||||
|
|
||||||
|
public class A {
|
||||||
|
public static void foo() {}
|
||||||
|
public static void baz(String s) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
|
open class B : A() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: C.java
|
||||||
|
|
||||||
|
public class C extends B {
|
||||||
|
public static void bar(int i) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: K.kt
|
||||||
|
|
||||||
|
open class K : C() {
|
||||||
|
<!ACCIDENTAL_OVERRIDE!>fun foo()<!> {}
|
||||||
|
fun foo(a: Any) {}
|
||||||
|
<!ACCIDENTAL_OVERRIDE!>fun bar(i: Int)<!> {}
|
||||||
|
fun bar(i: String) {}
|
||||||
|
fun baz(i: Int) {}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun foo() {}
|
||||||
|
fun bar(i: Int) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public open class 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 hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public open fun baz(/*0*/ s: kotlin.String!): kotlin.Unit
|
||||||
|
public open fun foo(): kotlin.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class B : A {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class C : B {
|
||||||
|
public constructor C()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public open fun bar(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun baz(/*0*/ s: kotlin.String!): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class K : C {
|
||||||
|
public constructor K()
|
||||||
|
public final fun bar(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public final fun bar(/*0*/ i: kotlin.String): kotlin.Unit
|
||||||
|
public final fun baz(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(): kotlin.Unit
|
||||||
|
public final fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public companion object Companion {
|
||||||
|
private constructor Companion()
|
||||||
|
public final fun bar(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
// FILE: foo/A.java
|
||||||
|
|
||||||
|
package foo;
|
||||||
|
|
||||||
|
public class A {
|
||||||
|
private static void foo(int s) {}
|
||||||
|
static void bar(double s) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: K.kt
|
||||||
|
import foo.A
|
||||||
|
|
||||||
|
open class K : A() {
|
||||||
|
fun foo(i: Int) {}
|
||||||
|
fun bar(d: Double) {}
|
||||||
|
fun baz(i: Int) {}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun foo(i: Int) {}
|
||||||
|
fun bar(d: Double) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public open class K : foo.A {
|
||||||
|
public constructor K()
|
||||||
|
public final fun bar(/*0*/ d: kotlin.Double): kotlin.Unit
|
||||||
|
public final fun baz(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public companion object Companion {
|
||||||
|
private constructor Companion()
|
||||||
|
public final fun bar(/*0*/ d: kotlin.Double): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
// FILE: A.java
|
||||||
|
|
||||||
|
public interface A {
|
||||||
|
public static void foo() {}
|
||||||
|
public static void baz(String s) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.java
|
||||||
|
|
||||||
|
public interface B extends A {
|
||||||
|
public static void bar(int i) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: K.kt
|
||||||
|
|
||||||
|
open class K : B {
|
||||||
|
fun foo() {}
|
||||||
|
fun foo(a: Any) {}
|
||||||
|
fun bar(i: Int) {}
|
||||||
|
fun bar(i: String) {}
|
||||||
|
fun baz(i: Int) {}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun foo() {}
|
||||||
|
fun bar(i: Int) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public interface A {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public open fun baz(/*0*/ s: kotlin.String!): kotlin.Unit
|
||||||
|
public open fun foo(): kotlin.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface B : A {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public open fun bar(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class K : B {
|
||||||
|
public constructor K()
|
||||||
|
public final fun bar(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public final fun bar(/*0*/ i: kotlin.String): kotlin.Unit
|
||||||
|
public final fun baz(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(): kotlin.Unit
|
||||||
|
public final fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public companion object Companion {
|
||||||
|
private constructor Companion()
|
||||||
|
public final fun bar(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
// FILE: A.java
|
||||||
|
|
||||||
|
public interface A {
|
||||||
|
public String a = ""
|
||||||
|
public static void foo() {}
|
||||||
|
public static void baz(String s) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: K.kt
|
||||||
|
|
||||||
|
open class K : A {
|
||||||
|
val a = ""
|
||||||
|
fun foo() {}
|
||||||
|
fun foo(i: Int) {}
|
||||||
|
fun baz(i: Int) {}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun foo() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public interface A {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public const final val a: kotlin.String = ""
|
||||||
|
public open fun baz(/*0*/ s: kotlin.String!): kotlin.Unit
|
||||||
|
public open fun foo(): kotlin.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class K : A {
|
||||||
|
public constructor K()
|
||||||
|
public final val a: kotlin.String = ""
|
||||||
|
public final fun baz(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(): kotlin.Unit
|
||||||
|
public final fun foo(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public companion object Companion {
|
||||||
|
private constructor Companion()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
// FILE: A.java
|
||||||
|
|
||||||
|
public class A {
|
||||||
|
public static void foo() {}
|
||||||
|
public static void baz(String s) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.java
|
||||||
|
|
||||||
|
public class B extends A {
|
||||||
|
public static void bar(int i) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: K.kt
|
||||||
|
|
||||||
|
open class K : B() {
|
||||||
|
companion object {
|
||||||
|
<!ACCIDENTAL_OVERRIDE!>@JvmStatic
|
||||||
|
fun foo()<!> {}
|
||||||
|
@JvmStatic
|
||||||
|
fun foo(a: Any) {}
|
||||||
|
<!ACCIDENTAL_OVERRIDE!>@JvmStatic
|
||||||
|
fun bar(i: Int)<!> {}
|
||||||
|
@JvmStatic
|
||||||
|
fun bar(i: String) {}
|
||||||
|
@JvmStatic
|
||||||
|
fun baz(i: Int) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public open class 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 hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public open fun baz(/*0*/ s: kotlin.String!): kotlin.Unit
|
||||||
|
public open fun foo(): kotlin.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class B : A {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public open fun bar(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun baz(/*0*/ s: kotlin.String!): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class K : B {
|
||||||
|
public constructor K()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public companion object Companion {
|
||||||
|
private constructor Companion()
|
||||||
|
@kotlin.jvm.JvmStatic() public final fun bar(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
@kotlin.jvm.JvmStatic() public final fun bar(/*0*/ i: kotlin.String): kotlin.Unit
|
||||||
|
@kotlin.jvm.JvmStatic() public final fun baz(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
@kotlin.jvm.JvmStatic() public final fun foo(): kotlin.Unit
|
||||||
|
@kotlin.jvm.JvmStatic() public final fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
// FILE: A.java
|
||||||
|
|
||||||
|
public class A {
|
||||||
|
public static void foo() {}
|
||||||
|
public static void baz(String s) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: K.kt
|
||||||
|
|
||||||
|
open class K : A() {
|
||||||
|
companion object {
|
||||||
|
<!ACCIDENTAL_OVERRIDE!>@JvmStatic
|
||||||
|
fun foo()<!> {}
|
||||||
|
@JvmStatic
|
||||||
|
fun foo(i: Int) {}
|
||||||
|
@JvmStatic
|
||||||
|
fun baz(i: Int) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public open class 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 hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public open fun baz(/*0*/ s: kotlin.String!): kotlin.Unit
|
||||||
|
public open fun foo(): kotlin.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class K : A {
|
||||||
|
public constructor K()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public companion object Companion {
|
||||||
|
private constructor Companion()
|
||||||
|
@kotlin.jvm.JvmStatic() public final fun baz(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
@kotlin.jvm.JvmStatic() public final fun foo(): kotlin.Unit
|
||||||
|
@kotlin.jvm.JvmStatic() public final fun foo(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
// FILE: A.java
|
||||||
|
|
||||||
|
public class A {
|
||||||
|
public static void foo() {}
|
||||||
|
public static void baz(String s) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
|
open class B : A() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: C.java
|
||||||
|
|
||||||
|
public class C extends B {
|
||||||
|
public static void bar(int i) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: K.kt
|
||||||
|
|
||||||
|
open class K : C() {
|
||||||
|
companion object {
|
||||||
|
<!ACCIDENTAL_OVERRIDE!>@JvmStatic
|
||||||
|
fun foo()<!> {}
|
||||||
|
@JvmStatic
|
||||||
|
fun foo(a: Any) {}
|
||||||
|
<!ACCIDENTAL_OVERRIDE!>@JvmStatic
|
||||||
|
fun bar(i: Int)<!> {}
|
||||||
|
@JvmStatic
|
||||||
|
fun bar(i: String) {}
|
||||||
|
@JvmStatic
|
||||||
|
fun baz(i: Int) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
+50
@@ -0,0 +1,50 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public open class 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 hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public open fun baz(/*0*/ s: kotlin.String!): kotlin.Unit
|
||||||
|
public open fun foo(): kotlin.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class B : A {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class C : B {
|
||||||
|
public constructor C()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public open fun bar(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun baz(/*0*/ s: kotlin.String!): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class K : C {
|
||||||
|
public constructor K()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public companion object Companion {
|
||||||
|
private constructor Companion()
|
||||||
|
@kotlin.jvm.JvmStatic() public final fun bar(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
@kotlin.jvm.JvmStatic() public final fun bar(/*0*/ i: kotlin.String): kotlin.Unit
|
||||||
|
@kotlin.jvm.JvmStatic() public final fun baz(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
@kotlin.jvm.JvmStatic() public final fun foo(): kotlin.Unit
|
||||||
|
@kotlin.jvm.JvmStatic() public final fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
// FILE: foo/A.java
|
||||||
|
|
||||||
|
package foo;
|
||||||
|
|
||||||
|
public class A {
|
||||||
|
private static void foo(int s) {}
|
||||||
|
static void bar(double s) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: K.kt
|
||||||
|
import foo.A
|
||||||
|
|
||||||
|
open class K : A() {
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun foo(i: Int) {}
|
||||||
|
@JvmStatic
|
||||||
|
fun bar(d: Double) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public open class K : foo.A {
|
||||||
|
public constructor K()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public companion object Companion {
|
||||||
|
private constructor Companion()
|
||||||
|
@kotlin.jvm.JvmStatic() public final fun bar(/*0*/ d: kotlin.Double): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
@kotlin.jvm.JvmStatic() public final fun foo(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5223,6 +5223,39 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature/statics")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class Statics extends AbstractJetDiagnosticsTest {
|
||||||
|
public void testAllFilesPresentInStatics() throws Exception {
|
||||||
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/duplicateJvmSignature/statics"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("jjk.kt")
|
||||||
|
public void testJjk() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature/statics/jjk.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("jk.kt")
|
||||||
|
public void testJk() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature/statics/jk.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("jkjk.kt")
|
||||||
|
public void testJkjk() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature/statics/jkjk.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kotlinMembersVsJavaNonVisibleStatics.kt")
|
||||||
|
public void testKotlinMembersVsJavaNonVisibleStatics() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature/statics/kotlinMembersVsJavaNonVisibleStatics.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature/synthesized")
|
@TestMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature/synthesized")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
+33
@@ -606,6 +606,39 @@ public class JetDiagnosticsTestWithStdLibGenerated extends AbstractJetDiagnostic
|
|||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/duplicateJvmSignature/platformStaticInObject.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/duplicateJvmSignature/platformStaticInObject.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/duplicateJvmSignature/statics")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class Statics extends AbstractJetDiagnosticsTestWithStdLib {
|
||||||
|
public void testAllFilesPresentInStatics() throws Exception {
|
||||||
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/duplicateJvmSignature/statics"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("jjk.kt")
|
||||||
|
public void testJjk() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/duplicateJvmSignature/statics/jjk.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("jk.kt")
|
||||||
|
public void testJk() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/duplicateJvmSignature/statics/jk.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("jkjk.kt")
|
||||||
|
public void testJkjk() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/duplicateJvmSignature/statics/jkjk.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kotlinMembersVsJavaNonVisibleStatics.kt")
|
||||||
|
public void testKotlinMembersVsJavaNonVisibleStatics() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/duplicateJvmSignature/statics/kotlinMembersVsJavaNonVisibleStatics.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/functionLiterals")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/functionLiterals")
|
||||||
|
|||||||
@@ -17,8 +17,11 @@
|
|||||||
package org.jetbrains.kotlin.load.java.descriptors
|
package org.jetbrains.kotlin.load.java.descriptors
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||||
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
|
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
|
||||||
|
import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaStaticClassScope
|
||||||
|
import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassNotAny
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
||||||
import org.jetbrains.kotlin.types.JetType
|
import org.jetbrains.kotlin.types.JetType
|
||||||
|
|
||||||
@@ -47,3 +50,13 @@ fun copyValueParameters(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun ClassDescriptor.getParentJavaStaticClassScope(): LazyJavaStaticClassScope? {
|
||||||
|
val superClassDescriptor = getSuperClassNotAny() ?: return null
|
||||||
|
|
||||||
|
val staticScope = superClassDescriptor.staticScope
|
||||||
|
|
||||||
|
if (staticScope !is LazyJavaStaticClassScope) return superClassDescriptor.getParentJavaStaticClassScope()
|
||||||
|
|
||||||
|
return staticScope
|
||||||
|
}
|
||||||
|
|||||||
+2
-7
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
|||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||||
import org.jetbrains.kotlin.load.java.components.DescriptorResolverUtils
|
import org.jetbrains.kotlin.load.java.components.DescriptorResolverUtils
|
||||||
|
import org.jetbrains.kotlin.load.java.descriptors.getParentJavaStaticClassScope
|
||||||
import org.jetbrains.kotlin.load.java.lazy.LazyJavaResolverContext
|
import org.jetbrains.kotlin.load.java.lazy.LazyJavaResolverContext
|
||||||
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
@@ -30,7 +31,6 @@ import org.jetbrains.kotlin.name.Name
|
|||||||
import org.jetbrains.kotlin.resolve.DescriptorFactory.createEnumValueOfMethod
|
import org.jetbrains.kotlin.resolve.DescriptorFactory.createEnumValueOfMethod
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorFactory.createEnumValuesMethod
|
import org.jetbrains.kotlin.resolve.DescriptorFactory.createEnumValuesMethod
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassNotAny
|
|
||||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||||
import org.jetbrains.kotlin.types.JetType
|
import org.jetbrains.kotlin.types.JetType
|
||||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||||
@@ -104,12 +104,7 @@ public class LazyJavaStaticClassScope(
|
|||||||
override fun getContainingDeclaration() = super.getContainingDeclaration() as LazyJavaClassDescriptor
|
override fun getContainingDeclaration() = super.getContainingDeclaration() as LazyJavaClassDescriptor
|
||||||
|
|
||||||
private fun getStaticFunctionsFromJavaSuperClasses(name: Name, descriptor: ClassDescriptor): Set<SimpleFunctionDescriptor> {
|
private fun getStaticFunctionsFromJavaSuperClasses(name: Name, descriptor: ClassDescriptor): Set<SimpleFunctionDescriptor> {
|
||||||
val superClassDescriptor = descriptor.getSuperClassNotAny() ?: return emptySet()
|
val staticScope = descriptor.getParentJavaStaticClassScope() ?: return emptySet()
|
||||||
|
|
||||||
val staticScope = superClassDescriptor.staticScope
|
|
||||||
|
|
||||||
if (staticScope !is LazyJavaStaticClassScope) return getStaticFunctionsFromJavaSuperClasses(name, superClassDescriptor)
|
|
||||||
|
|
||||||
return staticScope.getFunctions(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS).map { it as SimpleFunctionDescriptor }.toSet()
|
return staticScope.getFunctions(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS).map { it as SimpleFunctionDescriptor }.toSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user