-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
CRD generation fails when compiled using java version 19 and above #5866
Comments
With a recent version of the maven-compiler-plugin and proper configuration it works (at least on my machine): |
Your fix does no longer work when your change to java version 8 is edited back to 19. But 18 works, just like matteriben described. I'm getting the same problem with 21, plus some added information for the stack overflow cause:
|
Just to let you know, I'm looking into this, I'm able to replicate with Java 19+ (using 21 ATM) and is likely a bug. |
As mentioned I started looking at the issue, and can be easily replicated, this is my testing branch: Ideally, to completely close this we should:
The underlying issue, as far as I understand it:
I'm not 100% what would be the correct solution in this case; even if we get One possible solution would be to have a short list of "default SchemaSwap" that will not throw if not matched. |
Quick update, I'm slowly progressing on getting the CI to run on Java 17 and 21 in #5874 . |
Sorry for the delay in feedback. Here's my observations:
It's highly unlikely that you directly want the full serialization of ZonedDateTime as detected by the crd generator. Our builtin kubernetes serialization logic will produce a number like 1712771904.746000000 for a ZonedDateTime, so the above just maps it to Double. Adding a default set of SchemaSwaps that includes ZonedDateTime is possible, we probably need a way to make that extensible. Alternatively we'd have to to detect what handling default jackson / KubernetesSerialization does - and assume that it must be what is desired for the crd / runtime. The difference here vs when we've looked at doing that in the past is that this is a built-in class, so we can work with the actual java Class at this time. Of course there are Jackson annotations or ObjectMapper settings that can tweak the output for ZonedDateTime and other temporal classes in a way that this logic would not be aware of. The logic would look roughly like - try to do a Class.forName on the type, if it can be loaded, then use the jackson jsonSchema logic to get the schema and use that instead of our logic - this could easily be restricted to just java / javax classes. |
closes fabric8io#5866 Signed-off-by: Steve Hawkins <shawkins@redhat.com>
closes fabric8io#5866 Signed-off-by: Steve Hawkins <shawkins@redhat.com>
closes fabric8io#5866 Signed-off-by: Steve Hawkins <shawkins@redhat.com>
closes fabric8io#5866 Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Describe the bug
CRD generation fails when compiled using java version 19 and above.
Fabric8 Kubernetes Client version
SNAPSHOT
Steps to reproduce
There is an example project here, CRD generation succeeds when built with java version 18 and fails when built with java version 19.
https://github.com/matteriben/crd-generator-date-time-reproducer/actions/runs/8583665846
job-logs.txt
Expected behavior
CRD generation is expected to succeed when project is built with java version 19 and above.
Runtime
other (please specify in additional context)
Kubernetes API Server version
1.25.3@latest
Environment
Linux
Fabric8 Kubernetes Client Logs
No response
Additional context
This seems to be related to a change in the implementation of java.time.ZonedDateTime from version 18 to 19 and above.
The text was updated successfully, but these errors were encountered: