Open inithink opened 7 months ago
Are there any updates for this Issue?
Hi, one possible known cause is that Kotlin compiler requires specifying a flag for emitting annotations in JVM bytecode. Could you, please, try with the -Xemit-jvm-type-annotations
compiler flag? See also: https://kotlinlang.org/docs/whatsnew14.html#type-annotations-in-the-jvm-bytecode
Hilla 2.5.7 also encountered this problem
Hi, one possible known cause is that Kotlin compiler requires specifying a flag for emitting annotations in JVM bytecode. Could you, please, try with the
-Xemit-jvm-type-annotations
compiler flag? See also: https://kotlinlang.org/docs/whatsnew14.html#type-annotations-in-the-jvm-bytecode
Oh. It works!
I think it would be amazing if this was documented!
This is a successful pom.xml file.
...
<build>
...
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<configuration>
<args>
<arg>-Xjsr305=strict</arg>
<arg>-Xemit-jvm-type-annotations</arg>
</args>
<compilerPlugins>
<plugin>spring</plugin>
<plugin>jpa</plugin>
</compilerPlugins>
</configuration>
...
Hi, one possible known cause is that Kotlin compiler requires specifying a flag for emitting annotations in JVM bytecode. Could you, please, try with the compiler flag? See also: https://kotlinlang.org/docs/whatsnew14.html#type-annotations-in-the-jvm-bytecode`-Xemit-jvm-type-annotations`
Oh. It works!
I think it would be amazing if this was documented!
This is a successful pom.xml file.
... <build> ... <plugins> <plugin> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-maven-plugin</artifactId> <version>${kotlin.version}</version> <configuration> <args> <arg>-Xjsr305=strict</arg> <arg>-Xemit-jvm-type-annotations</arg> </args> <compilerPlugins> <plugin>spring</plugin> <plugin>jpa</plugin> </compilerPlugins> </configuration> ...
Successful!
This is an example of the 'build.gradle.kts' file available:
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
// Omit content
kotlin("jvm") version "2.0.0"
}
// Omit content
java {
sourceCompatibility = JavaVersion.VERSION_21
}
kotlin {
compilerOptions {
freeCompilerArgs.add("-Xjsr305=strict")
freeCompilerArgs.add("-Xemit-jvm-type-annotations")
jvmTarget = JvmTarget.JVM_21
}
}
// Omit content
Maybe we can modify the Gradle plugin to add this compilation option by default.
@inithink: You can just do this:
data class KotlinClass(@field:Email @field:NotNull var email: String)
Describe the bug
When I use Kotlin class for endpoint, validation does not work.
Expected-behavior
show errors in form
Reproduction
Repository
https://github.com/inithink/hilla-crm-tutorial.git
Kotlin
KotlinClass.kt
KotlinClassForm.tsx
Java
JavaClass.java
JavaForm.tsx
System Info
macOS 14.4.1(23E224), M1 Pro hilla version: 2.5.6 browser: chrome 123.0.6312.124