-
Notifications
You must be signed in to change notification settings - Fork 73
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
JDK 17 support #489
JDK 17 support #489
Conversation
Signed-off-by: Amit Singh <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #489 +/- ##
============================================
- Coverage 78.14% 78.12% -0.02%
- Complexity 4156 4157 +1
============================================
Files 296 296
Lines 17652 17654 +2
Branches 1877 1877
============================================
- Hits 13794 13793 -1
- Misses 2961 2965 +4
+ Partials 897 896 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -62,6 +62,8 @@ tasks.withType(JavaCompile) { | |||
} | |||
tasks.withType(Test) { | |||
systemProperty "file.encoding", "UTF-8" | |||
jvmArgs("--add-opens", "java.base/java.time=ALL-UNNAMED") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add these two lines as mock will throw exception? Xun bumpted mockito
version to fix some mock issue in this PR opensearch-project/ml-commons#248. @Zhangxunmt you can add more details if that's the same issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Integ tests are passing .If the mocks had issue it won't right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the CI passed. I mean if don't add these two lines, the test will fail? Just provide another option if these two lines (line 65, 66) are to fix the mock issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Talked with @aksingh-es offline, will throw these errors if remove line 65,66
ModelManagerTests > getThresholdingResult_returnExpectedToListener FAILED
java.lang.reflect.InaccessibleObjectException: Unable to make private void java.time.Duration.readObject(java.io.ObjectInputStream) throws java.io.InvalidObjectException accessible: module java.base does not "opens java.time" to unnamed module @20fa23c1
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at org.powermock.reflect.internal.WhiteboxImpl.doGetAllMethods(WhiteboxImpl.java:1508)
at org.powermock.reflect.internal.WhiteboxImpl.getAllMethods(WhiteboxImpl.java:1482)
at org.powermock.reflect.internal.WhiteboxImpl.getMethods(WhiteboxImpl.java:1750)
at org.powermock.reflect.internal.WhiteboxImpl.getMethods(WhiteboxImpl.java:1789)
at org.powermock.reflect.internal.WhiteboxImpl.getBestMethodCandidate(WhiteboxImpl.java:1008)
at org.powermock.core.MockInvocation.findMethodToInvoke(MockInvocation.java:58)
at org.powermock.core.MockInvocation.init(MockInvocation.java:35)
at org.powermock.core.MockInvocation.<init>(MockInvocation.java:22)
at org.powermock.core.MockGateway.doMethodCall(MockGateway.java:155)
at org.powermock.core.MockGateway.methodCall(MockGateway.java:138)
at org.opensearch.ad.ml.ModelManagerTests.setup(ModelManagerTests.java:190)
ModelManagerTests > getPreviewResults_returnNoAnomalies_forNoAnomalies FAILED
java.lang.reflect.InaccessibleObjectException: Unable to make public void java.util.stream.ReferencePipeline$Head.forEach(java.util.function.Consumer) accessible: module java.base does not "opens java.util.stream" to unnamed module @20fa23c1
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at org.powermock.reflect.internal.WhiteboxImpl.doGetAllMethods(WhiteboxImpl.java:1508)
at org.powermock.reflect.internal.WhiteboxImpl.getAllMethods(WhiteboxImpl.java:1482)
at org.powermock.reflect.internal.WhiteboxImpl.getMethods(WhiteboxImpl.java:1750)
at org.powermock.reflect.internal.WhiteboxImpl.getMethods(WhiteboxImpl.java:1789)
at org.powermock.reflect.internal.WhiteboxImpl.getBestMethodCandidate(WhiteboxImpl.java:1008)
at org.powermock.core.MockInvocation.findMethodToInvoke(MockInvocation.java:58)
at org.powermock.core.MockInvocation.init(MockInvocation.java:35)
at org.powermock.core.MockInvocation.<init>(MockInvocation.java:22)
at org.powermock.core.MockGateway.doMethodCall(MockGateway.java:155)
at org.powermock.core.MockGateway.methodCall(MockGateway.java:138)
at org.opensearch.ad.ml.ModelManagerTests.getPreviewResults_returnNoAnomalies_forNoAnomalies(ModelManagerTests.java:856)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Support JDK 17 for AD
Added add-opens options for java.time and java.util.stream .It is no longer be possible to relax the strong encapsulation of internal elements
https://openjdk.java.net/jeps/403
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.