From dd203c4d27f297c580313753d0359f759a16fb23 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Wed, 11 Oct 2017 13:34:08 +0100 Subject: [PATCH] Lazy methods: mark JVM-generated exceptions as always available java.lang.NullPointerException et al are producable from Java ops other than throw, and therefore weren't previously noticed. This adds the exceptions that can be introduced by java_bytecode/java_bytecode_instrument.cpp into the lazy methods loader's list of always-available classes. --- src/java_bytecode/ci_lazy_methods.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/java_bytecode/ci_lazy_methods.cpp b/src/java_bytecode/ci_lazy_methods.cpp index 240dafc0e29..2aead0eb469 100644 --- a/src/java_bytecode/ci_lazy_methods.cpp +++ b/src/java_bytecode/ci_lazy_methods.cpp @@ -280,6 +280,13 @@ void ci_lazy_methodst::initialize_needed_classes( lazy_methods.add_needed_class("java::java.lang.String"); lazy_methods.add_needed_class("java::java.lang.Class"); lazy_methods.add_needed_class("java::java.lang.Object"); + // Add the classes that can be produced by `java_bytecode_instrument`: + lazy_methods.add_needed_class("java::java.lang.NullPointerException"); + lazy_methods.add_needed_class("java::java.lang.ArithmeticException"); + lazy_methods.add_needed_class( + "java::java.lang.ArrayIndexOutOfBoundsException"); + lazy_methods.add_needed_class("java::java.lang.ClassCastException"); + lazy_methods.add_needed_class("java::java.lang.NegativeArraySizeException"); } /// Build up list of methods for types for a pointer and any types it