Skip to content

Commit 4cd4cf3

Browse files
committed
Java: tolerate fields and classes with the name "nil"
fieldref_exprt confused ID_nil with ID_empty_string and therefore rejected "class nil { int nil; }" for example.
1 parent 5284894 commit 4cd4cf3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

jbmc/src/java_bytecode/java_bytecode_parse_tree.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ class fieldref_exprt : public exprt
352352
template <>
353353
inline bool can_cast_expr<fieldref_exprt>(const exprt &base)
354354
{
355-
return base.get(ID_class) != ID_nil && base.get(ID_component_name) != ID_nil;
355+
return base.get(ID_class) != ID_empty_string &&
356+
base.get(ID_component_name) != ID_empty_string;
356357
}
357358

358359
#endif // CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_PARSE_TREE_H

0 commit comments

Comments
 (0)