Skip to content

Commit b1c1d48

Browse files
Update unit tests to use new accessibility information.
1 parent 94c9164 commit b1c1d48

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

jbmc/unit/java_bytecode/java_bytecode_parser/parse_java_attributes.cpp

+17-8
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,18 @@ SCENARIO(
8181
"InnerClassesDefault", "./java_bytecode/java_bytecode_parser");
8282
WHEN("Parsing the InnerClasses attribute for a public inner class")
8383
{
84-
THEN("The class should be marked as public")
84+
THEN(
85+
"The inner class should be marked as package-private (default) because "
86+
"its "
87+
"containing class has stricter access ")
8588
{
8689
const symbolt &class_symbol = new_symbol_table.lookup_ref(
8790
"java::InnerClassesDefault$PublicInnerClass");
8891
const java_class_typet java_class =
8992
to_java_class_type(class_symbol.type);
9093
REQUIRE_FALSE(java_class.get_is_anonymous_class());
9194
REQUIRE(java_class.get_is_inner_class());
92-
REQUIRE(java_class.get_access() == ID_public);
95+
REQUIRE(java_class.get_access() == ID_default);
9396
}
9497
}
9598
WHEN(
@@ -109,15 +112,17 @@ SCENARIO(
109112
}
110113
WHEN("Parsing the InnerClasses attribute for a protected inner class")
111114
{
112-
THEN("The class should be marked as protected")
115+
THEN(
116+
"The inner class should be marked as package-private (default) because "
117+
"its containing class has stricter access ")
113118
{
114119
const symbolt &class_symbol = new_symbol_table.lookup_ref(
115120
"java::InnerClassesDefault$ProtectedInnerClass");
116121
const java_class_typet java_class =
117122
to_java_class_type(class_symbol.type);
118123
REQUIRE_FALSE(java_class.get_is_anonymous_class());
119124
REQUIRE(java_class.get_is_inner_class());
120-
REQUIRE(java_class.get_access() == ID_protected);
125+
REQUIRE(java_class.get_access() == ID_default);
121126
}
122127
}
123128
WHEN("Parsing the InnerClasses attribute for a private inner class")
@@ -145,7 +150,9 @@ SCENARIO(
145150
"Parsing the InnerClasses attribute for a public doubly-nested inner "
146151
"class")
147152
{
148-
THEN("The class should be marked as public")
153+
THEN(
154+
"The inner class should be marked as package-private (default) because "
155+
"its containing class has stricter access ")
149156
{
150157
const symbolt &class_symbol = new_symbol_table.lookup_ref(
151158
"java::InnerClassesDeeplyNested$SinglyNestedClass$"
@@ -154,7 +161,7 @@ SCENARIO(
154161
to_java_class_type(class_symbol.type);
155162
REQUIRE_FALSE(java_class.get_is_anonymous_class());
156163
REQUIRE(java_class.get_is_inner_class());
157-
REQUIRE(java_class.get_access() == ID_public);
164+
REQUIRE(java_class.get_access() == ID_default);
158165
}
159166
}
160167
WHEN(
@@ -177,7 +184,9 @@ SCENARIO(
177184
"Parsing the InnerClasses attribute for a package private (default) "
178185
"doubly-nested inner class ")
179186
{
180-
THEN("The inner class should be marked as protected")
187+
THEN(
188+
"The inner class should be marked as package-private (default) because "
189+
"its containing class has stricter access ")
181190
{
182191
const symbolt &class_symbol = new_symbol_table.lookup_ref(
183192
"java::InnerClassesDeeplyNested$SinglyNestedClass$"
@@ -186,7 +195,7 @@ SCENARIO(
186195
to_java_class_type(class_symbol.type);
187196
REQUIRE_FALSE(java_class.get_is_anonymous_class());
188197
REQUIRE(java_class.get_is_inner_class());
189-
REQUIRE(java_class.get_access() == ID_protected);
198+
REQUIRE(java_class.get_access() == ID_default);
190199
}
191200
}
192201
WHEN(

0 commit comments

Comments
 (0)