Enable helpful null pointer exceptions (#54853)

Now that JDK 14 is available, and we are bundling it, this commit
enables us to run with helpful null pointer exceptions, which will be a
great aid in debugging.
This commit is contained in:
Jason Tedor 2020-04-06 22:28:36 -04:00
parent 22be925f58
commit f0ed21f5b6
No known key found for this signature in database
GPG Key ID: FA89F05560F16BC5
1 changed files with 10 additions and 0 deletions

View File

@ -55,6 +55,8 @@ final class SystemJvmOptions {
* debugging.
*/
"-XX:-OmitStackTraceInFastThrow",
// enable helpful NullPointerExceptions (https://openjdk.java.net/jeps/358), if they are supported
maybeShowCodeDetailsInExceptionMessages(),
// flags to configure Netty
"-Dio.netty.noUnsafe=true",
"-Dio.netty.noKeySetOptimization=true",
@ -69,6 +71,14 @@ final class SystemJvmOptions {
);
}
private static String maybeShowCodeDetailsInExceptionMessages() {
if (JavaVersion.majorVersion(JavaVersion.CURRENT) >= 14) {
return "-XX:+ShowCodeDetailsInExceptionMessages";
} else {
return "";
}
}
private static String javaLocaleProviders() {
/**
* SPI setting is used to allow loading custom CalendarDataProvider