Skip to content

Update KotlinLateinitFilter for Kotlin 1.5 #1166

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

Merged
merged 3 commits into from
Mar 21, 2021
Merged

Conversation

Godin
Copy link
Member

@Godin Godin commented Mar 20, 2021

Currently execution of

mvn clean package -Dkotlin.version=1.5.0-M1

leads to

Failed tests:
  execute_assertions_in_comments(org.jacoco.core.test.validation.kotlin.KotlinLateinitTest): Instructions (KotlinLateinitTarget.kt:26) expected:<[FUL]LY_COVERED> but was:<[PART]LY_COVERED>

What seems to be related to the following change in Kotlin compiler - JetBrains/kotlin@7c95781

@Godin Godin force-pushed the KotlinLateinitFilter branch from c0d283b to 70a3e5b Compare March 20, 2021 16:11
@Godin Godin marked this pull request as ready for review March 21, 2021 13:33
@Godin Godin requested a review from marchof March 21, 2021 13:33
@marchof
Copy link
Member

marchof commented Mar 21, 2021

m.visitInsn(Opcodes.ACONST_NULL);
m.visitInsn(Opcodes.ATHROW);

Oh shit, I hope for Kotlin the JVM will never tighten its verifier 😱

@marchof marchof merged commit 5bbe202 into master Mar 21, 2021
@marchof marchof deleted the KotlinLateinitFilter branch March 21, 2021 19:34
@Godin
Copy link
Member Author

Godin commented Mar 22, 2021

@marchof what do you mean? according to https://docs.oracle.com/javase/specs/jvms/se16/html/jvms-6.html#jvms-6.5.athrow

If objectref is null, athrow throws a NullPointerException instead of objectref.

@marchof
Copy link
Member

marchof commented Mar 22, 2021

Sure... I mean something like SonarQube for bytecode 😅

ACONST_NULL
ATHROW
^ Warning: This will always result in a NPE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants