RFR: 8268358: [lworld] toString for primitive class should return `ClassName at hash`

John Rose john.r.rose at oracle.com
Wed Jun 9 18:40:02 UTC 2021


On Jun 9, 2021, at 10:43 AM, Mandy Chung <mchung at openjdk.java.net<mailto:mchung at openjdk.java.net>> wrote:

On Tue, 8 Jun 2021 19:55:46 GMT, Mandy Chung <mchung at openjdk.org<mailto:mchung at openjdk.org>> wrote:

`Object::toString` implementation of a primitive class should return the traditional `ClassName at hash` (rather than listing the field values) not to leak any private and security-sensitive information.   A primitive class can override `toString` implementation for their custom string representation.

This reminds me [JDK-8201462](https://bugs.openjdk.java.net/browse/JDK-8201462).

Yes.  That is a larger brain dump.  My comments
on this thread are hopefully narrower and more
actionable.

FWIW the current implementation already adds the randomness to
the hash code computation with a constant random 32-bit “salt”
configured at startup but it still carries the `31*x+` pattern which
should be cleaned up.

I didn’t know that; good!  Flexibility for the
future my main concern right now.



More information about the valhalla-dev mailing list