RFR: 8335939: Hide element writing across the ClassFile API [v2]
Chen Liang
liach at openjdk.org
Thu Jul 18 22:56:10 UTC 2024
> `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
Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains ten additional commits since the last revision:
- Merge branch 'master' of https://github.com/openjdk/jdk into fix/cf-apis
- Merge BoundAttributeTest
- Merge branch 'master' of https://github.com/openjdk/jdk into fix/cf-apis
- Merge branch 'master' of https://github.com/openjdk/jdk into fix/cf-apis
- 2 test failures
- Web review cleanup
- Remove WritableElement and reduce Writable usage
The rest of Writable in annotations can be removed in later cleanup
- Fix up usages of Util.write
- Hide writeTo from all class file elements
To consider the fate of WritableElement later!
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/20205/files
- new: https://git.openjdk.org/jdk/pull/20205/files/78830195..bbd6c73c
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=20205&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=20205&range=00-01
Stats: 2383 lines in 117 files changed: 1586 ins; 335 del; 462 mod
Patch: https://git.openjdk.org/jdk/pull/20205.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/20205/head:pull/20205
PR: https://git.openjdk.org/jdk/pull/20205
More information about the compiler-dev
mailing list