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

Quarkus instrument live-reload doesn't work when using Kotlin 1.8+ #42302

Closed
lujun2 opened this issue Aug 3, 2024 · 4 comments · Fixed by #42363
Closed

Quarkus instrument live-reload doesn't work when using Kotlin 1.8+ #42302

lujun2 opened this issue Aug 3, 2024 · 4 comments · Fixed by #42363
Labels
area/kotlin kind/bug Something isn't working triage/needs-feedback We are waiting for feedback.
Milestone

Comments

@lujun2
Copy link
Contributor

lujun2 commented Aug 3, 2024

Describe the bug

Kotlin 1.8+ introduce @SourceDebugExtension

This annotation is used to embed Kotlin bytecode or something like.
Every single byte of Kotlin source code change will generate different @SourceDebugExtension

When enable quarkus.live-reload.instrumentation, it will check the class structure is same or not before reload.
This check always fail and fallback to application restart.

image

Expected behavior

When quarkus.live-reload.instrumentation enabled only affected classes be replaced when Kotlin source code changes

Should provide a mechanism to exclude unrelated annotation value comparison in dev mode.

Actual behavior

Kotlin source code change trigger application restart

How to Reproduce?

No response

Output of uname -a or ver

Darwin Juns-MBP.local 24.0.0 Darwin Kernel Version 24.0.0: Sat Jul 13 00:58:03 PDT 2024; root:xnu-11215.0.165.0.4~50/RELEASE_X86_64 x86_64

Output of java -version

java version "21.0.2" 2024-01-16 LTS

Quarkus version or git rev

3.13.0

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 8.9

Additional information

Kotlin version: 2.0.20-RC

@lujun2 lujun2 added the kind/bug Something isn't working label Aug 3, 2024
Copy link

quarkus-bot bot commented Aug 3, 2024

/cc @geoand (kotlin)

@geoand
Copy link
Contributor

geoand commented Aug 5, 2024

Thanks a lot for debugging this!

Since you have figured out what the problem is, would you like to propose a Pull Request that addresses the issue?

@geoand geoand added the triage/needs-feedback We are waiting for feedback. label Aug 5, 2024
@lujun2
Copy link
Contributor Author

lujun2 commented Aug 6, 2024

I'd like to, but need some suggestion

Solution 1

disable @SourceDebugExtension via Kotlin compiler option -Xno-source-debug-extension in KotlinCompilationProvider
Kotlin compiler arguments defined in Maven/Gradle settings also need to be configured

because the initial compiled class is usually generated by Maven/Gradle plugin, and the live reload is another process, they don't share the same configuration

I don't think this is a good solution, since it need extra documentation and may have some side effect

Solution 2

another solution is to modify ClassComparisonUtil, ignore unrelated annotation values during live reload

@geoand any suggestion

@geoand
Copy link
Contributor

geoand commented Aug 6, 2024

I would modify ClassComparisonUtil to specifically ignore @SourceDebugExtension - we could have some list of annotations that are ignored which for now would contain only @SourceDebugExtension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kotlin kind/bug Something isn't working triage/needs-feedback We are waiting for feedback.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants