JVM_IR KT-45853 include return type into Java method IdSignature
This is a hack required to accept [potentially] incorrect input provided by the front-end; see KT-46042.
This commit is contained in:
committed by
TeamCityServer
parent
5ce746f1ec
commit
7e03f8ea80
+41
-45
@@ -27,19 +27,19 @@ import org.jetbrains.org.objectweb.asm.commons.Method
|
||||
import java.util.*
|
||||
|
||||
private val EXTERNAL_SOURCES_KINDS = arrayOf(
|
||||
JvmDeclarationOriginKind.CLASS_MEMBER_DELEGATION_TO_DEFAULT_IMPL,
|
||||
JvmDeclarationOriginKind.DEFAULT_IMPL_DELEGATION_TO_SUPERINTERFACE_DEFAULT_IMPL,
|
||||
JvmDeclarationOriginKind.DELEGATION,
|
||||
JvmDeclarationOriginKind.BRIDGE
|
||||
JvmDeclarationOriginKind.CLASS_MEMBER_DELEGATION_TO_DEFAULT_IMPL,
|
||||
JvmDeclarationOriginKind.DEFAULT_IMPL_DELEGATION_TO_SUPERINTERFACE_DEFAULT_IMPL,
|
||||
JvmDeclarationOriginKind.DELEGATION,
|
||||
JvmDeclarationOriginKind.BRIDGE
|
||||
)
|
||||
|
||||
private val PREDEFINED_SIGNATURES = listOf(
|
||||
"getClass()Ljava/lang/Class;",
|
||||
"notify()V",
|
||||
"notifyAll()V",
|
||||
"wait()V",
|
||||
"wait(J)V",
|
||||
"wait(JI)V"
|
||||
"getClass()Ljava/lang/Class;",
|
||||
"notify()V",
|
||||
"notifyAll()V",
|
||||
"wait()V",
|
||||
"wait(J)V",
|
||||
"wait(JI)V"
|
||||
).map { signature ->
|
||||
RawSignature(signature.substringBefore('('), signature.substring(signature.indexOf('(')), MemberKind.METHOD)
|
||||
}
|
||||
@@ -77,8 +77,7 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
val elements = LinkedHashSet<PsiElement>()
|
||||
if (noOwnImplementations) {
|
||||
elements.addIfNotNull(data.classOrigin.element)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for (origin in data.signatureOrigins) {
|
||||
var element = origin.element
|
||||
|
||||
@@ -96,9 +95,9 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
}
|
||||
|
||||
override fun onClassDone(
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
|
||||
) {
|
||||
reportDiagnosticsTasks.add {
|
||||
reportClashingWithPredefinedSignatures(classOrigin, classInternalName, signatures)
|
||||
@@ -107,9 +106,9 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
}
|
||||
|
||||
private fun reportClashingWithPredefinedSignatures(
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
|
||||
) {
|
||||
for (predefinedSignature in PREDEFINED_SIGNATURES) {
|
||||
if (!signatures.containsKey(predefinedSignature)) continue
|
||||
@@ -122,9 +121,9 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
}
|
||||
|
||||
private fun reportClashingSignaturesInHierarchy(
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
|
||||
) {
|
||||
val descriptor = classOrigin.descriptor
|
||||
if (descriptor !is ClassDescriptor) return
|
||||
@@ -141,9 +140,7 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
for ((rawSignature, origins) in groupedBySignature.entrySet()) {
|
||||
if (origins.size <= 1) continue
|
||||
|
||||
val diagnostic = computeDiagnosticToReport(classOrigin, classInternalName, rawSignature, origins)
|
||||
|
||||
when (diagnostic) {
|
||||
when (val diagnostic = computeDiagnosticToReport(classOrigin, classInternalName, rawSignature, origins)) {
|
||||
is ConflictingDeclarationError.AccidentalOverride -> {
|
||||
diagnostics.report(ErrorsJvm.ACCIDENTAL_OVERRIDE.on(diagnostic.element, diagnostic.data))
|
||||
}
|
||||
@@ -156,16 +153,17 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
|
||||
private sealed class ConflictingDeclarationError(val element: PsiElement, val data: ConflictingJvmDeclarationsData) {
|
||||
class AccidentalOverride(element: PsiElement, data: ConflictingJvmDeclarationsData) :
|
||||
ConflictingDeclarationError(element, data)
|
||||
ConflictingDeclarationError(element, data)
|
||||
|
||||
class ConflictingInheritedJvmDeclarations(element: PsiElement, data: ConflictingJvmDeclarationsData) :
|
||||
ConflictingDeclarationError(element, data)
|
||||
ConflictingDeclarationError(element, data)
|
||||
}
|
||||
|
||||
private fun computeDiagnosticToReport(
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
rawSignature: RawSignature,
|
||||
origins: Collection<JvmDeclarationOrigin>
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
rawSignature: RawSignature,
|
||||
origins: Collection<JvmDeclarationOrigin>
|
||||
): ConflictingDeclarationError? {
|
||||
var memberElement: PsiElement? = null
|
||||
var ownNonFakeCount = 0
|
||||
@@ -211,19 +209,17 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
if (member is PropertyDescriptor) {
|
||||
processMember(member.getter)
|
||||
processMember(member.setter)
|
||||
}
|
||||
else if (member is FunctionDescriptor) {
|
||||
} else if (member is FunctionDescriptor) {
|
||||
val signatures =
|
||||
if (member.kind == FAKE_OVERRIDE)
|
||||
member.overriddenTreeUniqueAsSequence(useOriginal = true)
|
||||
// drop the root (itself)
|
||||
.drop(1)
|
||||
.mapTo(HashSet()) { it.asRawSignature() }
|
||||
else
|
||||
setOf(member.asRawSignature())
|
||||
if (member.kind == FAKE_OVERRIDE)
|
||||
member.overriddenTreeUniqueAsSequence(useOriginal = true)
|
||||
// drop the root (itself)
|
||||
.drop(1)
|
||||
.mapTo(HashSet()) { it.asRawSignature() }
|
||||
else
|
||||
setOf(member.asRawSignature())
|
||||
|
||||
signatures.forEach {
|
||||
rawSignature ->
|
||||
signatures.forEach { rawSignature ->
|
||||
groupedBySignature.putValue(rawSignature, OtherOrigin(member))
|
||||
}
|
||||
}
|
||||
@@ -232,10 +228,10 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
descriptor.defaultType.memberScope.getContributedDescriptors().forEach(::processMember)
|
||||
descriptor.getParentJavaStaticClassScope()?.run {
|
||||
getContributedDescriptors(DescriptorKindFilter.FUNCTIONS)
|
||||
.filter {
|
||||
it is FunctionDescriptor && DescriptorVisibilities.isVisibleIgnoringReceiver(it, descriptor)
|
||||
}
|
||||
.forEach(::processMember)
|
||||
.filter {
|
||||
it is FunctionDescriptor && DescriptorVisibilities.isVisibleIgnoringReceiver(it, descriptor)
|
||||
}
|
||||
.forEach(::processMember)
|
||||
}
|
||||
|
||||
return groupedBySignature
|
||||
|
||||
Generated
+6
@@ -238,6 +238,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
runTest("compiler/testData/ir/irText/classes/kt43217.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45853.kt")
|
||||
public void testKt45853() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/classes/kt45853.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaInDataClassDefaultParameter.kt")
|
||||
public void testLambdaInDataClassDefaultParameter() throws Exception {
|
||||
|
||||
@@ -696,4 +696,8 @@ fun IrExpression?.isPure(
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
fun IrDeclaration.isFromJava(): Boolean =
|
||||
origin == IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB ||
|
||||
parent is IrDeclaration && (parent as IrDeclaration).isFromJava()
|
||||
|
||||
+1
-1
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.backend.jvm.codegen
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.ir.isFromJava
|
||||
import org.jetbrains.kotlin.backend.common.lower.BOUND_RECEIVER_PARAMETER
|
||||
import org.jetbrains.kotlin.backend.common.lower.SYNTHESIZED_INIT_BLOCK
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
|
||||
@@ -12,7 +13,6 @@ import org.jetbrains.kotlin.backend.jvm.JvmLoweredStatementOrigin
|
||||
import org.jetbrains.kotlin.backend.jvm.intrinsics.IrIntrinsicMethods
|
||||
import org.jetbrains.kotlin.backend.jvm.intrinsics.JavaClassProperty
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.erasedUpperBound
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.isFromJava
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.isInlineClassType
|
||||
import org.jetbrains.kotlin.backend.jvm.lower.MultifileFacadeFileEntry
|
||||
import org.jetbrains.kotlin.backend.jvm.lower.constantValue
|
||||
|
||||
+1
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.backend.jvm.codegen
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.ir.allOverridden
|
||||
import org.jetbrains.kotlin.backend.common.ir.isFromJava
|
||||
import org.jetbrains.kotlin.backend.common.ir.isMethodOfAny
|
||||
import org.jetbrains.kotlin.backend.common.ir.isTopLevel
|
||||
import org.jetbrains.kotlin.backend.common.lower.parentsWithSelf
|
||||
|
||||
@@ -349,10 +349,6 @@ val IrDeclaration.isStaticInlineClassReplacement: Boolean
|
||||
get() = origin == JvmLoweredDeclarationOrigin.STATIC_INLINE_CLASS_REPLACEMENT
|
||||
|| origin == JvmLoweredDeclarationOrigin.STATIC_INLINE_CLASS_CONSTRUCTOR
|
||||
|
||||
fun IrDeclaration.isFromJava(): Boolean =
|
||||
origin == IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB ||
|
||||
parent is IrDeclaration && (parent as IrDeclaration).isFromJava()
|
||||
|
||||
val IrType.upperBound: IrType
|
||||
get() = erasedUpperBound.symbol.starProjectedType
|
||||
|
||||
|
||||
+1
-4
@@ -6,10 +6,7 @@
|
||||
package org.jetbrains.kotlin.backend.jvm.lower
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
||||
import org.jetbrains.kotlin.backend.common.ir.allOverridden
|
||||
import org.jetbrains.kotlin.backend.common.ir.copyTo
|
||||
import org.jetbrains.kotlin.backend.common.ir.isMethodOfAny
|
||||
import org.jetbrains.kotlin.backend.common.ir.isStatic
|
||||
import org.jetbrains.kotlin.backend.common.ir.*
|
||||
import org.jetbrains.kotlin.backend.common.lower.*
|
||||
import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||
|
||||
+1
-1
@@ -6,11 +6,11 @@
|
||||
package org.jetbrains.kotlin.backend.jvm.lower
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.ClassLoweringPass
|
||||
import org.jetbrains.kotlin.backend.common.ir.isFromJava
|
||||
import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
|
||||
import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||
import org.jetbrains.kotlin.backend.jvm.codegen.isJvmInterface
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.isFromJava
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.ir.builders.declarations.buildFun
|
||||
import org.jetbrains.kotlin.ir.builders.declarations.buildValueParameter
|
||||
|
||||
+1
-1
@@ -6,13 +6,13 @@
|
||||
package org.jetbrains.kotlin.backend.jvm.lower.indy
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.ir.allOverridden
|
||||
import org.jetbrains.kotlin.backend.common.ir.isFromJava
|
||||
import org.jetbrains.kotlin.backend.common.lower.VariableRemapper
|
||||
import org.jetbrains.kotlin.backend.common.lower.parents
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.erasedUpperBound
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.getSingleAbstractMethod
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.isCompiledToJvmDefault
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.isFromJava
|
||||
import org.jetbrains.kotlin.backend.jvm.lower.findInterfaceImplementation
|
||||
import org.jetbrains.kotlin.backend.jvm.lower.isPrivate
|
||||
import org.jetbrains.kotlin.builtins.functions.BuiltInFunctionArity
|
||||
|
||||
+1
-5
@@ -5,17 +5,13 @@
|
||||
|
||||
package org.jetbrains.kotlin.backend.jvm.lower.inlineclasses
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.ir.copyTo
|
||||
import org.jetbrains.kotlin.backend.common.ir.copyTypeParameters
|
||||
import org.jetbrains.kotlin.backend.common.ir.copyTypeParametersFrom
|
||||
import org.jetbrains.kotlin.backend.common.ir.createDispatchReceiverParameter
|
||||
import org.jetbrains.kotlin.backend.common.ir.*
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
|
||||
import org.jetbrains.kotlin.backend.jvm.codegen.classFileContainsMethod
|
||||
import org.jetbrains.kotlin.backend.jvm.codegen.isJvmInterface
|
||||
import org.jetbrains.kotlin.backend.jvm.codegen.parentClassId
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.isCompiledToJvmDefault
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.isFromJava
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.isStaticInlineClassReplacement
|
||||
import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.InlineClassAbi.mangledNameFor
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
|
||||
|
||||
+3
-1
@@ -80,6 +80,8 @@ abstract class DescriptorMangleComputer(protected val builder: StringBuilder, pr
|
||||
|
||||
protected open fun addReturnType(): Boolean = false
|
||||
|
||||
protected open fun addReturnTypeSpecialCase(functionDescriptor: FunctionDescriptor): Boolean = false
|
||||
|
||||
open fun FunctionDescriptor.specialValueParamPrefix(param: ValueParameterDescriptor): String = ""
|
||||
|
||||
private val CallableDescriptor.isRealStatic: Boolean
|
||||
@@ -125,7 +127,7 @@ abstract class DescriptorMangleComputer(protected val builder: StringBuilder, pr
|
||||
.collectForMangler(builder, MangleConstant.TYPE_PARAMETERS) { mangleTypeParameter(this, it) }
|
||||
|
||||
returnType?.run {
|
||||
if (!isCtor && !isUnit() && addReturnType()) {
|
||||
if (!isCtor && !isUnit() && (addReturnType() || addReturnTypeSpecialCase(this@mangleSignature))) {
|
||||
mangleType(builder, this)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -33,6 +33,8 @@ abstract class IrMangleComputer(protected val builder: StringBuilder, private va
|
||||
|
||||
open fun addReturnType(): Boolean = false
|
||||
|
||||
protected open fun addReturnTypeSpecialCase(irFunction: IrFunction): Boolean = false
|
||||
|
||||
abstract override fun copy(newMode: MangleMode): IrMangleComputer
|
||||
|
||||
private fun StringBuilder.appendName(s: String) {
|
||||
@@ -121,7 +123,7 @@ abstract class IrMangleComputer(protected val builder: StringBuilder, private va
|
||||
|
||||
typeParameters.collectForMangler(builder, MangleConstant.TYPE_PARAMETERS) { mangleTypeParameter(this, it) }
|
||||
|
||||
if (!isCtor && !returnType.isUnit() && addReturnType()) {
|
||||
if (!isCtor && !returnType.isUnit() && (addReturnType() || addReturnTypeSpecialCase(this))) {
|
||||
mangleType(builder, returnType)
|
||||
}
|
||||
}
|
||||
|
||||
+16
-3
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.backend.jvm.serialization
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.ir.isFromJava
|
||||
import org.jetbrains.kotlin.backend.common.serialization.mangle.KotlinExportChecker
|
||||
import org.jetbrains.kotlin.backend.common.serialization.mangle.KotlinMangleComputer
|
||||
import org.jetbrains.kotlin.backend.common.serialization.mangle.MangleConstant
|
||||
@@ -20,6 +21,8 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.idea.MainFunctionDetector
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||
import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor
|
||||
import org.jetbrains.kotlin.load.java.lazy.descriptors.isJavaField
|
||||
|
||||
abstract class AbstractJvmManglerIr : IrBasedKotlinManglerImpl() {
|
||||
@@ -33,7 +36,11 @@ abstract class AbstractJvmManglerIr : IrBasedKotlinManglerImpl() {
|
||||
}
|
||||
|
||||
private class JvmIrManglerComputer(builder: StringBuilder, mode: MangleMode) : IrMangleComputer(builder, mode) {
|
||||
override fun copy(newMode: MangleMode): IrMangleComputer = JvmIrManglerComputer(builder, newMode)
|
||||
override fun copy(newMode: MangleMode): IrMangleComputer =
|
||||
JvmIrManglerComputer(builder, newMode)
|
||||
|
||||
override fun addReturnTypeSpecialCase(irFunction: IrFunction): Boolean =
|
||||
irFunction.isFromJava()
|
||||
}
|
||||
|
||||
override fun getExportChecker(): KotlinExportChecker<IrDeclaration> = exportChecker
|
||||
@@ -55,8 +62,14 @@ abstract class AbstractJvmDescriptorMangler(private val mainDetector: MainFuncti
|
||||
override fun DeclarationDescriptor.isPlatformSpecificExported() = false
|
||||
}
|
||||
|
||||
private class JvmDescriptorManglerComputer(builder: StringBuilder, private val mainDetector: MainFunctionDetector?, mode: MangleMode) :
|
||||
DescriptorMangleComputer(builder, mode) {
|
||||
private class JvmDescriptorManglerComputer(
|
||||
builder: StringBuilder,
|
||||
private val mainDetector: MainFunctionDetector?,
|
||||
mode: MangleMode
|
||||
) : DescriptorMangleComputer(builder, mode) {
|
||||
override fun addReturnTypeSpecialCase(functionDescriptor: FunctionDescriptor): Boolean =
|
||||
functionDescriptor is JavaMethodDescriptor
|
||||
|
||||
override fun copy(newMode: MangleMode): DescriptorMangleComputer =
|
||||
JvmDescriptorManglerComputer(builder, mainDetector, newMode)
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// FILE: kt45853.kt
|
||||
open class MyProblem() : ThrowableProblem() {
|
||||
override fun getCause(): Exceptional? = super.cause
|
||||
}
|
||||
|
||||
// FILE: Exceptional.java
|
||||
public interface Exceptional {
|
||||
Exceptional getCause();
|
||||
}
|
||||
|
||||
// FILE: ThrowableProblem.java
|
||||
public abstract class ThrowableProblem extends RuntimeException implements Exceptional {
|
||||
@Override
|
||||
public ThrowableProblem getCause() {
|
||||
// cast is safe, since the only way to set this is our constructor
|
||||
return (ThrowableProblem) super.getCause();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
@kotlin.Metadata
|
||||
public class MyProblem {
|
||||
// source: 'kt45853.kt'
|
||||
public method <init>(): void
|
||||
public @org.jetbrains.annotations.Nullable method getCause(): Exceptional
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// FILE: kt45853a.kt
|
||||
abstract class A {
|
||||
open val a: A? get() = null
|
||||
}
|
||||
|
||||
class B() : AX() {
|
||||
override fun getA(): X? = super.a
|
||||
}
|
||||
|
||||
// FILE: X.java
|
||||
public interface X {
|
||||
X getA();
|
||||
}
|
||||
|
||||
// FILE: AX.java
|
||||
public abstract class AX extends A implements X {
|
||||
@Override
|
||||
public AX getA() {
|
||||
return (AX) super.getA();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
@kotlin.Metadata
|
||||
public abstract class A {
|
||||
// source: 'kt45853a.kt'
|
||||
public method <init>(): void
|
||||
public @org.jetbrains.annotations.Nullable method getA(): A
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class B {
|
||||
// source: 'kt45853a.kt'
|
||||
public method <init>(): void
|
||||
public @org.jetbrains.annotations.Nullable method getA(): X
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// SKIP_KT_DUMP
|
||||
// DUMP_EXTERNAL_CLASS: X
|
||||
// DUMP_EXTERNAL_CLASS: AX
|
||||
// FILE: kt45853.kt
|
||||
|
||||
abstract class A {
|
||||
abstract val a: A?
|
||||
}
|
||||
|
||||
class B() : AX() {
|
||||
override fun getA(): X? = super.a
|
||||
}
|
||||
|
||||
// FILE: X.java
|
||||
public interface X {
|
||||
X getA();
|
||||
}
|
||||
|
||||
// FILE: AX.java
|
||||
public abstract class AX extends A implements X {
|
||||
@Override
|
||||
public AX getA() {
|
||||
return (AX) super.getA();
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
FILE fqName:<root> fileName:/kt45853.kt
|
||||
CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:a visibility:public modality:ABSTRACT [val]
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-a> visibility:public modality:ABSTRACT <> ($this:<root>.A) returnType:<root>.A?
|
||||
correspondingProperty: PROPERTY name:a visibility:public modality:ABSTRACT [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:B modality:FINAL visibility:public superTypes:[<root>.AX]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.B [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.AX'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public superTypes:[<root>.AX]'
|
||||
FUN name:getA visibility:public modality:OPEN <> ($this:<root>.B) returnType:<root>.X?
|
||||
overridden:
|
||||
public abstract fun getA (): @[FlexibleNullability] <root>.X? [fake_override] declared in <root>.AX
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.B
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun getA (): <root>.X? declared in <root>.B'
|
||||
CALL 'public open fun <get-a> (): @[EnhancedNullability] <root>.AX? declared in <root>.AX' superQualifier='CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:AX modality:ABSTRACT visibility:public superTypes:[<root>.A; <root>.X]' type=@[EnhancedNullability] <root>.AX? origin=GET_PROPERTY
|
||||
$this: GET_VAR '<this>: <root>.B declared in <root>.B.getA' type=<root>.B origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.AX
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.AX
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.AX
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
PROPERTY FAKE_OVERRIDE name:a visibility:public modality:OPEN [fake_override,val]
|
||||
FUN FAKE_OVERRIDE name:<get-a> visibility:public modality:OPEN <> ($this:<root>.AX) returnType:@[EnhancedNullability] <root>.AX? [fake_override]
|
||||
annotations:
|
||||
Override
|
||||
correspondingProperty: PROPERTY FAKE_OVERRIDE name:a visibility:public modality:OPEN [fake_override,val]
|
||||
overridden:
|
||||
public open fun <get-a> (): @[EnhancedNullability] <root>.AX? declared in <root>.AX
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.AX
|
||||
@@ -0,0 +1,31 @@
|
||||
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:AX modality:ABSTRACT visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>; <root>.X]
|
||||
$this: VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:<this> type:<root>.AX
|
||||
CONSTRUCTOR IR_EXTERNAL_DECLARATION_STUB visibility:public <> () returnType:<root>.AX [primary]
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:<unbound IrClassPublicSymbolImpl> [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): <unbound IrClassPublicSymbolImpl> [fake_override,operator] declared in <root>.A
|
||||
public open fun equals (other: kotlin.Any?): <unbound IrClassPublicSymbolImpl> [fake_override,operator] declared in <root>.X
|
||||
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:<unbound IrClassPublicSymbolImpl> [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): <unbound IrClassPublicSymbolImpl> [fake_override] declared in <root>.A
|
||||
public open fun hashCode (): <unbound IrClassPublicSymbolImpl> [fake_override] declared in <root>.X
|
||||
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:<unbound IrClassPublicSymbolImpl> [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): <unbound IrClassPublicSymbolImpl> [fake_override] declared in <root>.A
|
||||
public open fun toString (): <unbound IrClassPublicSymbolImpl> [fake_override] declared in <root>.X
|
||||
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:getA visibility:public modality:ABSTRACT <> ($this:<root>.X) returnType:<root>.X? [fake_override]
|
||||
overridden:
|
||||
public abstract fun getA (): <root>.X? declared in <root>.X
|
||||
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:<root>.X
|
||||
PROPERTY IR_EXTERNAL_DECLARATION_STUB name:a visibility:public modality:OPEN [val]
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:<get-a> visibility:public modality:OPEN <> ($this:<root>.AX) returnType:<root>.AX?
|
||||
annotations:
|
||||
<unbound>
|
||||
correspondingProperty: PROPERTY IR_EXTERNAL_DECLARATION_STUB name:a visibility:public modality:OPEN [val]
|
||||
overridden:
|
||||
public abstract fun <get-a> (): <root>.A? declared in <root>.A
|
||||
$this: VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:<this> type:<root>.AX
|
||||
@@ -0,0 +1,17 @@
|
||||
CLASS IR_EXTERNAL_DECLARATION_STUB INTERFACE name:X modality:ABSTRACT visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]
|
||||
$this: VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:<this> type:<root>.X
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:<unbound IrClassPublicSymbolImpl>, other:<unbound IrClassPublicSymbolImpl>?) returnType:<unbound IrClassPublicSymbolImpl> [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: <unbound IrClassPublicSymbolImpl>?): <unbound IrClassPublicSymbolImpl> [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:<unbound IrClassPublicSymbolImpl> [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): <unbound IrClassPublicSymbolImpl> declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:<unbound IrClassPublicSymbolImpl> [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): <unbound IrClassPublicSymbolImpl> declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER FAKE_OVERRIDE name:<this> type:kotlin.Any
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:getA visibility:public modality:ABSTRACT <> ($this:<root>.X) returnType:<root>.X?
|
||||
$this: VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:<this> type:<root>.X
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// DUMP_EXTERNAL_CLASS: J1
|
||||
// FILE: constructorWithOwnTypeParametersCall.kt
|
||||
// DUMP_EXTERNAL_CLASS J1
|
||||
|
||||
fun testKotlin() = K1<Int>().K2<String>()
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// DUMP_EXTERNAL_CLASS kotlin.Int
|
||||
// DUMP_EXTERNAL_CLASS: kotlin.Int
|
||||
|
||||
val test = Int.MIN_VALUE
|
||||
@@ -1,5 +1,5 @@
|
||||
// DUMP_EXTERNAL_CLASS: J1
|
||||
// FILE: javaConstructorWithTypeParameters.kt
|
||||
// DUMP_EXTERNAL_CLASS J1
|
||||
|
||||
fun test1() = J1<Int>()
|
||||
|
||||
|
||||
Generated
+6
@@ -238,6 +238,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/classes/kt43217.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45853.kt")
|
||||
public void testKt45853() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/classes/kt45853.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaInDataClassDefaultParameter.kt")
|
||||
public void testLambdaInDataClassDefaultParameter() throws Exception {
|
||||
|
||||
+10
@@ -170,6 +170,16 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/kt43440.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45853.kt")
|
||||
public void testKt45853() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/kt45853.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45853a.kt")
|
||||
public void testKt45853a() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/kt45853a.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localFunction.kt")
|
||||
public void testLocalFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/localFunction.kt");
|
||||
|
||||
+10
@@ -170,6 +170,16 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
|
||||
runTest("compiler/testData/codegen/bytecodeListing/kt43440.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45853.kt")
|
||||
public void testKt45853() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/kt45853.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45853a.kt")
|
||||
public void testKt45853a() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/kt45853a.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localFunction.kt")
|
||||
public void testLocalFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/localFunction.kt");
|
||||
|
||||
Reference in New Issue
Block a user