On 5/27/20 12:24 AM, David Holmes wrote:
Hi Mandy,
On 27/05/2020 7:46 am, Mandy Chung wrote:
Lookup::defineHiddenClass currently throws IAE by ASM if the given
bytes are of unsupported class file version. The implementation
should catch and throw UnsupportedClassVersionError instead.
webrev:
http://cr.openjdk.java.net/~mchung/jdk15/webrevs/8245432/webrev.00/
What happened to the check:
if ((reader.getAccess() & Opcodes.ACC_MODULE) != 0) {
?
Thanks for catching. It was unintentionally taken out.
2036 if (msg.startsWith("Unsupported class file major version")) {
Is that too strict - what if the issue is with the minor version? In
general having to parse the ASM exception seems fragile.
I have revised this patch to check the version explicitly.
This patch also includes a spec clarification of @throws IAE if the
the bytes has ACC_MODULE flag set to fix JDK-8245596.
Until I saw what the code did the old versus new text did not seem
like a clarification. Might I suggest augmenting rather than replacing
the existing text:
@throws IllegalArgumentException if {@code bytes} is not a class or
interface (the ACC_MODULE flag is set in the value of the {@code
access_flags} item) or
This is good. I include this suggestion in the updated webrev.01 (see
my other reply);
Note:
1927 * in the value of the {@coode access_flags} item or
Typo: coode
Also should same change be made to defineHiddenClassWithClassData docs.
Yes, it should. Fixed.
thanks
Mandy