Repository navigation
Remove the reflection warning in LocalDateTime -> offset-date-time - #213
Merged
Merged
Conversation
tick.core printed one reflection warning on the JVM: Reflection warning, tick/core.cljc:230:29 - call to method getOffset can't be resolved (target class is unknown). cljc.java-time.zone-id/get-rules has no return tag, so the compiler cannot resolve the .getOffset call. A ZoneRules hint on that form resolves it. A new test, tick.reflection-test, reloads tick.core with *warn-on-reflection* bound to true and asserts that no reflection warning is printed.
Collaborator
|
very clear PR. thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Compiling
tick.coreon the JVM with*warn-on-reflection*set prints one warning:The call is in the
offset-date-timeconversion forLocalDateTime.cljc.java-time.zone-id/get-ruleshas no return tag, so the compiler cannot findZoneRules.getOffsetand emits a reflective call.Why it matters: a GraalVM native image cannot make a reflective call unless the class is registered in reflection config. Programs that build a native image usually treat every reflection warning as a build failure, so this one warning in tick blocks them, even when they never call this function.
The fix: one
^java.time.zone.ZoneRulestype hint on theget-rulesform. The ClojureScript branch does not change.The test:
test/tick/reflection_test.cljreloadstick.corewith*warn-on-reflection*bound to true and asserts that no reflection warning is printed. It fails without the hint and passes with it.Results on this branch:
./bin/kaocha :cljgives68 tests, 724 assertions, 0 failures.andmake test-cljs-shadowgives60 tests, 695 assertions, 0 failures.The branch starts at the
1.0.1tag.src/has no other change between1.0.1andmaster, so it merges cleanly.