RFR: 8365878: jshell TOOLING's javap should use binary names

altrisi duke at openjdk.org
Thu Aug 21 15:19:33 UTC 2025


On Wed, 20 Aug 2025 15:37:09 GMT, altrisi <duke at openjdk.org> wrote:

> This PR makes TOOLING.jsh's `javap` function support anonymous, local and built-in nested classes.
> 
> Note that nested classes created in jshell would previously work, but not JDK ones as they'd miss the is built-in check (wrong name for `Class.forName`) and later throw an exception because of a null classloader.
> 
> The rest of classes would fail the canonical name check, which wouldn't allow them to be disassembled.
> 
> This change makes them work by changing the check from canonicalName != null to specific checks for unsupported types of classes, and doing Class.forName using the result of getName(), not the canonical name, for the built-in check.

> Created [bugs.openjdk.org/browse/JDK-8365878](https://bugs.openjdk.org/browse/JDK-8365878) for you.

Thanks! I had actually opened a bug via webbug and was waiting on it, not sure how to handle now having two. I'll use yours for now.

Also about the issue name, I think it's fair for an utility like this to start with a broad check like "has canonical name" to check if supported, even though it caused the issue of nested built-in classes failing to use the proper path. It only used the canonical for that anyway, when retrieving the class file it'd use the binary name. I'd say the most important part of this patch is support for more types of classes.

But I'm fine with that one too if you think it's better.

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

PR Comment: https://git.openjdk.org/jdk/pull/26864#issuecomment-3211058592


More information about the compiler-dev mailing list