RFR: 8320396: Class-File API ClassModel::verify should include checks from hotspot/share/classfile/classFileParser.cpp [v5]

Adam Sotona asotona at openjdk.org
Tue May 14 09:18:03 UTC 2024


On Tue, 14 May 2024 08:51:57 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

>> Adam Sotona has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - fixed error thrown by VerifierImpl
>>  - applied suggested changes
>
> src/java.base/share/classes/jdk/internal/classfile/impl/verifier/ParserVerifier.java line 251:
> 
>> 249:                 for (var ici : ica.classes()) {
>> 250:                     if (ici.outerClass().isPresent() && ici.outerClass().get().equals(ici.innerClass())) {
>> 251:                         errors.add(new VerifyError("Class is both outer and inner class in %s".formatted(toString(ae))));
> 
> nit: in `classFileParser` the string includes "class file" after "in". I was just wondering if "class file" is generated by `toString`. I see only `default -> "class " + className();` in the implementation of `toString`. Ignore if the actual message is not important.

The `AttributedElement` argument only adds specific info about the enclosing element, so for the class-level attribute errors it falls to the default. Your can se examples of this formatting  in the test:
https://github.com/openjdk/jdk/blob/586fa4b3241a0fc9a2aeddc41d79a74f2259ae52/test/jdk/jdk/classfile/VerifierSelfTest.java#L177

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16809#discussion_r1599676802


More information about the compiler-dev mailing list