Skip to content

Commit 2079e25

Browse files
author
thk123
committed
Don't forcibly instantiate abstract classes
If a class is abstract then there definitely isn't an instance of it so we shouldn't load those methods.
1 parent fe61e09 commit 2079e25

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

jbmc/src/java_bytecode/ci_lazy_methods_needed.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,13 @@ bool ci_lazy_methods_neededt::add_needed_class(
5151
void ci_lazy_methods_neededt::add_all_needed_classes(const pointer_typet &pointer_type)
5252
{
5353
namespacet ns{symbol_table};
54-
initialize_instantiated_classes_from_pointer(
55-
pointer_type,
56-
ns);
54+
const java_class_typet &underlying_type =
55+
to_java_class_type(ns.follow(pointer_type.subtype()));
56+
57+
if(underlying_type.is_abstract())
58+
return;
59+
60+
initialize_instantiated_classes_from_pointer(pointer_type, ns);
5761

5862
// TODO we should be passing here a map that maps generic parameters
5963
// to concrete types in the current context TG-2664

0 commit comments

Comments
 (0)