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

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


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.

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

Commit messages:
 - Hoist supported check and change message from review comments
 - Remove builtin anonymous class test
 - Fix whitespace error
 - Fix test not using anonymous class
 - Support anonymous, local and inner classes in TOOLING.jsh

Changes: https://git.openjdk.org/jdk/pull/26864/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26864&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8365878
  Stats: 30 lines in 2 files changed: 28 ins; 1 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/26864.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26864/head:pull/26864

PR: https://git.openjdk.org/jdk/pull/26864


More information about the compiler-dev mailing list