@@ -216,6 +216,85 @@ SCENARIO(
216
216
}
217
217
}
218
218
219
+ GIVEN (
220
+ " Some package-private class files in the class path with private deeply"
221
+ " nested inner classes" )
222
+ {
223
+ const symbol_tablet &new_symbol_table = load_java_class (
224
+ " InnerPrivateClassesDeeplyNested" ,
225
+ " ./java_bytecode/java_bytecode_parser" );
226
+ WHEN (
227
+ " Parsing the InnerClasses attribute for a public doubly-nested inner "
228
+ " class" )
229
+ {
230
+ THEN (
231
+ " The inner class should be marked as private because its containing "
232
+ " class has stricter access " )
233
+ {
234
+ const symbolt &class_symbol = new_symbol_table.lookup_ref (
235
+ " java::InnerPrivateClassesDeeplyNested$SinglyNestedPrivateClass$"
236
+ " PublicDoublyNestedInnerClass" );
237
+ const java_class_typet java_class =
238
+ to_java_class_type (class_symbol.type );
239
+ REQUIRE_FALSE (java_class.get_is_anonymous_class ());
240
+ REQUIRE (java_class.get_is_inner_class ());
241
+ REQUIRE (java_class.get_access () == ID_private);
242
+ }
243
+ }
244
+ WHEN (
245
+ " Parsing the InnerClasses attribute for a package private doubly-nested "
246
+ " inner class" )
247
+ {
248
+ THEN (
249
+ " The inner class should be marked as private because its containing "
250
+ " class has stricter access " )
251
+ {
252
+ const symbolt &class_symbol = new_symbol_table.lookup_ref (
253
+ " java::InnerPrivateClassesDeeplyNested$SinglyNestedPrivateClass$"
254
+ " DefaultDoublyNestedInnerClass" );
255
+ const java_class_typet java_class =
256
+ to_java_class_type (class_symbol.type );
257
+ REQUIRE_FALSE (java_class.get_is_anonymous_class ());
258
+ REQUIRE (java_class.get_is_inner_class ());
259
+ REQUIRE (java_class.get_access () == ID_private);
260
+ }
261
+ }
262
+ WHEN (
263
+ " Parsing the InnerClasses attribute for a protected doubly-nested inner "
264
+ " class" )
265
+ {
266
+ THEN (
267
+ " The inner class should be marked as private because its containing "
268
+ " class has stricter access " )
269
+ {
270
+ const symbolt &class_symbol = new_symbol_table.lookup_ref (
271
+ " java::InnerPrivateClassesDeeplyNested$SinglyNestedPrivateClass$"
272
+ " ProtectedDoublyNestedInnerClass" );
273
+ const java_class_typet java_class =
274
+ to_java_class_type (class_symbol.type );
275
+ REQUIRE_FALSE (java_class.get_is_anonymous_class ());
276
+ REQUIRE (java_class.get_is_inner_class ());
277
+ REQUIRE (java_class.get_access () == ID_private);
278
+ }
279
+ }
280
+ WHEN (
281
+ " Parsing the InnerClasses attribute for a private doubly-nested inner "
282
+ " class" )
283
+ {
284
+ THEN (" The inner class should be marked as private " )
285
+ {
286
+ const symbolt &class_symbol = new_symbol_table.lookup_ref (
287
+ " java::InnerPrivateClassesDeeplyNested$SinglyNestedPrivateClass$"
288
+ " PrivateDoublyNestedInnerClass" );
289
+ const java_class_typet java_class =
290
+ to_java_class_type (class_symbol.type );
291
+ REQUIRE_FALSE (java_class.get_is_anonymous_class ());
292
+ REQUIRE (java_class.get_is_inner_class ());
293
+ REQUIRE (java_class.get_access () == ID_private);
294
+ }
295
+ }
296
+ }
297
+
219
298
GIVEN (
220
299
" Some package-private class files in the class path with anonymous classes" )
221
300
{
0 commit comments