Skip to content

Commit 841313d

Browse files
Add ability to mark methods as ignored (not loaded)
1 parent b4f5800 commit 841313d

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

jbmc/src/java_bytecode/java_bytecode_convert_class.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,15 @@ class java_bytecode_convert_classt:public messaget
118118
// see definition below for more info
119119
static void add_array_types(symbol_tablet &symbol_table);
120120

121-
static bool is_overlay_method(const methodt &method);
121+
static bool is_overlay_method(const methodt &method)
122+
{
123+
return method.has_annotation(ID_overlay_method);
124+
}
125+
126+
static bool is_ignored_method(const methodt &method)
127+
{
128+
return method.has_annotation(ID_ignored_method);
129+
}
122130

123131
bool check_field_exists(
124132
const fieldt &field,
@@ -455,6 +463,8 @@ void java_bytecode_convert_classt::convert(
455463
{
456464
for(const methodt &method : overlay_class.get().methods)
457465
{
466+
if(is_ignored_method(method))
467+
continue;
458468
const irep_idt method_identifier =
459469
qualified_classname + "." + id2string(method.name)
460470
+ ":" + method.descriptor;
@@ -496,6 +506,8 @@ void java_bytecode_convert_classt::convert(
496506
}
497507
for(const methodt &method : c.methods)
498508
{
509+
if(is_ignored_method(method))
510+
continue;
499511
const irep_idt method_identifier=
500512
qualified_classname + "." + id2string(method.name)
501513
+ ":" + method.descriptor;
@@ -877,13 +889,6 @@ void java_bytecode_convert_classt::add_array_types(symbol_tablet &symbol_table)
877889
}
878890
}
879891

880-
bool java_bytecode_convert_classt::is_overlay_method(const methodt &method)
881-
{
882-
return java_bytecode_parse_treet::find_annotation(
883-
method.annotations, ID_overlay_method)
884-
.has_value();
885-
}
886-
887892
bool java_bytecode_convert_class(
888893
const java_class_loadert::parse_tree_with_overlayst &parse_trees,
889894
symbol_tablet &symbol_table,

jbmc/src/java_bytecode/java_bytecode_parse_tree.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ class java_bytecode_parse_treet
8484
is_private(false), is_static(false), is_final(false)
8585
{
8686
}
87+
88+
bool has_annotation(const irep_idt &annotation_id) const
89+
{
90+
return find_annotation(annotations, annotation_id).has_value();
91+
}
8792
};
8893

8994
class methodt:public membert

src/util/irep_ids.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ IREP_ID_TWO(overflow_shl, overflow-shl)
664664
IREP_ID_TWO(C_no_initialization_required, #no_initialization_required)
665665
IREP_ID_TWO(overlay_class, java::com.diffblue.OverlayClassImplementation)
666666
IREP_ID_TWO(overlay_method, java::com.diffblue.OverlayMethodImplementation)
667+
IREP_ID_TWO(ignored_method, java::com.diffblue.IgnoredMethodImplementation)
667668
IREP_ID_ONE(is_annotation)
668669
IREP_ID_TWO(C_annotations, #annotations)
669670
IREP_ID_ONE(final)

0 commit comments

Comments
 (0)