eclipse / microprofile-health

microprofile-health
Apache License 2.0
106 stars 61 forks source link

TCK HealthCheckResponseValidationTest fails with jdk17+ #324

Open simonladen opened 9 months ago

simonladen commented 9 months ago

Running the TCK with jdk17 (or higher), the test HealthCheckResponseValidationTest fails:

[ERROR] org.eclipse.microprofile.health.tck.HealthCheckResponseValidationTest.testValidateConcreteHealthCheckResponse  Time elapsed: 0.059 s  <<< FAILURE!
com.fasterxml.jackson.databind.exc.InvalidDefinitionException:
Cannot construct instance of `java.util.Optional` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
 at [Source: (String)"{"name":"successful-check","status":"UP","data":{}}"; line: 1, column: 50] (through reference chain: org.eclipse.microprofile.health.HealthCheckResponse["data"])
        at org.eclipse.microprofile.health.tck.HealthCheckResponseValidationTest.testValidateConcreteHealthCheckResponse(HealthCheckResponseValidationTest.java:71)

When running the same test with jdk11 (or anything lower than 16), the test throws this warning:

INFO: Running test: HealthCheckResponseValidationTest#testValidateConcreteHealthCheckResponse
[ERROR] WARNING: An illegal reflective access operation has occurred
[ERROR] WARNING: Illegal reflective access by com.fasterxml.jackson.databind.util.ClassUtil (file:/C:/Users/SimonLaden/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.15.0/jackson-databind-2.15.0.jar) to constructor java.util.Optional()
{"status":"UP","checks":[{"name":"successful-check","status":"UP","data":{}}]}
[ERROR] WARNING: Please consider reporting this to the maintainers of com.fasterxml.jackson.databind.util.ClassUtil
[ERROR] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
[ERROR] WARNING: All illegal access operations will be denied in a future release

This illegal reflective access operation is not allowed in more recent jdk, causing the error mentioned above.