Integrated: 8335939: Hide element writing across the ClassFile API

Chen Liang liach at openjdk.org
Tue Jul 23 12:14:36 UTC 2024


On Tue, 16 Jul 2024 23:50:17 GMT, Chen Liang <liach at openjdk.org> wrote:

> `WritableElement` has always been one of the biggest peculiarities of ClassFile API: it exposes element writing yet has no corresponding reading ability exposed. Its existence creates a lot of API noise, increasing maintenance cost in the long run. (This is an iceberg whose tip was exposed in #14705)
> 
> Removal details:
> - `LocalVariable/LocalVariableType.writeTo`
> - `WritableElement`
> - In `BufWriter`:
>   - `writeList(List<WritableElement>)`
>   - `writeListIndices`: Hidden as we are not exposing `BoundAttribute.readEntryList`
>   - `writeBytes(BufWriter other)`
> - `ClassReader.compare`: Avoid reading from `BufWriter`
> 
> Future implementation cleanup out of scope of this patch:
> - Annotation writing can be upgraded and move away from `Util.Writable`
> - The writing of CP indices and attributes can move to their dedicated methods
> - reading of entry list can pair up with writing of entry list in ClassReader/BufWriter in future addition

This pull request has now been integrated.

Changeset: a2a236f9
Author:    Chen Liang <liach at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/a2a236f9041083e4b8f11e068da0031dd5f52c2b
Stats:     461 lines in 50 files changed: 101 ins; 198 del; 162 mod

8335939: Hide element writing across the ClassFile API

Reviewed-by: asotona

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

PR: https://git.openjdk.org/jdk/pull/20205


More information about the compiler-dev mailing list