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. |
tajila
left a comment
There was a problem hiding this comment.
AFAIK, no one relies on being able to create arrays with more than 255 dimensions. I see no harm in adhering to RI behaviour
There was a problem hiding this comment.
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.
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.