Currently execution of
mvn \
-Dkotlin.version=2.0.0-Beta2 \
-Dbytecode.version=8 \
clean package
leads to
Failed tests:
KotlinWhenExpressionTest>ValidationTestBase.all_missed_instructions_should_have_line_number:142 sum of missed instructions of all lines should be equal to missed instructions of file expected:<4> but was:<3>
which is because for
Kotlin 2.0.0-Beta2 compiler produces
public static kotlin.enums.EnumEntries<Example> getEntries();
descriptor: ()Lkotlin/enums/EnumEntries;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=1, locals=0, args_size=0
0: getstatic #43 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
3: areturn
LineNumberTable:
line 1: 3
Signature: #38 // ()Lkotlin/enums/EnumEntries<LExample;>;
RuntimeInvisibleAnnotations:
0: #39()
org.jetbrains.annotations.NotNull
whereas Kotlin 1.9.22 compiler produces
public static kotlin.enums.EnumEntries<Example> getEntries();
descriptor: ()Lkotlin/enums/EnumEntries;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=1, locals=0, args_size=0
0: getstatic #43 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
3: areturn
Signature: #38 // ()Lkotlin/enums/EnumEntries<LExample;>;
RuntimeInvisibleAnnotations:
0: #39()
org.jetbrains.annotations.NotNull
Bisection of changes in Kotlin compiler pointed me to JetBrains/kotlin@5fb3800 which merely changes the language version, so either I made a mistake during bisection, or bytecode generation depends on the language version. I suspect the second because execution of Kotlin 1.9.22 compiler with option -language-version 2.0 produces the same result as the execution of Kotlin 2.0.0-Beta2 compiler.
@qwwdfsad could you please have a look and advise whether this change is intentional and we need to filter out getEntries methods in enums similarly to filtering valueOf and values methods, or this is an unintentionally overlooked change in the compiler?
Currently execution of
leads to
which is because for
Kotlin
2.0.0-Beta2compiler produceswhereas Kotlin
1.9.22compiler producesBisection of changes in Kotlin compiler pointed me to JetBrains/kotlin@5fb3800 which merely changes the language version, so either I made a mistake during bisection, or bytecode generation depends on the language version. I suspect the second because execution of Kotlin
1.9.22compiler with option-language-version 2.0produces the same result as the execution of Kotlin2.0.0-Beta2compiler.@qwwdfsad could you please have a look and advise whether this change is intentional and we need to filter out
getEntriesmethods in enums similarly to filteringvalueOfandvaluesmethods, or this is an unintentionally overlooked change in the compiler?