Skip to content

Commit 11e9a77

Browse files
author
svorenova
committed
Ignore generic arguments for mocked and unsupported generic classes cont.
1 parent 3a45ee9 commit 11e9a77

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/java_bytecode/generic_parameter_specialization_map_keys.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,14 @@ const void generic_parameter_specialization_map_keyst::insert_pairs_for_pointer(
9999
pointer_type.subtype().get(ID_identifier) ==
100100
pointer_subtype_struct.get(ID_name));
101101

102-
// If the pointer points to an incomplete class, don't treat the generics
103-
// TODO TG-1996 should treat generic incomplete (mocked) classes
104-
// Also do not treat generics is the class is not marked generic or
105-
// implicitly generic (this may be due to unsupported class signature)
102+
// If the pointer points to:
103+
// - an incomplete class or
104+
// - a class that is neither generic nor implicitly generic (this
105+
// may be due to unsupported class signature)
106+
// then ignore the generic types in the pointer and do not add any pairs.
107+
// TODO TG-1996 should decide how mocking and generics should work
108+
// together. Currently an incomplete class is never marked as generic. If
109+
// this changes in TG-1996 then the condition below should be updated.
106110
if(
107111
!pointer_subtype_struct.get_bool(ID_incomplete_class) &&
108112
(is_java_generic_class_type(pointer_subtype_struct) ||
@@ -137,10 +141,14 @@ const void generic_parameter_specialization_map_keyst::insert_pairs_for_symbol(
137141
const symbol_typet &symbol_type,
138142
const typet &symbol_struct)
139143
{
140-
// If the class is an incomplete class, don't treat the generics
141-
// TODO TG-1996 should treat generic incomplete (mocked) classes
142-
// Also do not treat generics is the class is not marked generic or
143-
// implicitly generic (this may be due to unsupported class signature)
144+
// If the struct is:
145+
// - an incomplete class or
146+
// - a class that is neither generic nor implicitly generic (this
147+
// may be due to unsupported class signature)
148+
// then ignore the generic types in the symbol_type and do not add any pairs.
149+
// TODO TG-1996 should decide how mocking and generics should work
150+
// together. Currently an incomplete class is never marked as generic. If
151+
// this changes in TG-1996 then the condition below should be updated.
144152
if(
145153
is_java_generic_symbol_type(symbol_type) &&
146154
!symbol_struct.get_bool(ID_incomplete_class) &&

0 commit comments

Comments
 (0)