RFR: 8309838: Classfile API Util.toBinaryName and other cleanup

ExE Boss duke at openjdk.org
Mon Jun 12 10:47:50 UTC 2023


On Mon, 12 Jun 2023 09:45:18 GMT, Chen Liang <liach at openjdk.org> wrote:

> Thanks to @exe-boss for the reviews in #13082. This cleanup patch fixed the typos you pointed out and removed other redundancies in classfile Util as well.

src/java.base/share/classes/jdk/internal/classfile/impl/Util.java line 90:

> 88:     public static String toBinaryName(ClassDesc cd) {
> 89:         return toInternalName(cd).replace('/', '.');
> 90:     }

Note that this method is called with array class descriptors as well, so the correct implementation would be:
Suggestion:

    public static String toBinaryName(ClassDesc cd) {
        return (cd.isArray() ? cd.descriptorString() : toInternalName(cd))
            .replace('/', '.');
    }

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14412#discussion_r1226461591


More information about the core-libs-dev mailing list