JDK-8235690 : [nestmates] InstanceKlass::signature_name returns incorrect hidden class name
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: repo-valhalla
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-12-10
  • Updated: 2020-02-22
  • Resolved: 2019-12-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
repo-valhallaFixed
Related Reports
Relates :  
Relates :  
Description
InstanceKlass::signature_name currently returns the name in CP, i.e. "+" sign.  JVM TI GetClassSignature calls this method to get the signature of a class.  Hidden class should not appear in a field or method signature.  Maybe GetClassSignature should return an error since there is no correct way to represent the hidden class' name in internal name.

"+" and hex number is appended to CP entry when the class is created.  We should audit the code path if the name from CP entry will appear in any error message.


Comments
Fixed with this push: Changeset: b6402b9800be Author: hseigel Date: 2019-12-17 19:31 +0000 URL: https://hg.openjdk.java.net/valhalla/valhalla/rev/b6402b9800be 8235690: [nestmates] InstanceKlass::signature_name returns incorrect hidden class name Summary: Add needed name mangling for hidden classes so right name gets returned Reviewed-by: sspitsyn ! src/hotspot/share/oops/instanceKlass.cpp + test/hotspot/jtreg/serviceability/jvmti/HiddenClass/MyPackage/HiddenClassSigTest.java + test/hotspot/jtreg/serviceability/jvmti/HiddenClass/libHiddenClassSigTest.cpp
17-12-2019

Some details: The JVMTI GetClassSignature is using IK::signature_name() which is based on the K::name(). IK::signature_name() currently returns the name in CP, i.e. "+" sign and it already special cases for is_unsafe_anonymous. The K::external_name() already replaces the '+' with '/' for hidden classes but k->name() does not. Should IK::signature_name() use K::external_name() instead of K::name() or do the "+" sign replacement by itself? Of course, it is if we want the JVMTI GetClassSignature() to return it as it is questioned in the bug description.
10-12-2019