Make inline class wrapper constructor synthetic
This commit is contained in:
@@ -255,13 +255,22 @@ public class AsmUtil {
|
|||||||
flags |= ACC_ABSTRACT;
|
flags |= ACC_ABSTRACT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KotlinTypeMapper.isAccessor(functionDescriptor) || hasJvmSyntheticAnnotation(functionDescriptor)) {
|
if (KotlinTypeMapper.isAccessor(functionDescriptor) ||
|
||||||
|
hasJvmSyntheticAnnotation(functionDescriptor) ||
|
||||||
|
isInlineClassWrapperConstructor(functionDescriptor, kind)
|
||||||
|
) {
|
||||||
flags |= ACC_SYNTHETIC;
|
flags |= ACC_SYNTHETIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isInlineClassWrapperConstructor(@NotNull FunctionDescriptor functionDescriptor, @NotNull OwnerKind kind) {
|
||||||
|
if (!(functionDescriptor instanceof ConstructorDescriptor)) return false;
|
||||||
|
ClassDescriptor classDescriptor = ((ConstructorDescriptor) functionDescriptor).getConstructedClass();
|
||||||
|
return classDescriptor.isInline() && kind == OwnerKind.IMPLEMENTATION;
|
||||||
|
}
|
||||||
|
|
||||||
public static int getCommonCallableFlags(FunctionDescriptor functionDescriptor, @NotNull GenerationState state) {
|
public static int getCommonCallableFlags(FunctionDescriptor functionDescriptor, @NotNull GenerationState state) {
|
||||||
int flags = getVisibilityAccessFlag(functionDescriptor);
|
int flags = getVisibilityAccessFlag(functionDescriptor);
|
||||||
flags |= getVarargsFlag(functionDescriptor);
|
flags |= getVarargsFlag(functionDescriptor);
|
||||||
|
|||||||
Vendored
+1
-1
@@ -24,7 +24,7 @@ public final class Foo {
|
|||||||
private final field x: int
|
private final field x: int
|
||||||
inner class Foo$Companion
|
inner class Foo$Companion
|
||||||
static method <clinit>(): void
|
static method <clinit>(): void
|
||||||
public method <init>(p0: int): void
|
public synthetic method <init>(p0: int): void
|
||||||
public method equals(p0: java.lang.Object): boolean
|
public method equals(p0: java.lang.Object): boolean
|
||||||
public final method getX(): int
|
public final method getX(): int
|
||||||
public method hashCode(): int
|
public method hashCode(): int
|
||||||
|
|||||||
Vendored
+1
-1
@@ -13,7 +13,7 @@ static class Foo$Erased {
|
|||||||
@kotlin.Metadata
|
@kotlin.Metadata
|
||||||
public final class Foo {
|
public final class Foo {
|
||||||
private final field x: int
|
private final field x: int
|
||||||
public method <init>(p0: int): void
|
public synthetic method <init>(p0: int): void
|
||||||
public method equals(p0: java.lang.Object): boolean
|
public method equals(p0: java.lang.Object): boolean
|
||||||
public final method getX(): int
|
public final method getX(): int
|
||||||
public method hashCode(): int
|
public method hashCode(): int
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ static class Foo$Erased {
|
|||||||
@kotlin.Metadata
|
@kotlin.Metadata
|
||||||
public final class Foo {
|
public final class Foo {
|
||||||
private final field x: int
|
private final field x: int
|
||||||
public method <init>(p0: int): void
|
public synthetic method <init>(p0: int): void
|
||||||
public method equals(p0: java.lang.Object): boolean
|
public method equals(p0: java.lang.Object): boolean
|
||||||
public final method getX(): int
|
public final method getX(): int
|
||||||
public method hashCode(): int
|
public method hashCode(): int
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ static class Foo$Erased {
|
|||||||
@kotlin.Metadata
|
@kotlin.Metadata
|
||||||
public final class Foo {
|
public final class Foo {
|
||||||
private final field x: long
|
private final field x: long
|
||||||
public method <init>(p0: long): void
|
public synthetic method <init>(p0: long): void
|
||||||
public method equals(p0: java.lang.Object): boolean
|
public method equals(p0: java.lang.Object): boolean
|
||||||
public synthetic method foo(p0: java.lang.Object): void
|
public synthetic method foo(p0: java.lang.Object): void
|
||||||
public method foo-1e4ch6lh(p0: long): void
|
public method foo-1e4ch6lh(p0: long): void
|
||||||
|
|||||||
Vendored
+1
-1
@@ -14,7 +14,7 @@ static class Foo$Erased {
|
|||||||
@kotlin.Metadata
|
@kotlin.Metadata
|
||||||
public final class Foo {
|
public final class Foo {
|
||||||
private final field l: long
|
private final field l: long
|
||||||
public method <init>(p0: long): void
|
public synthetic method <init>(p0: long): void
|
||||||
public method equals(p0: java.lang.Object): boolean
|
public method equals(p0: java.lang.Object): boolean
|
||||||
public final method getL(): long
|
public final method getL(): long
|
||||||
public method hashCode(): int
|
public method hashCode(): int
|
||||||
|
|||||||
+1
-1
@@ -6,5 +6,5 @@ class C1(val ss: Str)
|
|||||||
|
|
||||||
class C2(val ss1: Str, val ss2: Str)
|
class C2(val ss1: Str, val ss2: Str)
|
||||||
|
|
||||||
// 2 public \<init\>\(Ljava/lang/String;\)V
|
// 1 public \<init\>\(Ljava/lang/String;\)V
|
||||||
// 1 public \<init\>\(Ljava/lang/String;Ljava/lang/String;\)V
|
// 1 public \<init\>\(Ljava/lang/String;Ljava/lang/String;\)V
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
// !LANGUAGE: +InlineClasses
|
||||||
|
|
||||||
|
inline class Z(val x: Int)
|
||||||
|
|
||||||
|
// 1 public synthetic <init>\(I\)V
|
||||||
|
// 1 public static constructor\(I\)I
|
||||||
@@ -2113,6 +2113,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/inlineClassExtendsErasedClass.kt");
|
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/inlineClassExtendsErasedClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inlineClassWrapperPrimaryConstructorIsSynthetic.kt")
|
||||||
|
public void testInlineClassWrapperPrimaryConstructorIsSynthetic() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/inlineClassWrapperPrimaryConstructorIsSynthetic.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inlineClassesUnboxingAfterAssertionOperator.kt")
|
@TestMetadata("inlineClassesUnboxingAfterAssertionOperator.kt")
|
||||||
public void testInlineClassesUnboxingAfterAssertionOperator() throws Exception {
|
public void testInlineClassesUnboxingAfterAssertionOperator() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/inlineClassesUnboxingAfterAssertionOperator.kt");
|
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/inlineClassesUnboxingAfterAssertionOperator.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user