Drop erased class for inline class
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import com.intellij.util.ArrayUtil
|
||||
import org.jetbrains.kotlin.codegen.context.ClassContext
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
|
||||
@@ -15,13 +14,9 @@ import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.resolve.InlineClassDescriptorResolver
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.secondaryConstructors
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErasedInlineClassOrigin
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.Synthetic
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodGenericSignature
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
|
||||
class ErasedInlineClassBodyCodegen(
|
||||
aClass: KtClass,
|
||||
@@ -31,25 +26,19 @@ class ErasedInlineClassBodyCodegen(
|
||||
parentCodegen: MemberCodegen<*>?
|
||||
) : ClassBodyCodegen(aClass, context, v, state, parentCodegen) {
|
||||
|
||||
private val classAsmType = typeMapper.mapErasedInlineClass(descriptor)
|
||||
private val classAsmType = typeMapper.mapClass(descriptor)
|
||||
|
||||
private val constructorCodegen = ConstructorCodegen(
|
||||
descriptor, context, functionCodegen, this, this, state, kind, v, classAsmType, aClass, bindingContext
|
||||
)
|
||||
|
||||
override fun generateDeclaration() {
|
||||
v.defineClass(
|
||||
myClass.psiOrParent, state.classFileVersion, Opcodes.ACC_STATIC,
|
||||
classAsmType.internalName, null, "java/lang/Object", ArrayUtil.EMPTY_STRING_ARRAY
|
||||
)
|
||||
v.visitSource(myClass.containingKtFile.name, null)
|
||||
}
|
||||
override fun generateDeclaration() {}
|
||||
override fun generateKotlinMetadataAnnotation() {}
|
||||
override fun done() {}
|
||||
|
||||
override fun generateConstructors() {
|
||||
val delegationFieldsInfo = DelegationFieldsInfo(classAsmType, descriptor, state, bindingContext)
|
||||
|
||||
generateDefaultConstructorForErasedInlineClass()
|
||||
|
||||
constructorCodegen.generatePrimaryConstructor(delegationFieldsInfo, AsmTypes.OBJECT_TYPE)
|
||||
|
||||
for (secondaryConstructor in descriptor.secondaryConstructors) {
|
||||
@@ -57,21 +46,6 @@ class ErasedInlineClassBodyCodegen(
|
||||
}
|
||||
}
|
||||
|
||||
private fun generateDefaultConstructorForErasedInlineClass() {
|
||||
val mv = v.newMethod(
|
||||
ErasedInlineClassOrigin(myClass.psiOrParent, descriptor), 0,
|
||||
"<init>", "()V", null, ArrayUtil.EMPTY_STRING_ARRAY
|
||||
)
|
||||
mv.visitCode()
|
||||
InstructionAdapter(mv).apply {
|
||||
load(0, AsmTypes.OBJECT_TYPE)
|
||||
invokespecial(AsmTypes.OBJECT_TYPE.internalName, "<init>", "()V", false)
|
||||
areturn(Type.VOID_TYPE)
|
||||
}
|
||||
mv.visitMaxs(1, 1)
|
||||
mv.visitEnd()
|
||||
}
|
||||
|
||||
override fun generateSyntheticPartsAfterBody() {
|
||||
super.generateSyntheticPartsAfterBody()
|
||||
|
||||
@@ -141,8 +115,4 @@ class ErasedInlineClassBodyCodegen(
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
override fun generateKotlinMetadataAnnotation() {
|
||||
writeSyntheticClassMetadata(v, state)
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,7 @@ public class FunctionCodegen {
|
||||
asmMethod.getDescriptor()
|
||||
);
|
||||
|
||||
if (CodegenContextUtil.isImplClassOwner(owner)) {
|
||||
if (CodegenContextUtil.isImplementationOwner(owner, functionDescriptor)) {
|
||||
v.getSerializationBindings().put(METHOD_FOR_FUNCTION, CodegenUtilKt.unwrapFrontendVersion(functionDescriptor), asmMethod);
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ public class FunctionCodegen {
|
||||
}
|
||||
|
||||
// base check
|
||||
boolean isInlineClass = isClass(containingDeclaration) && ((ClassDescriptor) containingDeclaration).isInline();
|
||||
boolean isInlineClass = InlineClassesUtilsKt.isInlineClass(containingDeclaration);
|
||||
boolean simpleFunctionOrProperty =
|
||||
!(functionDescriptor instanceof ConstructorDescriptor) && !KotlinTypeMapper.isAccessor(functionDescriptor);
|
||||
|
||||
@@ -323,10 +323,8 @@ public class FunctionCodegen {
|
||||
) {
|
||||
mv.visitCode();
|
||||
|
||||
Type inlineErasedType = typeMapper.mapErasedInlineClass(containingDeclaration);
|
||||
Method erasedMethodImpl = typeMapper.mapAsmMethod(functionDescriptor.getOriginal(), OwnerKind.ERASED_INLINE_CLASS);
|
||||
|
||||
Type fieldOwnerType = typeMapper.mapClass(containingDeclaration);
|
||||
Method erasedMethodImpl = typeMapper.mapAsmMethod(functionDescriptor.getOriginal(), OwnerKind.ERASED_INLINE_CLASS);
|
||||
|
||||
ValueParameterDescriptor valueRepresentation = InlineClassesUtilsKt.underlyingRepresentation(containingDeclaration);
|
||||
if (valueRepresentation == null) return;
|
||||
@@ -334,7 +332,7 @@ public class FunctionCodegen {
|
||||
Type fieldType = typeMapper.mapType(valueRepresentation);
|
||||
|
||||
generateDelegateToStaticErasedVersion(
|
||||
mv, erasedMethodImpl, inlineErasedType.getInternalName(),
|
||||
mv, erasedMethodImpl,
|
||||
fieldOwnerType, valueRepresentation.getName().asString(), fieldType
|
||||
);
|
||||
|
||||
@@ -915,11 +913,11 @@ public class FunctionCodegen {
|
||||
private static void generateDelegateToStaticErasedVersion(
|
||||
@NotNull MethodVisitor mv,
|
||||
@NotNull Method erasedStaticAsmMethod,
|
||||
@NotNull String classToDelegateTo,
|
||||
@NotNull Type fieldOwnerType,
|
||||
@NotNull String fieldName,
|
||||
@NotNull Type fieldType
|
||||
) {
|
||||
String internalName = fieldOwnerType.getInternalName();
|
||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||
Type[] argTypes = erasedStaticAsmMethod.getArgumentTypes();
|
||||
|
||||
@@ -928,7 +926,7 @@ public class FunctionCodegen {
|
||||
iv.visitLineNumber(1, label);
|
||||
|
||||
iv.load(0, AsmTypes.OBJECT_TYPE);
|
||||
iv.visitFieldInsn(Opcodes.GETFIELD, fieldOwnerType.getInternalName(), fieldName, fieldType.getDescriptor());
|
||||
iv.visitFieldInsn(Opcodes.GETFIELD, internalName, fieldName, fieldType.getDescriptor());
|
||||
|
||||
int k = 1;
|
||||
for (int i = 1; i < argTypes.length; i++) {
|
||||
@@ -937,7 +935,7 @@ public class FunctionCodegen {
|
||||
k += argType.getSize();
|
||||
}
|
||||
|
||||
iv.invokestatic(classToDelegateTo, erasedStaticAsmMethod.getName(), erasedStaticAsmMethod.getDescriptor(), false);
|
||||
iv.invokestatic(internalName, erasedStaticAsmMethod.getName(), erasedStaticAsmMethod.getDescriptor(), false);
|
||||
iv.areturn(erasedStaticAsmMethod.getReturnType());
|
||||
}
|
||||
|
||||
|
||||
@@ -256,18 +256,11 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
if (!(myClass instanceof KtClass)) return;
|
||||
if (!descriptor.isInline()) return;
|
||||
|
||||
Type erasedInlineClassType = state.getTypeMapper().mapErasedInlineClass(descriptor);
|
||||
ClassBuilder builder = state.getFactory().newVisitor(
|
||||
JvmDeclarationOriginKt.ErasedInlineClassOrigin(myClass.getPsiOrParent(), descriptor),
|
||||
erasedInlineClassType,
|
||||
myClass.getContainingKtFile()
|
||||
);
|
||||
|
||||
CodegenContext parentContext = context.getParentContext();
|
||||
assert parentContext != null : "Parent context of inline class declaration should not be null";
|
||||
|
||||
ClassContext erasedInlineClassContext = parentContext.intoWrapperForErasedInlineClass(descriptor, state);
|
||||
new ErasedInlineClassBodyCodegen((KtClass) myClass, erasedInlineClassContext, builder, state, this).generate();
|
||||
new ErasedInlineClassBodyCodegen((KtClass) myClass, erasedInlineClassContext, v, state, this).generate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -243,7 +243,7 @@ public abstract class MemberCodegen<T extends KtPureElement/* TODO: & KtDeclarat
|
||||
}
|
||||
|
||||
private void genTypeAliasAnnotationsMethodIfRequired(TypeAliasDescriptor typeAliasDescriptor) {
|
||||
boolean isAnnotationsMethodOwner = CodegenContextUtil.isImplClassOwner(context);
|
||||
boolean isAnnotationsMethodOwner = CodegenContextUtil.isImplementationOwner(context, typeAliasDescriptor);
|
||||
Annotations annotations = typeAliasDescriptor.getAnnotations();
|
||||
if (!isAnnotationsMethodOwner || annotations.isEmpty()) return;
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ public class PropertyCodegen {
|
||||
// Fields and '$annotations' methods for non-private const properties are generated in the multi-file facade
|
||||
boolean isBackingFieldOwner = descriptor.isConst() && !Visibilities.isPrivate(descriptor.getVisibility())
|
||||
? !(context instanceof MultifileClassPartContext)
|
||||
: CodegenContextUtil.isImplClassOwner(context);
|
||||
: CodegenContextUtil.isImplementationOwner(context, descriptor);
|
||||
|
||||
assert declaration != null : "Declaration is null: " + descriptor + " (context=" + context + ")";
|
||||
generateBackingField(declaration, descriptor, isBackingFieldOwner);
|
||||
@@ -338,7 +338,7 @@ public class PropertyCodegen {
|
||||
if (annotations.isEmpty()) return;
|
||||
|
||||
Method signature = getSyntheticMethodSignature(descriptor);
|
||||
if (kind != OwnerKind.DEFAULT_IMPLS && CodegenContextUtil.isImplClassOwner(context)) {
|
||||
if (kind != OwnerKind.DEFAULT_IMPLS && CodegenContextUtil.isImplementationOwner(context, descriptor)) {
|
||||
v.getSerializationBindings().put(SYNTHETIC_METHOD_FOR_PROPERTY, descriptor, signature);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,10 +37,6 @@ class SuperClassInfo(
|
||||
return SuperClassInfo(OBJECT_TYPE, null)
|
||||
}
|
||||
|
||||
if (descriptor.isInline) {
|
||||
return SuperClassInfo(typeMapper.mapErasedInlineClass(descriptor), null)
|
||||
}
|
||||
|
||||
for (supertype in descriptor.typeConstructor.supertypes) {
|
||||
val superClass = supertype.constructor.declarationDescriptor
|
||||
if (superClass != null && !isJvmInterface(superClass)) {
|
||||
|
||||
@@ -16,16 +16,31 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen.context
|
||||
|
||||
import org.jetbrains.kotlin.codegen.OwnerKind
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.resolve.isInlineClass
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
|
||||
object CodegenContextUtil {
|
||||
@JvmStatic fun getImplementationOwnerClassType(owner: CodegenContext<*>): Type? =
|
||||
when (owner) {
|
||||
is MultifileClassFacadeContext -> owner.filePartType
|
||||
is DelegatingToPartContext -> owner.implementationOwnerClassType
|
||||
else -> null
|
||||
}
|
||||
@JvmStatic
|
||||
fun getImplementationOwnerClassType(owner: CodegenContext<*>): Type? =
|
||||
when (owner) {
|
||||
is MultifileClassFacadeContext -> owner.filePartType
|
||||
is DelegatingToPartContext -> owner.implementationOwnerClassType
|
||||
else -> null
|
||||
}
|
||||
|
||||
@JvmStatic fun isImplClassOwner(owner: CodegenContext<*>): Boolean =
|
||||
owner !is MultifileClassFacadeContext
|
||||
@JvmStatic
|
||||
fun isImplementationOwner(owner: CodegenContext<*>, descriptor: DeclarationDescriptor): Boolean {
|
||||
if (descriptor.containingDeclaration?.isInlineClass() == true) {
|
||||
val isInErasedMethod = owner.contextKind == OwnerKind.ERASED_INLINE_CLASS
|
||||
when (descriptor) {
|
||||
is FunctionDescriptor -> return isInErasedMethod
|
||||
is PropertyDescriptor -> return !isInErasedMethod
|
||||
}
|
||||
}
|
||||
return owner !is MultifileClassFacadeContext
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,9 +327,6 @@ public class KotlinTypeMapper {
|
||||
if (isInterface(classDescriptor)) {
|
||||
nestedClass = JvmAbi.DEFAULT_IMPLS_SUFFIX;
|
||||
}
|
||||
else if (classDescriptor.isInline()) {
|
||||
nestedClass = JvmAbi.ERASED_INLINE_CLASS_SUFFIX;
|
||||
}
|
||||
else {
|
||||
nestedClass = null;
|
||||
}
|
||||
@@ -479,10 +476,6 @@ public class KotlinTypeMapper {
|
||||
return mapTypeAsDeclaration(descriptor.getReturnType());
|
||||
}
|
||||
|
||||
public Type mapErasedInlineClass(@NotNull ClassDescriptor descriptor) {
|
||||
return Type.getObjectType(mapClass(descriptor).getInternalName() + JvmAbi.ERASED_INLINE_CLASS_SUFFIX);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JvmMethodGenericSignature mapAnnotationParameterSignature(@NotNull PropertyDescriptor descriptor) {
|
||||
JvmSignatureWriter sw = new BothSignatureWriter(BothSignatureWriter.Mode.METHOD);
|
||||
@@ -533,13 +526,6 @@ public class KotlinTypeMapper {
|
||||
return mapInlineClassType(underlyingType, TypeMappingMode.DEFAULT);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Type mapToErasedInlineClassType(@NotNull KotlinType kotlinType) {
|
||||
return Type.getObjectType(
|
||||
mapInlineClassTypeAsDeclaration(kotlinType).getInternalName() + JvmAbi.ERASED_INLINE_CLASS_SUFFIX
|
||||
);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Type mapInlineClassType(@NotNull KotlinType kotlinType) {
|
||||
return mapInlineClassType(kotlinType, TypeMappingMode.DEFAULT);
|
||||
|
||||
Vendored
+6
-12
@@ -6,18 +6,6 @@ public final class Foo$Companion {
|
||||
public final method funInCompanion(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
static class Foo$Erased {
|
||||
method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(p0: int): Foo
|
||||
public static method constructor(p0: int): int
|
||||
public static method equals(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: int, p1: int): boolean
|
||||
public static method hashCode(p0: int): int
|
||||
public final static method inInlineClass(p0: int): void
|
||||
public static @org.jetbrains.annotations.NotNull method toString(p0: int): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
public final static field Companion: Foo$Companion
|
||||
@@ -26,9 +14,15 @@ public final class Foo {
|
||||
inner class Foo$Companion
|
||||
static method <clinit>(): void
|
||||
public synthetic method <init>(p0: int): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(p0: int): Foo
|
||||
public static method constructor(p0: int): int
|
||||
public static method equals(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public final method getX(): int
|
||||
public method hashCode(): int
|
||||
public static method hashCode(p0: int): int
|
||||
public final static method inInlineClass(p0: int): void
|
||||
public method toString(): java.lang.String
|
||||
public static @org.jetbrains.annotations.NotNull method toString(p0: int): java.lang.String
|
||||
public final method unbox(): int
|
||||
}
|
||||
|
||||
Vendored
+8
-13
@@ -1,23 +1,18 @@
|
||||
@kotlin.Metadata
|
||||
static class Foo$Erased {
|
||||
method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(p0: int): Foo
|
||||
public static method constructor(p0: int): int
|
||||
public static method equals(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: int, p1: int): boolean
|
||||
public final static method getAsThis(p0: int): int
|
||||
public final static method getProp(p0: int): int
|
||||
public static method hashCode(p0: int): int
|
||||
public static @org.jetbrains.annotations.NotNull method toString(p0: int): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
private final field x: int
|
||||
public synthetic method <init>(p0: int): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(p0: int): Foo
|
||||
public static method constructor(p0: int): int
|
||||
public static method equals(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: int, p1: int): boolean
|
||||
public final static method getAsThis(p0: int): int
|
||||
public final static method getProp(p0: int): int
|
||||
public final method getX(): int
|
||||
public method hashCode(): int
|
||||
public static method hashCode(p0: int): int
|
||||
public method toString(): java.lang.String
|
||||
public static @org.jetbrains.annotations.NotNull method toString(p0: int): java.lang.String
|
||||
public final method unbox(): int
|
||||
}
|
||||
|
||||
+7
-12
@@ -1,22 +1,17 @@
|
||||
@kotlin.Metadata
|
||||
static class Foo$Erased {
|
||||
method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(p0: int): Foo
|
||||
public static method constructor(p0: int): int
|
||||
public static method constructor(p0: long): int
|
||||
public static method equals(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: int, p1: int): boolean
|
||||
public static method hashCode(p0: int): int
|
||||
public static @org.jetbrains.annotations.NotNull method toString(p0: int): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
private final field x: int
|
||||
public synthetic method <init>(p0: int): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(p0: int): Foo
|
||||
public static method constructor(p0: int): int
|
||||
public static method constructor(p0: long): int
|
||||
public static method equals(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: int, p1: int): boolean
|
||||
public final method getX(): int
|
||||
public method hashCode(): int
|
||||
public static method hashCode(p0: int): int
|
||||
public method toString(): java.lang.String
|
||||
public static @org.jetbrains.annotations.NotNull method toString(p0: int): java.lang.String
|
||||
public final method unbox(): int
|
||||
}
|
||||
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
interface IFoo {
|
||||
fun overridingFun()
|
||||
fun String.overridingExtFun()
|
||||
|
||||
val overridingVal: Int
|
||||
var overridingVar: Int
|
||||
val String.overridingExtVal: Int
|
||||
var String.overridingExtVar: Int
|
||||
}
|
||||
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class A
|
||||
|
||||
@Target(AnnotationTarget.PROPERTY_GETTER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class AGet
|
||||
|
||||
@Target(AnnotationTarget.PROPERTY_SETTER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ASet
|
||||
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ASetParam
|
||||
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class AReceiver
|
||||
|
||||
inline class Z(@get:AGet val x: Int) : IFoo {
|
||||
|
||||
constructor(y: Long) : this(y.toInt())
|
||||
|
||||
@A override fun overridingFun() {}
|
||||
@A override fun @receiver:AReceiver String.overridingExtFun() {}
|
||||
|
||||
@A @get:AGet
|
||||
override val overridingVal: Int
|
||||
get() = x
|
||||
|
||||
@A @get:AGet @set:ASet @setparam:ASetParam
|
||||
override var overridingVar: Int
|
||||
get() = x
|
||||
set(v) {}
|
||||
|
||||
@A @get:AGet
|
||||
override val @receiver:AReceiver String.overridingExtVal: Int
|
||||
get() = x
|
||||
|
||||
@A @get:AGet @set:ASet @setparam:ASetParam
|
||||
override var @receiver:AReceiver String.overridingExtVar: Int
|
||||
get() = x
|
||||
set(v) {}
|
||||
|
||||
@A override fun toString(): String = x.toString()
|
||||
|
||||
@A fun nonOverridingFun() {}
|
||||
|
||||
@A fun @receiver:AReceiver String.nonOverridingExtFun() {}
|
||||
|
||||
@A @get:AGet
|
||||
val nonOverridingVal: Int get() = x
|
||||
|
||||
@A @get:AGet @set:ASet @setparam:ASetParam
|
||||
var nonOverridingVar: Int
|
||||
get() = x
|
||||
set(v) {}
|
||||
|
||||
@A @get:AGet
|
||||
val @receiver:AReceiver String.nonOverridingExtVal: Int
|
||||
get() = x
|
||||
|
||||
@A @get:AGet @set:ASet @setparam:ASetParam
|
||||
var @receiver:AReceiver String.nonOverridingExtVar: Int
|
||||
get() = x
|
||||
set(v) {}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
@kotlin.annotation.Target
|
||||
@kotlin.annotation.Retention
|
||||
@java.lang.annotation.Retention
|
||||
@java.lang.annotation.Target
|
||||
@kotlin.Metadata
|
||||
public annotation class A
|
||||
|
||||
@kotlin.annotation.Target
|
||||
@kotlin.annotation.Retention
|
||||
@java.lang.annotation.Retention
|
||||
@java.lang.annotation.Target
|
||||
@kotlin.Metadata
|
||||
public annotation class AGet
|
||||
|
||||
@kotlin.annotation.Target
|
||||
@kotlin.annotation.Retention
|
||||
@java.lang.annotation.Retention
|
||||
@java.lang.annotation.Target
|
||||
@kotlin.Metadata
|
||||
public annotation class AReceiver
|
||||
|
||||
@kotlin.annotation.Target
|
||||
@kotlin.annotation.Retention
|
||||
@java.lang.annotation.Retention
|
||||
@java.lang.annotation.Target
|
||||
@kotlin.Metadata
|
||||
public annotation class ASet
|
||||
|
||||
@kotlin.annotation.Target
|
||||
@kotlin.annotation.Retention
|
||||
@java.lang.annotation.Retention
|
||||
@java.lang.annotation.Target
|
||||
@kotlin.Metadata
|
||||
public annotation class ASetParam
|
||||
|
||||
@kotlin.Metadata
|
||||
public interface IFoo {
|
||||
public abstract method getOverridingExtVal(@org.jetbrains.annotations.NotNull p0: java.lang.String): int
|
||||
public abstract method getOverridingExtVar(@org.jetbrains.annotations.NotNull p0: java.lang.String): int
|
||||
public abstract method getOverridingVal(): int
|
||||
public abstract method getOverridingVar(): int
|
||||
public abstract method overridingExtFun(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public abstract method overridingFun(): void
|
||||
public abstract method setOverridingExtVar(@org.jetbrains.annotations.NotNull p0: java.lang.String, p1: int): void
|
||||
public abstract method setOverridingVar(p0: int): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Z {
|
||||
private final field x: int
|
||||
public synthetic method <init>(p0: int): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(p0: int): Z
|
||||
public static method constructor(p0: int): int
|
||||
public static method constructor(p0: long): int
|
||||
public static method equals(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public final static @AGet method getNonOverridingExtVal(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): int
|
||||
public final static @AGet method getNonOverridingExtVar(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): int
|
||||
public final static @AGet method getNonOverridingVal(p0: int): int
|
||||
public final static @AGet method getNonOverridingVar(p0: int): int
|
||||
public @AGet method getOverridingExtVal(@AReceiver @org.jetbrains.annotations.NotNull p0: java.lang.String): int
|
||||
public static @AGet method getOverridingExtVal(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): int
|
||||
public @AGet method getOverridingExtVar(@AReceiver @org.jetbrains.annotations.NotNull p0: java.lang.String): int
|
||||
public static @AGet method getOverridingExtVar(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): int
|
||||
public @AGet method getOverridingVal(): int
|
||||
public static @AGet method getOverridingVal(p0: int): int
|
||||
public @AGet method getOverridingVar(): int
|
||||
public static @AGet method getOverridingVar(p0: int): int
|
||||
public final @AGet method getX(): int
|
||||
public method hashCode(): int
|
||||
public static method hashCode(p0: int): int
|
||||
public final static @A method nonOverridingExtFun(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): void
|
||||
public synthetic deprecated static @A method nonOverridingExtVal$annotations(p0: java.lang.String): void
|
||||
public synthetic deprecated static @A method nonOverridingExtVar$annotations(p0: java.lang.String): void
|
||||
public final static @A method nonOverridingFun(p0: int): void
|
||||
public synthetic deprecated static @A method nonOverridingVal$annotations(): void
|
||||
public synthetic deprecated static @A method nonOverridingVar$annotations(): void
|
||||
public @A method overridingExtFun(@AReceiver @org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public static @A method overridingExtFun(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): void
|
||||
public synthetic deprecated static @A method overridingExtVal$annotations(p0: java.lang.String): void
|
||||
public synthetic deprecated static @A method overridingExtVar$annotations(p0: java.lang.String): void
|
||||
public @A method overridingFun(): void
|
||||
public static @A method overridingFun(p0: int): void
|
||||
public synthetic deprecated static @A method overridingVal$annotations(): void
|
||||
public synthetic deprecated static @A method overridingVar$annotations(): void
|
||||
public final static @ASet method setNonOverridingExtVar(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String, @ASetParam p2: int): void
|
||||
public final static @ASet method setNonOverridingVar(p0: int, @ASetParam p1: int): void
|
||||
public @ASet method setOverridingExtVar(@AReceiver @org.jetbrains.annotations.NotNull p0: java.lang.String, @ASetParam p1: int): void
|
||||
public static @ASet method setOverridingExtVar(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String, @ASetParam p2: int): void
|
||||
public @ASet method setOverridingVar(@ASetParam p0: int): void
|
||||
public static @ASet method setOverridingVar(p0: int, @ASetParam p1: int): void
|
||||
public @A @org.jetbrains.annotations.NotNull method toString(): java.lang.String
|
||||
public static @A @org.jetbrains.annotations.NotNull method toString(p0: int): java.lang.String
|
||||
public final method unbox(): int
|
||||
}
|
||||
+6
-12
@@ -3,27 +3,21 @@ public interface A {
|
||||
public abstract method foo(p0: java.lang.Object): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
static class Foo$Erased {
|
||||
method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(p0: long): Foo
|
||||
public static method constructor(p0: long): long
|
||||
public static method equals(p0: long, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: long, p1: long): boolean
|
||||
public static method foo-1e4ch6lh(p0: long, p1: long): void
|
||||
public static method hashCode(p0: long): int
|
||||
public static @org.jetbrains.annotations.NotNull method toString(p0: long): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
private final field x: long
|
||||
public synthetic method <init>(p0: long): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(p0: long): Foo
|
||||
public static method constructor(p0: long): long
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public static method equals(p0: long, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||
public synthetic method foo(p0: java.lang.Object): void
|
||||
public method foo-1e4ch6lh(p0: long): void
|
||||
public static method foo-1e4ch6lh(p0: long, p1: long): void
|
||||
public final method getX(): long
|
||||
public method hashCode(): int
|
||||
public static method hashCode(p0: long): int
|
||||
public method toString(): java.lang.String
|
||||
public static @org.jetbrains.annotations.NotNull method toString(p0: long): java.lang.String
|
||||
public final method unbox(): long
|
||||
}
|
||||
|
||||
Vendored
+9
-14
@@ -1,24 +1,19 @@
|
||||
@kotlin.Metadata
|
||||
static class Foo$Erased {
|
||||
method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(p0: long): Foo
|
||||
public static method constructor(p0: long): long
|
||||
public final static method empty(p0: long): void
|
||||
public static method equals(p0: long, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: long, p1: long): boolean
|
||||
public final static method extension(p0: long, @org.jetbrains.annotations.NotNull p1: java.lang.Object, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
||||
public static method hashCode(p0: long): int
|
||||
public final static method param(p0: long, p1: double): void
|
||||
public static @org.jetbrains.annotations.NotNull method toString(p0: long): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
private final field l: long
|
||||
public synthetic method <init>(p0: long): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(p0: long): Foo
|
||||
public static method constructor(p0: long): long
|
||||
public final static method empty(p0: long): void
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public static method equals(p0: long, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: long, p1: long): boolean
|
||||
public final static method extension(p0: long, @org.jetbrains.annotations.NotNull p1: java.lang.Object, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
||||
public final method getL(): long
|
||||
public method hashCode(): int
|
||||
public static method hashCode(p0: long): int
|
||||
public final static method param(p0: long, p1: double): void
|
||||
public method toString(): java.lang.String
|
||||
public static @org.jetbrains.annotations.NotNull method toString(p0: long): java.lang.String
|
||||
public final method unbox(): long
|
||||
}
|
||||
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
inline class Z(val x: Int)
|
||||
|
||||
interface IFoo
|
||||
interface IBar
|
||||
inline class FooBar(val x: Int) : IFoo, IBar
|
||||
|
||||
// 1 public final class Z extends Z\$Erased
|
||||
// 1 static class Z\$Erased
|
||||
// 0 public static class Z\$Erased
|
||||
|
||||
// 1 public final class FooBar extends FooBar\$Erased implements IFoo IBar
|
||||
// 1 static class FooBar\$Erased
|
||||
// 0 public static class FooBar\$Erased
|
||||
+5
@@ -289,6 +289,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassConstructors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassWithEverything.kt")
|
||||
public void testInlineClassWithEverything() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassWithEverything.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noBridgesForErasedInlineClass.kt")
|
||||
public void testNoBridgesForErasedInlineClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/noBridgesForErasedInlineClass.kt");
|
||||
|
||||
@@ -2108,11 +2108,6 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/inlineClassBoxingUnboxingInsideInlinedLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassExtendsErasedClass.kt")
|
||||
public void testInlineClassExtendsErasedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/inlineClassExtendsErasedClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassWrapperPrimaryConstructorIsSynthetic.kt")
|
||||
public void testInlineClassWrapperPrimaryConstructorIsSynthetic() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/inlineClassWrapperPrimaryConstructorIsSynthetic.kt");
|
||||
|
||||
Reference in New Issue
Block a user