Java 14 "Helpful NullPointerExceptions"

From: Chapman Flack <chap(at)anastigmatix(dot)net>
To: "pljava-dev(at)lists(dot)postgresql(dot)org" <pljava-dev(at)lists(dot)postgresql(dot)org>
Subject: Java 14 "Helpful NullPointerExceptions"
Date: 2020-05-30 19:16:35
Message-ID: 5ED2B113.1000606@anastigmatix.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

There is a great option to add in pljava.vmoptions when running on
Java 14 or later:

-XX:+ShowCodeDetailsInExceptionMessages

It arranges so that if a NullPointerException is ever thrown, instead of

ERROR: java.lang.NullPointerException

you see something like

ERROR: java.lang.NullPointerException: Cannot assign field "i" because
"a" is null

A little thing, but handy, and very easy to enable. It doesn't add to the
cost of null-pointer exceptions thrown and caught internally, because the
work is only done if the message is used. [1]

-Chap

[1] https://openjdk.java.net/jeps/358

Browse pljava-dev by date

  From Date Subject
Next Message Chapman Flack 2020-05-31 16:00:08 Re: Starting build-system work (Windows/Mac users please speak up)
Previous Message Chapman Flack 2020-05-30 14:42:02 Re: Starting build-system work (Windows/Mac users please speak up)