On Thu, 9 May 2024 10:11:22 GMT, Adam Sotona <asot...@openjdk.org> wrote:

>> ClassFile API `jdk.internal.classfile.verifier.VerifierImpl` performed only 
>> bytecode-level class verification.
>> This patch adds `jdk.internal.classfile.verifier.ParserVerifier` with 
>> additional class checks inspired by 
>> `hotspot/share/classfile/classFileParser.cpp`.
>> 
>> Also new `VerifierSelfTest::testParserVerifier` has been added.
>> 
>> Please review.
>> 
>> Thanks,
>> Adam
>
> 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.

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

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

Reply via email to