On Fri, 15 Dec 2023 12:27:16 GMT, ExE Boss <d...@openjdk.org> wrote: >> Adam Sotona has updated the pull request incrementally with one additional >> commit since the last revision: >> >> added missing comment > > src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java > line 548: > >> 546: static ClassDesc classDesc(Class<?> cls) { >> 547: return cls.isHidden() ? >> ClassDesc.ofInternalName(cls.getName().replace('.', '/')) >> 548: : >> ClassDesc.ofDescriptor(cls.descriptorString()); > > This still isn’t correct, as [`Class::getName()`] includes the trailing > `/<suffix>` for a hidden class. > Suggestion: > > if (cls.isHidden()) { > var name = cls.getName(); > return ClassDesc.of(name.substring(0, name.indexOf('/')); > } > return ClassDesc.ofDescriptor(cls.descriptorString()); > > > [`Class::getName()`]: > https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Class.html#getName()
This is fix of `runtime/cds/appcds/dynamicArchive/LambdaProxyCallerIsHidden.java` test. It is based on the original code way of getting the class name. Cutting of the class name behind the first slash will remove important suffix. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/17108#discussion_r1427953577