RFR(L): 8218628: Add detailed message to NullPointerException describing what is null.

Schmelter, Ralf ralf.schmelter at sap.com
Tue May 7 12:34:49 UTC 2019


Hi Goetz,

I've played with the messages a little bit and they generally look good. But I've come across two which look strange:
 - 'o[static Test.INDEX]' is null. Can not invoke method 'int java.lang.Object.hashCode()'
 - 'o[The return value of 'int java.lang.String.hashCode()]' is null. Can not invoke method 'int java.lang.Object.hashCode()'.

Here is the test program to reproduce these:
public class Test {
    public static int INDEX = 2;

    public static void main(String[] args) {
        Object[] o = new Object[10];
        try {
             o[INDEX].hashCode();
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
             o["".hashCode()].hashCode();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

And 'Can not' should be 'Cannot'?

Best regards,
Ralf


More information about the hotspot-runtime-dev mailing list