-
Notifications
You must be signed in to change notification settings - Fork 706
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
Class.arrayType() throws UnsupportedOperationException in jdk19+ #15298
Conversation
jenkins compile amac jdknext |
Resolved via eclipse-openj9/openj9#15298 Signed-off-by: Peter Shipton <Peter_Shipton@ca.ibm.com>
bf52296
to
2f4c09f
Compare
jenkins compile amac jdknext |
jenkins compile amac jdknext |
jenkins compile amac jdknext |
Tested in grinders, which passed. |
@tajila what do you think about this condition added to Class.arrayType(), to throw UnsupportedOperationException "if the number of dimensions of the resulting array type would exceed 255". This is a limitation that OpenJ9 doesn't have. The java/lang/Class/ArrayType.java test checks for this. I added a check so the test can pass, but we could also ignore it (exclude or modify the test) or challenge it. |
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.
AFAIK, no one relies on being able to create arrays with more than 255 dimensions. I see no harm in adhering to RI behaviour
throw new IllegalArgumentException(); | ||
/*[IF JAVA_SPEC_VERSION >= 19]*/ | ||
try { | ||
int arrayCount = 0; |
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.
perhaps something like this may be clearer
Class<?> baseType = this;
for (int arrayCount = 0; baseType.isArray(); arrayCount++) {
if (arrayCount == 255) {
throw new IllegalArgumentException();
}
baseType = baseType.getComponentType();
}
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.
For some reason I missed this comment.
Made this change and retested, which failed. It works when I changed the check to 254. Or I suppose I could start the count from 1 and check for 255 if you prefer.
jenkins compile amac jdk19 |
Issue eclipse-openj9#14598 Signed-off-by: Peter Shipton <Peter_Shipton@ca.ibm.com>
jenkins compile amac jdk19 |
Rerun |
@tajila when you get a chance to review. |
Resolved via eclipse-openj9/openj9#15298 Signed-off-by: Peter Shipton <Peter_Shipton@ca.ibm.com>
Issue #14598
Continuing to throw IllegalArgumentException as the cause for the UnsupportedOperationException is done for compatibility.