Skip to content
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

Merged
merged 2 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
Build-ad:
strategy:
matrix:
java: [11]
java: [11,17]
fail-fast: false

name: Build and Test Anomaly detection Plugin
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ tasks.withType(JavaCompile) {
}
tasks.withType(Test) {
systemProperty "file.encoding", "UTF-8"
jvmArgs("--add-opens", "java.base/java.time=ALL-UNNAMED")
Copy link
Collaborator

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.

Copy link
Contributor Author

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 ?

Copy link
Collaborator

@ylwu-amzn ylwu-amzn Apr 5, 2022

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.

Copy link
Collaborator

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)

jvmArgs("--add-opens", "java.base/java.util.stream=ALL-UNNAMED")
}
tasks.withType(Javadoc) {
options.encoding = 'UTF-8'
Expand Down