RFR: 8323058: Revisit j.l.classfile.CodeBuilder API surface
`java.lang.classfile.CodeBuilder` contains more than 230 API methods. Existing ClassFile API use cases proved the concept one big CodeBuilder is comfortable. However there are some redundancies, glitches in the naming conventions, some frequently used methods are hard to find and some methods have low practical use. This patch revisits the `CodeBuilder` API methods and introduces some changes. For more details, please, visit the [CSR ](https://bugs.openjdk.org/browse/JDK-8323067) Please review. Thank you, Adam ------------- Commit messages: - Merge branch 'master' into JDK-8323058-CodeBuilder - extended CodeBuilder::conversion functionality - removed CodeBuilder::newPrimitiveArray, newReferenceArray, newMultidimensionalArray and operator methods - fixed tests - fixed jdk/classfile tests - fixed benchmarks - fixed jdk.jfr and jdk.jlink - fixed java.base - 8323058: Revisit j.l.classfile.CodeBuilder API surface Changes: https://git.openjdk.org/jdk/pull/17282/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17282&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8323058 Stats: 876 lines in 43 files changed: 41 ins; 188 del; 647 mod Patch: https://git.openjdk.org/jdk/pull/17282.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17282/head:pull/17282 PR: https://git.openjdk.org/jdk/pull/17282
On Fri, 5 Jan 2024 15:17:13 GMT, Adam Sotona <asotona@openjdk.org> wrote:
`java.lang.classfile.CodeBuilder` contains more than 230 API methods. Existing ClassFile API use cases proved the concept one big CodeBuilder is comfortable. However there are some redundancies, glitches in the naming conventions, some frequently used methods are hard to find and some methods have low practical use.
This patch revisits the `CodeBuilder` API methods and introduces some changes.
For more details, please, visit the [CSR ](https://bugs.openjdk.org/browse/JDK-8323067)
Please review.
Thank you, Adam
JFR part (EventInstrumentation.java) looks good. ------------- PR Review: https://git.openjdk.org/jdk/pull/17282#pullrequestreview-1857688408
On Fri, 5 Jan 2024 15:17:13 GMT, Adam Sotona <asotona@openjdk.org> wrote:
`java.lang.classfile.CodeBuilder` contains more than 230 API methods. Existing ClassFile API use cases proved the concept one big CodeBuilder is comfortable. However there are some redundancies, glitches in the naming conventions, some frequently used methods are hard to find and some methods have low practical use.
This patch revisits the `CodeBuilder` API methods and introduces some changes.
For more details, please, visit the [CSR ](https://bugs.openjdk.org/browse/JDK-8323067)
Please review.
Thank you, Adam
Marked as reviewed by briangoetz (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/17282#pullrequestreview-1863257120
`java.lang.classfile.CodeBuilder` contains more than 230 API methods. Existing ClassFile API use cases proved the concept one big CodeBuilder is comfortable. However there are some redundancies, glitches in the naming conventions, some frequently used methods are hard to find and some methods have low practical use.
This patch revisits the `CodeBuilder` API methods and introduces some changes.
For more details, please, visit the [CSR ](https://bugs.openjdk.org/browse/JDK-8323067)
Please review.
Thank you, Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: removed CodeBuilder::newObject methods ------------- Changes: - all: https://git.openjdk.org/jdk/pull/17282/files - new: https://git.openjdk.org/jdk/pull/17282/files/d5491d36..150393c7 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=17282&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17282&range=00-01 Stats: 24 lines in 4 files changed: 0 ins; 19 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/17282.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17282/head:pull/17282 PR: https://git.openjdk.org/jdk/pull/17282
On Mon, 5 Feb 2024 18:31:44 GMT, Adam Sotona <asotona@openjdk.org> wrote:
`java.lang.classfile.CodeBuilder` contains more than 230 API methods. Existing ClassFile API use cases proved the concept one big CodeBuilder is comfortable. However there are some redundancies, glitches in the naming conventions, some frequently used methods are hard to find and some methods have low practical use.
This patch revisits the `CodeBuilder` API methods and introduces some changes.
For more details, please, visit the [CSR ](https://bugs.openjdk.org/browse/JDK-8323067)
Please review.
Thank you, Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
removed CodeBuilder::newObject methods
Marked as reviewed by psandoz (Reviewer). src/java.base/share/classes/java/lang/classfile/CodeBuilder.java line 507:
505: * @return this builder 506: */ 507: default CodeBuilder newObject(ClassEntry type) {
The two `newObject` methods seem to fit in the pattern of methods that are being removed, since they don't differentiate sufficiently with the `new_` methods that defer to them. ------------- PR Review: https://git.openjdk.org/jdk/pull/17282#pullrequestreview-1863531162 PR Review Comment: https://git.openjdk.org/jdk/pull/17282#discussion_r1478611886
On Mon, 5 Feb 2024 17:23:54 GMT, Paul Sandoz <psandoz@openjdk.org> wrote:
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
removed CodeBuilder::newObject methods
src/java.base/share/classes/java/lang/classfile/CodeBuilder.java line 507:
505: * @return this builder 506: */ 507: default CodeBuilder newObject(ClassEntry type) {
The two `newObject` methods seem to fit in the pattern of methods that are being removed, since they don't differentiate sufficiently with the `new_` methods that defer to them.
Right, we can remove also the `newObject` and keep `new_` methods, thanks. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/17282#discussion_r1478638191
`java.lang.classfile.CodeBuilder` contains more than 230 API methods. Existing ClassFile API use cases proved the concept one big CodeBuilder is comfortable. However there are some redundancies, glitches in the naming conventions, some frequently used methods are hard to find and some methods have low practical use.
This patch revisits the `CodeBuilder` API methods and introduces some changes.
For more details, please, visit the [CSR ](https://bugs.openjdk.org/browse/JDK-8323067)
Please review.
Thank you, Adam
Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 11 commits: - Merge branch 'master' into JDK-8323058-CodeBuilder - removed CodeBuilder::newObject methods - Merge branch 'master' into JDK-8323058-CodeBuilder # Conflicts: # src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java # src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java - extended CodeBuilder::conversion functionality - removed CodeBuilder::newPrimitiveArray, newReferenceArray, newMultidimensionalArray and operator methods - fixed tests - fixed jdk/classfile tests - fixed benchmarks - fixed jdk.jfr and jdk.jlink - fixed java.base - ... and 1 more: https://git.openjdk.org/jdk/compare/bee50cd3...5854a866 ------------- Changes: https://git.openjdk.org/jdk/pull/17282/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17282&range=02 Stats: 898 lines in 44 files changed: 41 ins; 207 del; 650 mod Patch: https://git.openjdk.org/jdk/pull/17282.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17282/head:pull/17282 PR: https://git.openjdk.org/jdk/pull/17282
`java.lang.classfile.CodeBuilder` contains more than 230 API methods. Existing ClassFile API use cases proved the concept one big CodeBuilder is comfortable. However there are some redundancies, glitches in the naming conventions, some frequently used methods are hard to find and some methods have low practical use.
This patch revisits the `CodeBuilder` API methods and introduces some changes.
For more details, please, visit the [CSR ](https://bugs.openjdk.org/browse/JDK-8323067)
Please review.
Thank you, Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: fixed ClassFile API use in new tests ------------- Changes: - all: https://git.openjdk.org/jdk/pull/17282/files - new: https://git.openjdk.org/jdk/pull/17282/files/5854a866..4479ccee Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=17282&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17282&range=02-03 Stats: 18 lines in 8 files changed: 0 ins; 0 del; 18 mod Patch: https://git.openjdk.org/jdk/pull/17282.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17282/head:pull/17282 PR: https://git.openjdk.org/jdk/pull/17282
On Wed, 6 Mar 2024 15:00:09 GMT, Adam Sotona <asotona@openjdk.org> wrote:
`java.lang.classfile.CodeBuilder` contains more than 230 API methods. Existing ClassFile API use cases proved the concept one big CodeBuilder is comfortable. However there are some redundancies, glitches in the naming conventions, some frequently used methods are hard to find and some methods have low practical use.
This patch revisits the `CodeBuilder` API methods and introduces some changes.
For more details, please, visit the [CSR ](https://bugs.openjdk.org/browse/JDK-8323067)
Please review.
Thank you, Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
fixed ClassFile API use in new tests
Looking at 8326836 #18030, we might need `@since` tags on the new API methods. ------------- PR Comment: https://git.openjdk.org/jdk/pull/17282#issuecomment-1981141337
On Wed, 6 Mar 2024 15:31:40 GMT, Chen Liang <liach@openjdk.org> wrote:
Looking at 8326836 #18030, we might need `@since` tags on the new API methods.
Thanks for pointing it out, I've added them. ------------- PR Comment: https://git.openjdk.org/jdk/pull/17282#issuecomment-1981230434
`java.lang.classfile.CodeBuilder` contains more than 230 API methods. Existing ClassFile API use cases proved the concept one big CodeBuilder is comfortable. However there are some redundancies, glitches in the naming conventions, some frequently used methods are hard to find and some methods have low practical use.
This patch revisits the `CodeBuilder` API methods and introduces some changes.
For more details, please, visit the [CSR ](https://bugs.openjdk.org/browse/JDK-8323067)
Please review.
Thank you, Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: added @since 23 tags for new CodeBuilder methods ------------- Changes: - all: https://git.openjdk.org/jdk/pull/17282/files - new: https://git.openjdk.org/jdk/pull/17282/files/4479ccee..ec9af60f Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=17282&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17282&range=03-04 Stats: 15 lines in 1 file changed: 15 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/17282.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17282/head:pull/17282 PR: https://git.openjdk.org/jdk/pull/17282
`java.lang.classfile.CodeBuilder` contains more than 230 API methods. Existing ClassFile API use cases proved the concept one big CodeBuilder is comfortable. However there are some redundancies, glitches in the naming conventions, some frequently used methods are hard to find and some methods have low practical use.
This patch revisits the `CodeBuilder` API methods and introduces some changes.
For more details, please, visit the [CSR ](https://bugs.openjdk.org/browse/JDK-8323067)
Please review.
Thank you, Adam
Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 14 commits: - Merge branch 'master' into JDK-8323058-CodeBuilder # Conflicts: # src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java # test/jdk/jdk/classfile/helpers/RebuildingTransformation.java - added @since 23 tags for new CodeBuilder methods - fixed ClassFile API use in new tests - Merge branch 'master' into JDK-8323058-CodeBuilder - removed CodeBuilder::newObject methods - Merge branch 'master' into JDK-8323058-CodeBuilder # Conflicts: # src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java # src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java - extended CodeBuilder::conversion functionality - removed CodeBuilder::newPrimitiveArray, newReferenceArray, newMultidimensionalArray and operator methods - fixed tests - fixed jdk/classfile tests - ... and 4 more: https://git.openjdk.org/jdk/compare/273df628...62d4f9f4 ------------- Changes: https://git.openjdk.org/jdk/pull/17282/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17282&range=05 Stats: 931 lines in 52 files changed: 56 ins; 207 del; 668 mod Patch: https://git.openjdk.org/jdk/pull/17282.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17282/head:pull/17282 PR: https://git.openjdk.org/jdk/pull/17282
`java.lang.classfile.CodeBuilder` contains more than 230 API methods. Existing ClassFile API use cases proved the concept one big CodeBuilder is comfortable. However there are some redundancies, glitches in the naming conventions, some frequently used methods are hard to find and some methods have low practical use.
This patch revisits the `CodeBuilder` API methods and introduces some changes.
For more details, please, visit the [CSR ](https://bugs.openjdk.org/browse/JDK-8323067)
Please review.
Thank you, Adam
Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 16 commits: - fixed StringConcatFactory - Merge branch 'master' into JDK-8323058-CodeBuilder - Merge branch 'master' into JDK-8323058-CodeBuilder # Conflicts: # src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java # test/jdk/jdk/classfile/helpers/RebuildingTransformation.java - added @since 23 tags for new CodeBuilder methods - fixed ClassFile API use in new tests - Merge branch 'master' into JDK-8323058-CodeBuilder - removed CodeBuilder::newObject methods - Merge branch 'master' into JDK-8323058-CodeBuilder # Conflicts: # src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java # src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java - extended CodeBuilder::conversion functionality - removed CodeBuilder::newPrimitiveArray, newReferenceArray, newMultidimensionalArray and operator methods - ... and 6 more: https://git.openjdk.org/jdk/compare/9108091f...4b901d90 ------------- Changes: https://git.openjdk.org/jdk/pull/17282/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17282&range=06 Stats: 933 lines in 53 files changed: 56 ins; 207 del; 670 mod Patch: https://git.openjdk.org/jdk/pull/17282.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17282/head:pull/17282 PR: https://git.openjdk.org/jdk/pull/17282
On Fri, 5 Jan 2024 15:17:13 GMT, Adam Sotona <asotona@openjdk.org> wrote:
`java.lang.classfile.CodeBuilder` contains more than 230 API methods. Existing ClassFile API use cases proved the concept one big CodeBuilder is comfortable. However there are some redundancies, glitches in the naming conventions, some frequently used methods are hard to find and some methods have low practical use.
This patch revisits the `CodeBuilder` API methods and introduces some changes.
For more details, please, visit the [CSR ](https://bugs.openjdk.org/browse/JDK-8323067)
Please review.
Thank you, Adam
This pull request has now been integrated. Changeset: ae82405f Author: Adam Sotona <asotona@openjdk.org> URL: https://git.openjdk.org/jdk/commit/ae82405ff7a48bc6e61b1d05bf74839b7ed50c11 Stats: 933 lines in 53 files changed: 56 ins; 207 del; 670 mod 8323058: Revisit j.l.classfile.CodeBuilder API surface Reviewed-by: briangoetz, psandoz ------------- PR: https://git.openjdk.org/jdk/pull/17282
participants (5)
-
Adam Sotona
-
Brian Goetz
-
Chen Liang
-
Erik Gahlin
-
Paul Sandoz