Skip to content
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

Streamline default value management for KotlinFeatures. #685

Merged
merged 2 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Contributors:
# 2.16.0 (not yet released)

WrongWrong (@k163377)
* #685: Streamline default value management for KotlinFeatures
* #684: Update Kotlin Version to 1.6
* #682: Remove MissingKotlinParameterException and replace with MismatchedInputException

Expand Down
2 changes: 2 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Co-maintainers:

2.16.0 (not yet released)

#685: Streamline default value management for KotlinFeatures.
This improves the initialization cost of kotlin-module a little.
#684: Kotlin 1.5 has been deprecated and the minimum supported Kotlin version will be updated to 1.6.
#682: Remove MissingKotlinParameterException and replace with MismatchedInputException
This change removes MissingKotlinParameterException and resolves #617.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ enum class KotlinFeature(private val enabledByDefault: Boolean) {
*/
StrictNullChecks(enabledByDefault = false);

internal val bitSet: BitSet = 2.0.pow(ordinal).toInt().toBitSet()
internal val bitSet: BitSet = (1 shl ordinal).toBitSet()

companion object {
internal val defaults
get() = 0.toBitSet().apply {
values().filter { it.enabledByDefault }.forEach { or(it.bitSet) }
get() = values().fold(BitSet(Int.SIZE_BITS)) { acc, cur ->
acc.apply { if (cur.enabledByDefault) this.or(cur.bitSet) }
}
}
}