vaadin / hilla

Build better business applications, faster. No more juggling REST endpoints or deciphering GraphQL queries. Hilla seamlessly connects Spring Boot and React to accelerate application development.
https://hilla.dev
Apache License 2.0
879 stars 57 forks source link

Hilla tests fail when run with GraalVM #877

Open Artur- opened 1 year ago

Artur- commented 1 year ago

Description of the bug

If you run mvn install in the project with GraalVM 19 as your JDK, the build will fail at

org.opentest4j.AssertionFailedError: expected: <[@dev.hilla.parser.models.jackson.JacksonPropertySharedTests$MethodTypeAnnotation() java.lang.Byte, @dev.hilla.parser.models.jackson.JacksonPropertySharedTests$ParameterTypeAnnotation() java.lang.Byte, @dev.hilla.parser.models.jackson.JacksonPropertySharedTests$FieldTypeAnnotation() java.lang.Byte]> but was: <[@dev.hilla.parser.models.jackson.JacksonPropertySharedTests.MethodTypeAnnotation() java.lang.Byte, @dev.hilla.parser.models.jackson.JacksonPropertySharedTests.ParameterTypeAnnotation() java.lang.Byte, @dev.hilla.parser.models.jackson.JacksonPropertySharedTests.FieldTypeAnnotation() java.lang.Byte]>
    at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
    at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
    at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
    at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
    at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1141)
    at dev.hilla.parser.models.jackson.JacksonPropertyModelTests.should_HaveCorrectType(JacksonPropertyModelTests.java:52)

This does not matter at all to me BUT if it indicates that there will be some $ vs . mismatch issues when using GraalVM, then it could break native compiled applications.

Minimal reproducible example

mvn install

Expected behavior

Tests pass also with GraalVM

Versions:

- Vaadin / Hilla version: main
cromoteca commented 1 year ago

I have GraalVM 17 on Windows and that test passes. But it fails with OpenJDK 19 on Linux. So it's related to Java 19, not GraalVM.

cromoteca commented 1 year ago

It's a change in the JDK: now the toString for those annotations uses dots instead of dollars. I tried to debug AnnotatedTypeBaseImpl, but the toString is behind a proxy and IDEA didn't step inside. Anyway, by debugging sun.reflect.annotation.AnnotatedTypeFactory.AnnotatedTypeBaseImpl#annotationsToString using JDK 17 and 19 the difference is clear.

Artur- commented 1 year ago

So the problem is using toString?

cromoteca commented 1 year ago

Yes, results are compared to expected strings, which is fine for a test. I don't know how that can impact native.

Artur- commented 1 year ago

Probably does not if it is about Java 19