On Fri, 3 Feb 2023 17:43:22 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> Adam Sotona has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Classfile API moved under jdk.internal.classfile package > > src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 58: > >> 56: * Main entry points for parsing, transforming, and generating >> classfiles. >> 57: */ >> 58: public class Classfile { > > class or interface? (bikeshed, I realize) yes, a bikeshed > src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 197: > >> 195: * @return the classfile bytes >> 196: */ >> 197: public static byte[] build(ClassDesc thisClass, > > The "build" methods here seem regular - e.g. build { class, module } x { byte > array, path }. As a future improvement, perhaps capturing the "sink" of a > build process might be helpful - so that you can avoid overloads between > array and path variants. (e.g. `build(.... toByteArray(arr))`, or > `build(...).toByteArray(...)`. Classfile::build always return byte array and there is no "sink" model inside. Classfile::buildTo is frequently used extension; a wrapper calling build and writing the byte array using Files::write. ------------- PR: https://git.openjdk.org/jdk/pull/10982