Open olivierbeltrandocintoo opened 10 months ago
/cc @evanchooly (kotlin), @geoand (jackson,kotlin), @gsmet (jackson)
And from my personal computer I can reproduce the bug on linux (Ubuntu 22.04)
This would require a deep dive into what the Kotlin compiler produces
really not sure how it works :/ I am assuming that a first step would be to figure out, what is the input of the Kotlin compiler. With that if we can reproduce the bug outside of Quarkus we probably can dispatch the issue to the Kotlin board if the bug is on their side. I unfortunately have no idea on how to do any of that :( (and I assume (maybe wrongly) that it would not imply diving in the Kotlin compiler (I hope))
Intellij can show you what the kotlin compiler produces in a human readable form.
I am well aware, thanks :)
@mschorsch reproducing the issue (ie. commenting the println) -> from the generated code perspective the only change is This does not look strange
@olivierbeltrandocintoo @geoand In my opinion this is a bug in the quarkus-maven-plugin
because it seems that the kotlin compiler options did not get passed correctly to the plugin.
You can add the following snippet to your quarkus-maven-plugin
configuration to work around the problem (https://quarkus.io/guides/kotlin#configuring-live-reload-compiler):
<configuration>
<compilerOptions>
<compiler>
<name>kotlin</name>
<args>
<arg>-jvm-target=17</arg>
</args>
</compiler>
</compilerOptions>
</configuration>
Full example:
<plugin>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.platform.version}</version>
<extensions>true</extensions>
<configuration>
<compilerOptions>
<compiler>
<name>kotlin</name>
<args>
<arg>-jvm-target=17</arg>
</args>
</compiler>
</compilerOptions>
</configuration>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>generate-code</goal>
<goal>generate-code-tests</goal>
</goals>
</execution>
</executions>
</plugin>
testing immediately :)
@mschorsch wow ! The provided workaround works well ! Thanks a lot :) Also I am a bit ashamed that I haven't read that section from the documentation 😅 although I have tried other things.
@mschorsch very good catch!
Describe the bug
Hello,
It seems that changing code using Quarkus + Kotlin + Jackson breaks compilation in quarkus live reload.
I have created a repo with a README.md containing the 4 the steps to reproduce
https://github.com/olivierbeltrandocintoo/quarkus-kotlin-bug-reload
This repo is
quarkus create app org.acme:rest-kotlin-quickstart2 --extension='kotlin,resteasy-reactive-jackson'
commandsrc/main/kotlin/org/acme/JsonModule.kt
that contains aninline reified
method (fromJson
) using jacksonsrc/main/kotlin/org/acme/GreetingResource.kt
that is altered to use the methodfromJson
Expected behavior
Editing code should not break the live reload compilation
Actual behavior
The live reload shows the following stack trace
Reason: Cannot inline bytecode built with JVM target 17 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
Full stack trace below.
I don't know why it is obsessed with JVM 1.8 as no properties in the project use JVM 1.8.
Please note that changing the dependency from
(which is embedded in default kotlin project generated by quarkus) to
makes no difference
How to Reproduce?
Go there: https://github.com/olivierbeltrandocintoo/quarkus-kotlin-bug-reload and git clone it
mvn clean quarkus:dev
http://localhost:8080/user
with your browser, it should work :blush:println
) in theGreetingResource.kt
http://localhost:8080/user
again with your browser, it should crash :confused:JsonModule.kt
with something harmless (like adding a new line), it should work again :open_mouth:Output of
uname -a
orver
Linux PARIS 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk 17 2021-09-14
Quarkus version or git rev
3.5.2
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.3
Additional information
No response