RFR: 8321248: ClassFile API ClassModel::verify is inconsistent with the rest of the API

Adam Sotona asotona at openjdk.org
Wed Dec 6 09:45:36 UTC 2023


On Wed, 6 Dec 2023 09:26:29 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> ClassFile API `ClassModel::verify` accepts `ClassHierarchyResolver` as an optional argument and does not respect `ClassFile.ClassHierarchyResolverOption` of the actual context.
>> Parsing, building and transforming take options from the actual `ClassFile` context and verification should follow the same API pattern.
>> 
>> This patch removes `ClassModel::verify` methods and introduces new top level methods:
>> 
>> List<VerifyError> ClassFile::verify(ClassModel model);
>> List<VerifyError> ClassFile::verify(byte[] bytes);
>> List<VerifyError> ClassFile::verify(Path path);
>> 
>> 
>> Impact of the API change is minimal as the API has not been released yet.
>> 
>> Please review.
>> 
>> Thanks,
>> Adam
>
> test/jdk/jdk/classfile/VerifierSelfTest.java line 62:
> 
>> 60: 
>> 61:     @Test
>> 62:     void testFailedDump() throws IOException {
> 
> Why is this removed?

Dump (print) of the classfile to an optional log (Consumer<String> argument) has been removed from the API.
It was a relic from early phase of the ClassFile API development and it has no use except for this test.
This functionality can be replaced by explicit use of ClassPrinter.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16947#discussion_r1417008753


More information about the core-libs-dev mailing list