@@ -1588,7 +1588,8 @@ void java_bytecode_parsert::relement_value_pair(
1588
1588
// / in its inner class array. If the parsed class is not an inner class, then it
1589
1589
// / is ignored. When a parsed class is an inner class, the accessibility
1590
1590
// / information for the parsed class is overwritten, and the parsed class is
1591
- // / marked as an inner class.
1591
+ // / marked as an inner class. Note that is outer_class_info_index == 0, the
1592
+ // / inner class is an anonymous or local class, and is treated as private.
1592
1593
void java_bytecode_parsert::rinner_classes_attribute (
1593
1594
classt &parsed_class,
1594
1595
const u4 &attribute_length)
@@ -1615,13 +1616,6 @@ void java_bytecode_parsert::rinner_classes_attribute(
1615
1616
UNUSED u2 inner_name_index = read_u2 ();
1616
1617
u2 inner_class_access_flags = read_u2 ();
1617
1618
1618
- if (inner_name_index == 0 ) {
1619
- // it is anonymous
1620
- parsed_class.is_private = true ;
1621
- parsed_class.is_protected = false ;
1622
- parsed_class.is_public = false ;
1623
- }
1624
-
1625
1619
if (inner_class_info_index == 0 )
1626
1620
continue ;
1627
1621
@@ -1638,7 +1632,17 @@ void java_bytecode_parsert::rinner_classes_attribute(
1638
1632
parsed_class.is_inner_class =
1639
1633
remove_separator_char (id2string (parsed_class.name ), ' .' ) ==
1640
1634
remove_separator_char (inner_class_info_name, ' /' );
1641
- if (parsed_class.is_inner_class )
1635
+ if (!parsed_class.is_inner_class )
1636
+ continue ;
1637
+ if (outer_class_info_index == 0 )
1638
+ {
1639
+ // This is a marker for an anonymous or local class
1640
+ // which are treated as private
1641
+ parsed_class.is_private = true ;
1642
+ parsed_class.is_protected = false ;
1643
+ parsed_class.is_public = false ;
1644
+ }
1645
+ else
1642
1646
{
1643
1647
parsed_class.is_private = is_private;
1644
1648
parsed_class.is_protected = is_protected;
0 commit comments