Deprecate visibility of static members inherited from Java
Now they are not visible by short name through companion objects, just like classifiers in KT-21515 ^KT-25333 In progress
This commit is contained in:
committed by
Dmitry Savvinov
parent
63202fe560
commit
76c651421b
+3
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.resolve.calls.tower
|
|||||||
import org.jetbrains.kotlin.config.LanguageFeature
|
import org.jetbrains.kotlin.config.LanguageFeature
|
||||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
|
import org.jetbrains.kotlin.descriptors.synthetic.SyntheticMemberDescriptor
|
||||||
import org.jetbrains.kotlin.diagnostics.Errors
|
import org.jetbrains.kotlin.diagnostics.Errors
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
@@ -596,6 +597,8 @@ internal fun reportResolvedUsingDeprecatedVisibility(
|
|||||||
val descriptorToLookup: DeclarationDescriptor = when (candidateDescriptor) {
|
val descriptorToLookup: DeclarationDescriptor = when (candidateDescriptor) {
|
||||||
is ClassConstructorDescriptor -> candidateDescriptor.containingDeclaration
|
is ClassConstructorDescriptor -> candidateDescriptor.containingDeclaration
|
||||||
is FakeCallableDescriptorForObject -> candidateDescriptor.classDescriptor
|
is FakeCallableDescriptorForObject -> candidateDescriptor.classDescriptor
|
||||||
|
is SyntheticMemberDescriptor<*> -> candidateDescriptor.baseDescriptorForSynthetic
|
||||||
|
is PropertyDescriptor, is FunctionDescriptor -> candidateDescriptor
|
||||||
else -> error(
|
else -> error(
|
||||||
"Unexpected candidate descriptor of resolved call with " +
|
"Unexpected candidate descriptor of resolved call with " +
|
||||||
"ResolvedUsingDeprecatedVisibility-diagnostic: $candidateDescriptor\n" +
|
"ResolvedUsingDeprecatedVisibility-diagnostic: $candidateDescriptor\n" +
|
||||||
|
|||||||
@@ -222,13 +222,20 @@ internal open class ScopeBasedTowerLevel protected constructor(
|
|||||||
private val resolutionScope: ResolutionScope
|
private val resolutionScope: ResolutionScope
|
||||||
) : AbstractScopeTowerLevel(scopeTower) {
|
) : AbstractScopeTowerLevel(scopeTower) {
|
||||||
|
|
||||||
|
val deprecationDiagnosticOfThisScope: ResolutionDiagnostic? =
|
||||||
|
if (resolutionScope is DeprecatedLexicalScope) ResolvedUsingDeprecatedVisibility(resolutionScope, location) else null
|
||||||
|
|
||||||
internal constructor(scopeTower: ImplicitScopeTower, lexicalScope: LexicalScope) : this(scopeTower, lexicalScope as ResolutionScope)
|
internal constructor(scopeTower: ImplicitScopeTower, lexicalScope: LexicalScope) : this(scopeTower, lexicalScope as ResolutionScope)
|
||||||
|
|
||||||
override fun getVariables(
|
override fun getVariables(
|
||||||
name: Name,
|
name: Name,
|
||||||
extensionReceiver: ReceiverValueWithSmartCastInfo?
|
extensionReceiver: ReceiverValueWithSmartCastInfo?
|
||||||
): Collection<CandidateWithBoundDispatchReceiver> = resolutionScope.getContributedVariables(name, location).map {
|
): Collection<CandidateWithBoundDispatchReceiver> = resolutionScope.getContributedVariables(name, location).map {
|
||||||
createCandidateDescriptor(it, dispatchReceiver = null)
|
createCandidateDescriptor(
|
||||||
|
it,
|
||||||
|
dispatchReceiver = null,
|
||||||
|
specialError = deprecationDiagnosticOfThisScope
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getObjects(
|
override fun getObjects(
|
||||||
@@ -249,8 +256,13 @@ internal open class ScopeBasedTowerLevel protected constructor(
|
|||||||
): Collection<CandidateWithBoundDispatchReceiver> {
|
): Collection<CandidateWithBoundDispatchReceiver> {
|
||||||
val result: ArrayList<CandidateWithBoundDispatchReceiver> = ArrayList()
|
val result: ArrayList<CandidateWithBoundDispatchReceiver> = ArrayList()
|
||||||
|
|
||||||
resolutionScope.getContributedFunctionsAndConstructors(name, location, scopeTower.syntheticScopes)
|
resolutionScope.getContributedFunctionsAndConstructors(name, location, scopeTower.syntheticScopes).mapTo(result) {
|
||||||
.mapTo(result) { createCandidateDescriptor(it, dispatchReceiver = null) }
|
createCandidateDescriptor(
|
||||||
|
it,
|
||||||
|
dispatchReceiver = null,
|
||||||
|
specialError = deprecationDiagnosticOfThisScope
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Add constructors of deprecated classifier with an additional diagnostic
|
// Add constructors of deprecated classifier with an additional diagnostic
|
||||||
val descriptorWithDeprecation = resolutionScope.getContributedClassifierIncludeDeprecated(name, location)
|
val descriptorWithDeprecation = resolutionScope.getContributedClassifierIncludeDeprecated(name, location)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.resolve.scopes.utils
|
package org.jetbrains.kotlin.resolve.scopes.utils
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
|
import org.jetbrains.kotlin.descriptors.synthetic.SyntheticMemberDescriptor
|
||||||
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.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
@@ -91,8 +92,20 @@ fun DeclarationDescriptor.canBeResolvedWithoutDeprecation(
|
|||||||
location: LookupLocation
|
location: LookupLocation
|
||||||
): Boolean {
|
): Boolean {
|
||||||
for (scope in scopeForResolution.parentsWithSelf) {
|
for (scope in scopeForResolution.parentsWithSelf) {
|
||||||
val (descriptorFromCurrentScope, isDeprecated) = scope.getContributedClassifierIncludeDeprecated(name, location) ?: continue
|
val hasNonDeprecatedSuitableCandidate = when (this) {
|
||||||
if (descriptorFromCurrentScope == this && !isDeprecated) return true
|
// Looking for classifier: fair check via special method in ResolutionScope
|
||||||
|
is ClassifierDescriptor -> scope.getContributedClassifierIncludeDeprecated(name, location)
|
||||||
|
?.let { it.descriptor == this && !it.isDeprecated }
|
||||||
|
|
||||||
|
// Looking for member: heuristically check only one case, when another descriptor visible through explicit import
|
||||||
|
is VariableDescriptor -> (scope as? ImportingScope)?.getContributedVariables(name, location)?.any { it == this }
|
||||||
|
|
||||||
|
is FunctionDescriptor -> (scope as? ImportingScope)?.getContributedFunctions(name, location)?.any { it == this }
|
||||||
|
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasNonDeprecatedSuitableCandidate == true) return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||||
|
|
||||||
|
// FILE: test/Java.java
|
||||||
|
package test;
|
||||||
|
|
||||||
|
public class Java {
|
||||||
|
public static void method() { }
|
||||||
|
public static int property = 42;
|
||||||
|
public static class Classifier { }
|
||||||
|
public static void syntheticSam(Runnable r) { }
|
||||||
|
|
||||||
|
public static int getStaticSyntheticProperty() { return 42; }
|
||||||
|
public static int setStaticSyntheticProperty(int x) { return 42; }
|
||||||
|
|
||||||
|
public int getInstanceSyntheticProperty() { return 42; }
|
||||||
|
public int setInstanceSyntheticProperty(int x) { return 42; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Kotlin.kt
|
||||||
|
package test
|
||||||
|
|
||||||
|
open class Base {
|
||||||
|
companion object : Java() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Derived : Base() {
|
||||||
|
fun test(javaStaticInTypePosition: <!UNRESOLVED_REFERENCE!>Classifier<!>) {
|
||||||
|
<!UNRESOLVED_REFERENCE!>method<!>()
|
||||||
|
<!UNRESOLVED_REFERENCE!>property<!>
|
||||||
|
<!UNRESOLVED_REFERENCE!>Classifier<!>()
|
||||||
|
<!UNRESOLVED_REFERENCE!>syntheticSam<!> { }
|
||||||
|
|
||||||
|
// Instance members shouldn't be affected, but we check them, just in case
|
||||||
|
val y = instanceSyntheticProperty
|
||||||
|
instanceSyntheticProperty = 43
|
||||||
|
|
||||||
|
// Note that statics actually aren't converted into synthetic property in Kotlin
|
||||||
|
val x = <!UNRESOLVED_REFERENCE!>syntheticProperty<!>
|
||||||
|
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
|
||||||
|
}
|
||||||
|
|
||||||
|
class JavaStaticInSupertypeList : <!UNRESOLVED_REFERENCE!>Classifier<!>() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
package test {
|
||||||
|
|
||||||
|
public open class Base {
|
||||||
|
public constructor Base()
|
||||||
|
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 : test.Java {
|
||||||
|
private constructor Companion()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun getInstanceSyntheticProperty(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class Derived : test.Base {
|
||||||
|
public constructor Derived()
|
||||||
|
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 final fun test(/*0*/ javaStaticInTypePosition: [ERROR : Classifier]): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final class JavaStaticInSupertypeList {
|
||||||
|
public constructor JavaStaticInSupertypeList()
|
||||||
|
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 Java {
|
||||||
|
public constructor Java()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open fun getInstanceSyntheticProperty(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public open class Classifier {
|
||||||
|
public constructor Classifier()
|
||||||
|
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 property: kotlin.Int
|
||||||
|
public open fun getStaticSyntheticProperty(): kotlin.Int
|
||||||
|
public open fun method(): kotlin.Unit
|
||||||
|
public open fun setStaticSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||||
|
public open fun syntheticSam(/*0*/ r: java.lang.Runnable!): kotlin.Unit
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||||
|
|
||||||
|
// FILE: test/Java.java
|
||||||
|
package test;
|
||||||
|
|
||||||
|
public class Java {
|
||||||
|
public static void method() { }
|
||||||
|
public static int property = 42;
|
||||||
|
public static class Classifier { }
|
||||||
|
public static void syntheticSam(Runnable r) { }
|
||||||
|
|
||||||
|
public static int getStaticSyntheticProperty() { return 42; }
|
||||||
|
public static int setStaticSyntheticProperty(int x) { return 42; }
|
||||||
|
|
||||||
|
public int getInstanceSyntheticProperty() { return 42; }
|
||||||
|
public int setInstanceSyntheticProperty(int x) { return 42; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Kotlin.kt
|
||||||
|
package test
|
||||||
|
|
||||||
|
open class Base {
|
||||||
|
companion object : Java() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Derived : Base() {
|
||||||
|
fun test(javaStaticInTypePosition: <!DEPRECATED_ACCESS_BY_SHORT_NAME!>Classifier<!>) {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>method()<!>
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>property<!>
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>Classifier()<!>
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>syntheticSam { }<!>
|
||||||
|
|
||||||
|
// Instance members shouldn't be affected, but we check them, just in case
|
||||||
|
val y = instanceSyntheticProperty
|
||||||
|
instanceSyntheticProperty = 43
|
||||||
|
|
||||||
|
// Note that statics actually aren't converted into synthetic property in Kotlin
|
||||||
|
val x = <!UNRESOLVED_REFERENCE!>syntheticProperty<!>
|
||||||
|
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
|
||||||
|
}
|
||||||
|
|
||||||
|
class JavaStaticInSupertypeList : <!DEPRECATED_ACCESS_BY_SHORT_NAME!>Classifier<!>() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
package test {
|
||||||
|
|
||||||
|
public open class Base {
|
||||||
|
public constructor Base()
|
||||||
|
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 : test.Java {
|
||||||
|
private constructor Companion()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun getInstanceSyntheticProperty(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class Derived : test.Base {
|
||||||
|
public constructor Derived()
|
||||||
|
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 final fun test(/*0*/ javaStaticInTypePosition: test.Java.Classifier): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final class JavaStaticInSupertypeList : test.Java.Classifier {
|
||||||
|
public constructor JavaStaticInSupertypeList()
|
||||||
|
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 Java {
|
||||||
|
public constructor Java()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open fun getInstanceSyntheticProperty(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public open class Classifier {
|
||||||
|
public constructor Classifier()
|
||||||
|
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 property: kotlin.Int
|
||||||
|
public open fun getStaticSyntheticProperty(): kotlin.Int
|
||||||
|
public open fun method(): kotlin.Unit
|
||||||
|
public open fun setStaticSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||||
|
public open fun syntheticSam(/*0*/ r: java.lang.Runnable!): kotlin.Unit
|
||||||
|
}
|
||||||
|
}
|
||||||
+53
@@ -0,0 +1,53 @@
|
|||||||
|
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||||
|
|
||||||
|
// FILE: test/Java.java
|
||||||
|
package test;
|
||||||
|
|
||||||
|
public class Java {
|
||||||
|
public static void method() { }
|
||||||
|
public static int property = 42;
|
||||||
|
public static class Classifier { }
|
||||||
|
public static void syntheticSam(Runnable r) { }
|
||||||
|
|
||||||
|
public static int getStaticSyntheticProperty() { return 42; }
|
||||||
|
public static int setStaticSyntheticProperty(int x) { return 42; }
|
||||||
|
|
||||||
|
public int getInstanceSyntheticProperty() { return 42; }
|
||||||
|
public int setInstanceSyntheticProperty(int x) { return 42; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Kotlin.kt
|
||||||
|
package test
|
||||||
|
|
||||||
|
import test.Java.method
|
||||||
|
import test.Java.Classifier
|
||||||
|
import test.Java.property
|
||||||
|
import test.Java.syntheticSam
|
||||||
|
|
||||||
|
open class Base {
|
||||||
|
companion object : Java() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Derived : Base() {
|
||||||
|
fun test(javaStaticInTypePosition: Classifier) {
|
||||||
|
method()
|
||||||
|
property
|
||||||
|
Classifier()
|
||||||
|
syntheticSam { }
|
||||||
|
|
||||||
|
// Instance members shouldn't be affected, but we check them, just in case
|
||||||
|
val y = instanceSyntheticProperty
|
||||||
|
instanceSyntheticProperty = 43
|
||||||
|
|
||||||
|
// Note that statics actually aren't converted into synthetic property in Kotlin
|
||||||
|
val x = <!UNRESOLVED_REFERENCE!>syntheticProperty<!>
|
||||||
|
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
|
||||||
|
}
|
||||||
|
|
||||||
|
class JavaStaticInSupertypeList : Classifier() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+58
@@ -0,0 +1,58 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
package test {
|
||||||
|
|
||||||
|
public open class Base {
|
||||||
|
public constructor Base()
|
||||||
|
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 : test.Java {
|
||||||
|
private constructor Companion()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun getInstanceSyntheticProperty(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class Derived : test.Base {
|
||||||
|
public constructor Derived()
|
||||||
|
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 final fun test(/*0*/ javaStaticInTypePosition: test.Java.Classifier): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final class JavaStaticInSupertypeList : test.Java.Classifier {
|
||||||
|
public constructor JavaStaticInSupertypeList()
|
||||||
|
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 Java {
|
||||||
|
public constructor Java()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open fun getInstanceSyntheticProperty(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public open class Classifier {
|
||||||
|
public constructor Classifier()
|
||||||
|
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 property: kotlin.Int
|
||||||
|
public open fun getStaticSyntheticProperty(): kotlin.Int
|
||||||
|
public open fun method(): kotlin.Unit
|
||||||
|
public open fun setStaticSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||||
|
public open fun syntheticSam(/*0*/ r: java.lang.Runnable!): kotlin.Unit
|
||||||
|
}
|
||||||
|
}
|
||||||
+53
@@ -0,0 +1,53 @@
|
|||||||
|
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||||
|
|
||||||
|
// FILE: test/Java.java
|
||||||
|
package test;
|
||||||
|
|
||||||
|
public class Java {
|
||||||
|
public static void method() { }
|
||||||
|
public static int property = 42;
|
||||||
|
public static class Classifier { }
|
||||||
|
public static void syntheticSam(Runnable r) { }
|
||||||
|
|
||||||
|
public static int getStaticSyntheticProperty() { return 42; }
|
||||||
|
public static int setStaticSyntheticProperty(int x) { return 42; }
|
||||||
|
|
||||||
|
public int getInstanceSyntheticProperty() { return 42; }
|
||||||
|
public int setInstanceSyntheticProperty(int x) { return 42; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Kotlin.kt
|
||||||
|
package test
|
||||||
|
|
||||||
|
import test.Java.method
|
||||||
|
import test.Java.Classifier
|
||||||
|
import test.Java.property
|
||||||
|
import test.Java.syntheticSam
|
||||||
|
|
||||||
|
open class Base {
|
||||||
|
companion object : Java() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Derived : Base() {
|
||||||
|
fun test(javaStaticInTypePosition: Classifier) {
|
||||||
|
method()
|
||||||
|
property
|
||||||
|
Classifier()
|
||||||
|
syntheticSam { }
|
||||||
|
|
||||||
|
// Instance members shouldn't be affected, but we check them, just in case
|
||||||
|
val y = instanceSyntheticProperty
|
||||||
|
instanceSyntheticProperty = 43
|
||||||
|
|
||||||
|
// Note that statics actually aren't converted into synthetic property in Kotlin
|
||||||
|
val x = <!UNRESOLVED_REFERENCE!>syntheticProperty<!>
|
||||||
|
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
|
||||||
|
}
|
||||||
|
|
||||||
|
class JavaStaticInSupertypeList : Classifier() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+58
@@ -0,0 +1,58 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
package test {
|
||||||
|
|
||||||
|
public open class Base {
|
||||||
|
public constructor Base()
|
||||||
|
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 : test.Java {
|
||||||
|
private constructor Companion()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun getInstanceSyntheticProperty(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class Derived : test.Base {
|
||||||
|
public constructor Derived()
|
||||||
|
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 final fun test(/*0*/ javaStaticInTypePosition: test.Java.Classifier): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final class JavaStaticInSupertypeList : test.Java.Classifier {
|
||||||
|
public constructor JavaStaticInSupertypeList()
|
||||||
|
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 Java {
|
||||||
|
public constructor Java()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open fun getInstanceSyntheticProperty(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public open class Classifier {
|
||||||
|
public constructor Classifier()
|
||||||
|
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 property: kotlin.Int
|
||||||
|
public open fun getStaticSyntheticProperty(): kotlin.Int
|
||||||
|
public open fun method(): kotlin.Unit
|
||||||
|
public open fun setStaticSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||||
|
public open fun syntheticSam(/*0*/ r: java.lang.Runnable!): kotlin.Unit
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-5
@@ -1,3 +1,4 @@
|
|||||||
|
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||||
// FILE: J.java
|
// FILE: J.java
|
||||||
public class J {
|
public class J {
|
||||||
public static void foo() {}
|
public static void foo() {}
|
||||||
@@ -17,20 +18,20 @@ open class A {
|
|||||||
|
|
||||||
class B : J2() {
|
class B : J2() {
|
||||||
init {
|
init {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
boo()
|
boo()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test2() {
|
fun test2() {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
boo()
|
boo()
|
||||||
}
|
}
|
||||||
|
|
||||||
object O {
|
object O {
|
||||||
fun test() {
|
fun test() {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
boo()
|
boo()
|
||||||
}
|
}
|
||||||
@@ -38,13 +39,13 @@ class B : J2() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
init {
|
init {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
boo()
|
boo()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
boo()
|
boo()
|
||||||
}
|
}
|
||||||
+55
@@ -0,0 +1,55 @@
|
|||||||
|
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||||
|
// FILE: J.java
|
||||||
|
public class J {
|
||||||
|
public static void foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: J2.java
|
||||||
|
public class J2 extends A {
|
||||||
|
public static void boo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
open class A {
|
||||||
|
companion object : J() {
|
||||||
|
fun bar() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class B : J2() {
|
||||||
|
init {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
boo()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test2() {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
boo()
|
||||||
|
}
|
||||||
|
|
||||||
|
object O {
|
||||||
|
fun test() {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
boo()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
init {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
boo()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
boo()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bar() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
+61
@@ -0,0 +1,61 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
public companion object Companion : J {
|
||||||
|
private constructor Companion()
|
||||||
|
public final fun bar(): kotlin.Unit
|
||||||
|
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 final class B : J2 {
|
||||||
|
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 final fun test2(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public companion object Companion {
|
||||||
|
private constructor Companion()
|
||||||
|
public final fun bar(): kotlin.Unit
|
||||||
|
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 final fun test(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public object O {
|
||||||
|
private constructor O()
|
||||||
|
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 final fun test(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class J {
|
||||||
|
public constructor J()
|
||||||
|
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 foo(): kotlin.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class J2 : A {
|
||||||
|
public constructor J2()
|
||||||
|
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 boo(): kotlin.Unit
|
||||||
|
}
|
||||||
+6
-5
@@ -1,3 +1,4 @@
|
|||||||
|
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||||
// FILE: J.java
|
// FILE: J.java
|
||||||
public class J {
|
public class J {
|
||||||
public static void foo() {}
|
public static void foo() {}
|
||||||
@@ -12,30 +13,30 @@ open class A {
|
|||||||
|
|
||||||
class B : A() {
|
class B : A() {
|
||||||
init {
|
init {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test2() {
|
fun test2() {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
}
|
}
|
||||||
|
|
||||||
object O {
|
object O {
|
||||||
fun test() {
|
fun test() {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
init {
|
init {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
}
|
}
|
||||||
|
|
||||||
+46
@@ -0,0 +1,46 @@
|
|||||||
|
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||||
|
// FILE: J.java
|
||||||
|
public class J {
|
||||||
|
public static void foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
open class A {
|
||||||
|
companion object : J() {
|
||||||
|
fun bar() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class B : A() {
|
||||||
|
init {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test2() {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
}
|
||||||
|
|
||||||
|
object O {
|
||||||
|
fun test() {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
init {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bar() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
+51
@@ -0,0 +1,51 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
public companion object Companion : J {
|
||||||
|
private constructor Companion()
|
||||||
|
public final fun bar(): kotlin.Unit
|
||||||
|
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 final 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 final fun test2(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public companion object Companion {
|
||||||
|
private constructor Companion()
|
||||||
|
public final fun bar(): kotlin.Unit
|
||||||
|
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 final fun test(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public object O {
|
||||||
|
private constructor O()
|
||||||
|
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 final fun test(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class J {
|
||||||
|
public constructor J()
|
||||||
|
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 foo(): kotlin.Unit
|
||||||
|
}
|
||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||||
// !WITH_NEW_INFERENCE
|
// !WITH_NEW_INFERENCE
|
||||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||||
|
|
||||||
+54
@@ -0,0 +1,54 @@
|
|||||||
|
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||||
|
// !WITH_NEW_INFERENCE
|
||||||
|
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||||
|
|
||||||
|
// FILE: J.java
|
||||||
|
public class J {
|
||||||
|
public static void foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
open class A<T> : J() {
|
||||||
|
init {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
val a: Int = <!NI;TYPE_MISMATCH, TYPE_MISMATCH!><!DEBUG_INFO_LEAKING_THIS!>baz<!>()<!>
|
||||||
|
val b: T = <!DEBUG_INFO_LEAKING_THIS!>baz<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test1() {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
val a: Int = <!NI;TYPE_MISMATCH, TYPE_MISMATCH!>baz()<!>
|
||||||
|
val b: T = baz()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun baz(): T = null!!
|
||||||
|
|
||||||
|
object O {
|
||||||
|
fun test() {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
val a: Int = baz()
|
||||||
|
val b: <!UNRESOLVED_REFERENCE!>T<!> = baz()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object : A<Int>() {
|
||||||
|
init {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
val a: Int = baz()
|
||||||
|
val b: <!UNRESOLVED_REFERENCE!>T<!> = baz()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
val a: Int = baz()
|
||||||
|
val b: <!UNRESOLVED_REFERENCE!>T<!> = baz()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bar() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public open class A</*0*/ T> : J {
|
||||||
|
public constructor A</*0*/ T>()
|
||||||
|
public final fun baz(): T
|
||||||
|
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 final fun test1(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public companion object Companion : A<kotlin.Int> {
|
||||||
|
private constructor Companion()
|
||||||
|
public final fun bar(): kotlin.Unit
|
||||||
|
public final override /*1*/ /*fake_override*/ fun baz(): kotlin.Int
|
||||||
|
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 final fun test(): kotlin.Unit
|
||||||
|
public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public object O {
|
||||||
|
private constructor O()
|
||||||
|
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 final fun test(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class J {
|
||||||
|
public constructor J()
|
||||||
|
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 foo(): kotlin.Unit
|
||||||
|
}
|
||||||
+4
-3
@@ -1,3 +1,4 @@
|
|||||||
|
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||||
// FILE: J.java
|
// FILE: J.java
|
||||||
public class J {
|
public class J {
|
||||||
public static void foo() {}
|
public static void foo() {}
|
||||||
@@ -11,20 +12,20 @@ open class B : J() {
|
|||||||
|
|
||||||
class A {
|
class A {
|
||||||
init {
|
init {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
baz()
|
baz()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test1() {
|
fun test1() {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
baz()
|
baz()
|
||||||
}
|
}
|
||||||
|
|
||||||
object O {
|
object O {
|
||||||
fun test() {
|
fun test() {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
baz()
|
baz()
|
||||||
}
|
}
|
||||||
+50
@@ -0,0 +1,50 @@
|
|||||||
|
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||||
|
// FILE: J.java
|
||||||
|
public class J {
|
||||||
|
public static void foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
open class B : J() {
|
||||||
|
fun baz() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
class A {
|
||||||
|
init {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
baz()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test1() {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
baz()
|
||||||
|
}
|
||||||
|
|
||||||
|
object O {
|
||||||
|
fun test() {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
baz()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
companion object : B() {
|
||||||
|
init {
|
||||||
|
foo()
|
||||||
|
bar()
|
||||||
|
baz()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
foo()
|
||||||
|
bar()
|
||||||
|
baz()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bar() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public final 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 final fun test1(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public companion object Companion : B {
|
||||||
|
private constructor Companion()
|
||||||
|
public final fun bar(): kotlin.Unit
|
||||||
|
public final override /*1*/ /*fake_override*/ fun baz(): kotlin.Unit
|
||||||
|
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 final fun test(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public object O {
|
||||||
|
private constructor O()
|
||||||
|
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 final fun test(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class B : J {
|
||||||
|
public constructor B()
|
||||||
|
public final fun baz(): kotlin.Unit
|
||||||
|
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 J {
|
||||||
|
public constructor J()
|
||||||
|
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 foo(): kotlin.Unit
|
||||||
|
}
|
||||||
+4
-3
@@ -1,3 +1,4 @@
|
|||||||
|
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||||
// FILE: J.java
|
// FILE: J.java
|
||||||
public class J {
|
public class J {
|
||||||
public static void foo() {}
|
public static void foo() {}
|
||||||
@@ -6,18 +7,18 @@ public class J {
|
|||||||
// FILE: test.kt
|
// FILE: test.kt
|
||||||
class A {
|
class A {
|
||||||
init {
|
init {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test1() {
|
fun test1() {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
}
|
}
|
||||||
|
|
||||||
object O {
|
object O {
|
||||||
fun test() {
|
fun test() {
|
||||||
foo()
|
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
bar()
|
bar()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||||
|
// FILE: J.java
|
||||||
|
public class J {
|
||||||
|
public static void foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
class A {
|
||||||
|
init {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test1() {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
}
|
||||||
|
|
||||||
|
object O {
|
||||||
|
fun test() {
|
||||||
|
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>foo()<!>
|
||||||
|
bar()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object : J() {
|
||||||
|
init {
|
||||||
|
foo()
|
||||||
|
bar()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
foo()
|
||||||
|
bar()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bar() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public final 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 final fun test1(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public companion object Companion : J {
|
||||||
|
private constructor Companion()
|
||||||
|
public final fun bar(): kotlin.Unit
|
||||||
|
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 final fun test(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public object O {
|
||||||
|
private constructor O()
|
||||||
|
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 final fun test(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class J {
|
||||||
|
public constructor J()
|
||||||
|
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 foo(): kotlin.Unit
|
||||||
|
}
|
||||||
+60
-15
@@ -13870,6 +13870,26 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedWithQualificationOld.kt");
|
runTest("compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedWithQualificationOld.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("staticsFromJavaNew.kt")
|
||||||
|
public void testStaticsFromJavaNew() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaNew.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("staticsFromJavaOld.kt")
|
||||||
|
public void testStaticsFromJavaOld() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaOld.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("staticsFromJavaWithQualificationNew.kt")
|
||||||
|
public void testStaticsFromJavaWithQualificationNew() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaWithQualificationNew.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("staticsFromJavaWithQualificationOld.kt")
|
||||||
|
public void testStaticsFromJavaWithQualificationOld() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaWithQualificationOld.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("useDeprecatedConstructorNew.kt")
|
@TestMetadata("useDeprecatedConstructorNew.kt")
|
||||||
public void testUseDeprecatedConstructorNew() throws Exception {
|
public void testUseDeprecatedConstructorNew() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/objects/kt21515/useDeprecatedConstructorNew.kt");
|
runTest("compiler/testData/diagnostics/tests/objects/kt21515/useDeprecatedConstructorNew.kt");
|
||||||
@@ -17903,33 +17923,58 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("accessToStaticMembersOfParentClass.kt")
|
@TestMetadata("accessToStaticMembersOfParentClassJKJ_after.kt")
|
||||||
public void testAccessToStaticMembersOfParentClass() throws Exception {
|
public void testAccessToStaticMembersOfParentClassJKJ_after() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass.kt");
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_after.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("accessToStaticMembersOfParentClassJKJ.kt")
|
@TestMetadata("accessToStaticMembersOfParentClassJKJ_before.kt")
|
||||||
public void testAccessToStaticMembersOfParentClassJKJ() throws Exception {
|
public void testAccessToStaticMembersOfParentClassJKJ_before() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ.kt");
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_before.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("accessToStaticMembersOfParentClass_after.kt")
|
||||||
|
public void testAccessToStaticMembersOfParentClass_after() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_after.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("accessToStaticMembersOfParentClass_before.kt")
|
||||||
|
public void testAccessToStaticMembersOfParentClass_before() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_before.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAllFilesPresentInCompanionObject() throws Exception {
|
public void testAllFilesPresentInCompanionObject() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("inheritFromContainingClass.kt")
|
@TestMetadata("inheritFromContainingClass_after.kt")
|
||||||
public void testInheritFromContainingClass() throws Exception {
|
public void testInheritFromContainingClass_after() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass.kt");
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("inheritFromJava.kt")
|
@TestMetadata("inheritFromContainingClass_before.kt")
|
||||||
public void testInheritFromJava() throws Exception {
|
public void testInheritFromContainingClass_before() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava.kt");
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("inheritFromJavaAfterKotlin.kt")
|
@TestMetadata("inheritFromJavaAfterKotlin_after.kt")
|
||||||
public void testInheritFromJavaAfterKotlin() throws Exception {
|
public void testInheritFromJavaAfterKotlin_after() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin.kt");
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_after.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inheritFromJavaAfterKotlin_before.kt")
|
||||||
|
public void testInheritFromJavaAfterKotlin_before() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_before.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inheritFromJava_after.kt")
|
||||||
|
public void testInheritFromJava_after() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_after.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inheritFromJava_before.kt")
|
||||||
|
public void testInheritFromJava_before() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_before.kt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+60
-15
@@ -13870,6 +13870,26 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
runTest("compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedWithQualificationOld.kt");
|
runTest("compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedWithQualificationOld.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("staticsFromJavaNew.kt")
|
||||||
|
public void testStaticsFromJavaNew() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaNew.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("staticsFromJavaOld.kt")
|
||||||
|
public void testStaticsFromJavaOld() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaOld.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("staticsFromJavaWithQualificationNew.kt")
|
||||||
|
public void testStaticsFromJavaWithQualificationNew() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaWithQualificationNew.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("staticsFromJavaWithQualificationOld.kt")
|
||||||
|
public void testStaticsFromJavaWithQualificationOld() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/objects/kt21515/staticsFromJavaWithQualificationOld.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("useDeprecatedConstructorNew.kt")
|
@TestMetadata("useDeprecatedConstructorNew.kt")
|
||||||
public void testUseDeprecatedConstructorNew() throws Exception {
|
public void testUseDeprecatedConstructorNew() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/objects/kt21515/useDeprecatedConstructorNew.kt");
|
runTest("compiler/testData/diagnostics/tests/objects/kt21515/useDeprecatedConstructorNew.kt");
|
||||||
@@ -17903,33 +17923,58 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("accessToStaticMembersOfParentClass.kt")
|
@TestMetadata("accessToStaticMembersOfParentClassJKJ_after.kt")
|
||||||
public void testAccessToStaticMembersOfParentClass() throws Exception {
|
public void testAccessToStaticMembersOfParentClassJKJ_after() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass.kt");
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_after.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("accessToStaticMembersOfParentClassJKJ.kt")
|
@TestMetadata("accessToStaticMembersOfParentClassJKJ_before.kt")
|
||||||
public void testAccessToStaticMembersOfParentClassJKJ() throws Exception {
|
public void testAccessToStaticMembersOfParentClassJKJ_before() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ.kt");
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_before.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("accessToStaticMembersOfParentClass_after.kt")
|
||||||
|
public void testAccessToStaticMembersOfParentClass_after() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_after.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("accessToStaticMembersOfParentClass_before.kt")
|
||||||
|
public void testAccessToStaticMembersOfParentClass_before() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_before.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAllFilesPresentInCompanionObject() throws Exception {
|
public void testAllFilesPresentInCompanionObject() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("inheritFromContainingClass.kt")
|
@TestMetadata("inheritFromContainingClass_after.kt")
|
||||||
public void testInheritFromContainingClass() throws Exception {
|
public void testInheritFromContainingClass_after() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass.kt");
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("inheritFromJava.kt")
|
@TestMetadata("inheritFromContainingClass_before.kt")
|
||||||
public void testInheritFromJava() throws Exception {
|
public void testInheritFromContainingClass_before() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava.kt");
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("inheritFromJavaAfterKotlin.kt")
|
@TestMetadata("inheritFromJavaAfterKotlin_after.kt")
|
||||||
public void testInheritFromJavaAfterKotlin() throws Exception {
|
public void testInheritFromJavaAfterKotlin_after() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin.kt");
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_after.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inheritFromJavaAfterKotlin_before.kt")
|
||||||
|
public void testInheritFromJavaAfterKotlin_before() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_before.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inheritFromJava_after.kt")
|
||||||
|
public void testInheritFromJava_after() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_after.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inheritFromJava_before.kt")
|
||||||
|
public void testInheritFromJava_before() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_before.kt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,9 +122,11 @@ class KotlinImportOptimizer : ImportOptimizer {
|
|||||||
return when (target) {
|
return when (target) {
|
||||||
is FunctionDescriptor ->
|
is FunctionDescriptor ->
|
||||||
scope.findFunction(target.name, NoLookupLocation.FROM_IDE) { it == target } != null
|
scope.findFunction(target.name, NoLookupLocation.FROM_IDE) { it == target } != null
|
||||||
|
&& bindingContext[BindingContext.DEPRECATED_SHORT_NAME_ACCESS, place] != true
|
||||||
|
|
||||||
is PropertyDescriptor ->
|
is PropertyDescriptor ->
|
||||||
scope.findVariable(target.name, NoLookupLocation.FROM_IDE) { it == target } != null
|
scope.findVariable(target.name, NoLookupLocation.FROM_IDE) { it == target } != null
|
||||||
|
&& bindingContext[BindingContext.DEPRECATED_SHORT_NAME_ACCESS, place] != true
|
||||||
|
|
||||||
is ClassDescriptor ->
|
is ClassDescriptor ->
|
||||||
scope.findClassifier(target.name, NoLookupLocation.FROM_IDE) == target
|
scope.findClassifier(target.name, NoLookupLocation.FROM_IDE) == target
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
public class Java {
|
||||||
|
public static int field = 42;
|
||||||
|
public static void method() { }
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import Java.field;
|
||||||
|
import Java.method;
|
||||||
|
|
||||||
|
open class Base {
|
||||||
|
companion object : Java()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Derived : Base() {
|
||||||
|
fun test() {
|
||||||
|
val x = field;
|
||||||
|
val y = method();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import Java.field;
|
||||||
|
import Java.method;
|
||||||
|
|
||||||
|
open class Base {
|
||||||
|
companion object : Java()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Derived : Base() {
|
||||||
|
fun test() {
|
||||||
|
val x = field;
|
||||||
|
val y = method();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
// LANGUAGE_VERSION: 1.3
|
||||||
|
// FILE: first.before.kt
|
||||||
|
// "Import" "true"
|
||||||
|
// ERROR: Unresolved reference: foobar
|
||||||
|
import foo.Bar
|
||||||
|
|
||||||
|
open class Base {
|
||||||
|
companion object : Bar() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Derived : Base() {
|
||||||
|
fun test() {
|
||||||
|
val x = foobar<caret>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: foo/Bar.java
|
||||||
|
package foo;
|
||||||
|
|
||||||
|
public class Bar {
|
||||||
|
public static final String foobar = "foobar";
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: first.after.kt
|
||||||
|
// "Import" "true"
|
||||||
|
// ERROR: Unresolved reference: foobar
|
||||||
|
import foo.Bar
|
||||||
|
import foo.Bar.foobar
|
||||||
|
|
||||||
|
open class Base {
|
||||||
|
companion object : Bar() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Derived : Base() {
|
||||||
|
fun test() {
|
||||||
|
val x = foobar<caret>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
public class Java {
|
||||||
|
public static int field = 42;
|
||||||
|
public static void method() { }
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
open class Base {
|
||||||
|
companion object : Java()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Derived : Base() {
|
||||||
|
fun test() {
|
||||||
|
val x = <selection>Java.field</selection>;
|
||||||
|
val y = <selection>Java.method()</selection>;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
open class Base {
|
||||||
|
companion object : Java()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Derived : Base() {
|
||||||
|
fun test() {
|
||||||
|
val x = Java.field;
|
||||||
|
val y = Java.method();
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -131,6 +131,11 @@ public class JvmOptimizeImportsTestGenerated extends AbstractJvmOptimizeImportsT
|
|||||||
runTest("idea/testData/editor/optimizeImports/jvm/SamConstructor.kt");
|
runTest("idea/testData/editor/optimizeImports/jvm/SamConstructor.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("staticFromJava.kt")
|
||||||
|
public void testStaticFromJava() throws Exception {
|
||||||
|
runTest("idea/testData/editor/optimizeImports/jvm/staticFromJava.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("StaticMethodFromSuper.kt")
|
@TestMetadata("StaticMethodFromSuper.kt")
|
||||||
public void testStaticMethodFromSuper() throws Exception {
|
public void testStaticMethodFromSuper() throws Exception {
|
||||||
runTest("idea/testData/editor/optimizeImports/jvm/StaticMethodFromSuper.kt");
|
runTest("idea/testData/editor/optimizeImports/jvm/StaticMethodFromSuper.kt");
|
||||||
|
|||||||
@@ -127,11 +127,10 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest
|
|||||||
multifileText,
|
multifileText,
|
||||||
object : KotlinTestUtils.TestFileFactoryNoModules<TestFile>() {
|
object : KotlinTestUtils.TestFileFactoryNoModules<TestFile>() {
|
||||||
override fun create(fileName: String, text: String, directives: Map<String, String>): TestFile {
|
override fun create(fileName: String, text: String, directives: Map<String, String>): TestFile {
|
||||||
if (text.startsWith("// FILE")) {
|
val linesWithoutDirectives = text.lines().filter {
|
||||||
// Drop the first line
|
!it.startsWith("// LANGUAGE_VERSION") && !it.startsWith("// FILE")
|
||||||
return TestFile(fileName, StringUtil.substringAfter(text, "\n")!!)
|
|
||||||
}
|
}
|
||||||
return TestFile(fileName, text)
|
return TestFile(fileName, linesWithoutDirectives.joinToString(separator = "\n"))
|
||||||
}
|
}
|
||||||
}, "")
|
}, "")
|
||||||
|
|
||||||
@@ -144,6 +143,7 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
configureMultiFileTest(subFiles, beforeFile)
|
configureMultiFileTest(subFiles, beforeFile)
|
||||||
|
configureCompilerOptions(multifileText, project, module)
|
||||||
|
|
||||||
CommandProcessor.getInstance().executeCommand(project, {
|
CommandProcessor.getInstance().executeCommand(project, {
|
||||||
try {
|
try {
|
||||||
@@ -167,6 +167,10 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest
|
|||||||
TestCase.assertNotNull(".after file should exist", afterFile)
|
TestCase.assertNotNull(".after file should exist", afterFile)
|
||||||
if (afterText != afterFile!!.content) {
|
if (afterText != afterFile!!.content) {
|
||||||
val actualTestFile = StringBuilder()
|
val actualTestFile = StringBuilder()
|
||||||
|
if (multifileText.startsWith("// LANGUAGE_VERSION")) {
|
||||||
|
actualTestFile.append(multifileText.lineSequence().first())
|
||||||
|
}
|
||||||
|
|
||||||
actualTestFile.append("// FILE: ").append(beforeFile.path).append("\n").append(beforeFile.content)
|
actualTestFile.append("// FILE: ").append(beforeFile.path).append("\n").append(beforeFile.content)
|
||||||
for (file in subFiles) {
|
for (file in subFiles) {
|
||||||
actualTestFile.append("// FILE: ").append(file.path).append("\n").append(file.content)
|
actualTestFile.append("// FILE: ").append(file.path).append("\n").append(file.content)
|
||||||
|
|||||||
+5
@@ -892,6 +892,11 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
|
|||||||
public void testAllFilesPresentInKt21515() throws Exception {
|
public void testAllFilesPresentInKt21515() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/autoImports/kt21515"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+)|(test))$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/autoImports/kt21515"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+)|(test))$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("staticFromJava.test")
|
||||||
|
public void testStaticFromJava() throws Exception {
|
||||||
|
runTest("idea/testData/quickfix/autoImports/kt21515/staticFromJava.test");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("idea/testData/quickfix/autoImports/mismatchingArgs")
|
@TestMetadata("idea/testData/quickfix/autoImports/mismatchingArgs")
|
||||||
|
|||||||
@@ -335,6 +335,11 @@ public class ShortenRefsTestGenerated extends AbstractShortenRefsTest {
|
|||||||
runTest("idea/testData/shortenRefs/kt21515/constructor.kt");
|
runTest("idea/testData/shortenRefs/kt21515/constructor.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("staticFromJava.kt")
|
||||||
|
public void testStaticFromJava() throws Exception {
|
||||||
|
runTest("idea/testData/shortenRefs/kt21515/staticFromJava.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("typeReference.kt")
|
@TestMetadata("typeReference.kt")
|
||||||
public void testTypeReference() throws Exception {
|
public void testTypeReference() throws Exception {
|
||||||
runTest("idea/testData/shortenRefs/kt21515/typeReference.kt");
|
runTest("idea/testData/shortenRefs/kt21515/typeReference.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user