-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter out $EntriesMappings class for Kotlin's 1.9 feature 'Enum entries' #144
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
130470a
Filter out $EntriesMappings class for Kotlin's 1.9 feature 'Enum entr…
fzhinkin 4973d8c
Upgrade a Kotlin version and remove stdlib exclusion
fzhinkin 4fbfd42
Added test for EnumEntries filtration
fzhinkin b2757d4
Fixed test to use a enum class requiring EntriesMapping class
fzhinkin File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
version=0.13.2-SNAPSHOT | ||
group=org.jetbrains.kotlinx | ||
|
||
kotlinVersion=1.8.10 | ||
kotlinVersion=1.8.20 | ||
pluginPublishVersion=0.10.1 | ||
|
||
kotlin.stdlib.default.dependency=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* Copyright 2016-2023 JetBrains s.r.o. | ||
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file. | ||
*/ | ||
|
||
package cases.enums | ||
|
||
enum class EnumClass { A, B, C } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Copyright 2016-2023 JetBrains s.r.o. | ||
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file. | ||
*/ | ||
|
||
package cases.enums; | ||
|
||
public enum JavaEnum { | ||
JA, JB, JC | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package cases.enums | ||
|
||
@OptIn(ExperimentalStdlibApi::class) | ||
fun test() { | ||
EnumClass.entries.forEach { | ||
println(it) | ||
} | ||
|
||
JavaEnum.entries.forEach { | ||
println(it) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
public final class cases/enums/EntriesKt { | ||
public static final fun test ()V | ||
} | ||
|
||
public final class cases/enums/EnumClass : java/lang/Enum { | ||
public static final field A Lcases/enums/EnumClass; | ||
public static final field B Lcases/enums/EnumClass; | ||
public static final field C Lcases/enums/EnumClass; | ||
public static fun getEntries ()Lkotlin/enums/EnumEntries; | ||
public static fun valueOf (Ljava/lang/String;)Lcases/enums/EnumClass; | ||
public static fun values ()[Lcases/enums/EnumClass; | ||
} | ||
|
||
public final class cases/enums/JavaEnum : java/lang/Enum { | ||
public static final field JA Lcases/enums/JavaEnum; | ||
public static final field JB Lcases/enums/JavaEnum; | ||
public static final field JC Lcases/enums/JavaEnum; | ||
public static fun valueOf (Ljava/lang/String;)Lcases/enums/JavaEnum; | ||
public static fun values ()[Lcases/enums/JavaEnum; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are currently no tests that check this behaviour.
You'll need
when
over old Kotlin enum (unlikely it's easy to get one in the robust manner) or any Java one in the code to force$EntriesMapping
appearanceThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing to this! Seems like IDE cached something wrong, so when I validated the test without
ClassNode.isEnumEntriesMappings
EntriesMapping
was there despite the fact thatEnum
is a "new" enum.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries.
There is something suspicious happening:
EnumClass.entries
as available only since API version 1.8 (red code,[UNSUPPORTED_FEATURE]
) even though you clearly set it upentries.kt
), mappings start being generated even thoughentries
member is presentThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll proceed with the issue further