Hi, Please have a look at this further improved webrev: http://cr.openjdk.java.net/~goetz/wr19/8218628-exMsg-NPE/09/ http://cr.openjdk.java.net/~goetz/wr19/8218628-exMsg-NPE/09-incremental/
Harold, Coleen, thanks for pointing me to those methods. I'm using them now. This simplifies the helper methods considerably. Ralf, thanks for looking at the messages! I now suppress the "static " and "The return value of '" strings in the array subscript expressions and added corresponding test cases. About "can not" versus "cannot", what I find in the net "cannot" is to be preferred. Any comments on that? By native speakers? See example messages here: http://cr.openjdk.java.net/~goetz/wr19/8218628-exMsg-NPE/09/output_with_debug_info.txt Further, I fixed a build issue with the solaris compiler. All handling of bci is now unsigned. Best regards, Goetz. > -----Original Message----- > From: Schmelter, Ralf > Sent: Dienstag, 7. Mai 2019 14:35 > To: Lindenmaier, Goetz <goetz.lindenma...@sap.com>; Java Core Libs <core- > libs-...@openjdk.java.net>; hotspot-runtime-...@openjdk.java.net; Coleen > Phillimore (coleen.phillim...@oracle.com) <coleen.phillim...@oracle.com> > Subject: RE: RFR(L): 8218628: Add detailed message to NullPointerException > describing what is null. > > 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