@@ -266,4 +266,64 @@ SCENARIO(
266
266
}
267
267
}
268
268
}
269
+
270
+ GIVEN (" Some class with a static inner class" )
271
+ {
272
+ const symbol_tablet &new_symbol_table = load_java_class (
273
+ " StaticInnerClass" , " ./java_bytecode/java_bytecode_parser" );
274
+ WHEN (" Parsing the InnerClasses attribute for a static inner class " )
275
+ {
276
+ THEN (" The class should be marked as static" )
277
+ {
278
+ const symbolt &class_symbol = new_symbol_table.lookup_ref (
279
+ " java::StaticInnerClass$PublicStaticInnerClass" );
280
+ const java_class_typet java_class =
281
+ to_java_class_type (class_symbol.type );
282
+ REQUIRE (java_class.get_is_inner_class ());
283
+ REQUIRE (java_class.get_is_static_class ());
284
+ }
285
+ }
286
+ WHEN (" Parsing the InnerClasses attribute for a non-static inner class " )
287
+ {
288
+ THEN (" The class should not be marked as static" )
289
+ {
290
+ const symbolt &class_symbol = new_symbol_table.lookup_ref (
291
+ " java::StaticInnerClass$PublicNonStaticInnerClass" );
292
+ const java_class_typet java_class =
293
+ to_java_class_type (class_symbol.type );
294
+ REQUIRE (java_class.get_is_inner_class ());
295
+ REQUIRE_FALSE (java_class.get_is_static_class ());
296
+ }
297
+ }
298
+ }
299
+
300
+ GIVEN (" Some class with a static anonymous class" )
301
+ {
302
+ const symbol_tablet &new_symbol_table = load_java_class (
303
+ " StaticInnerClass" , " ./java_bytecode/java_bytecode_parser" );
304
+ WHEN (" Parsing the InnerClasses attribute for a static anonymous class " )
305
+ {
306
+ THEN (" The class should be marked as static" )
307
+ {
308
+ const symbolt &class_symbol =
309
+ new_symbol_table.lookup_ref (" java::StaticInnerClass$1" );
310
+ const java_class_typet java_class =
311
+ to_java_class_type (class_symbol.type );
312
+ REQUIRE_FALSE (java_class.get_is_inner_class ());
313
+ REQUIRE (java_class.get_is_static_class ());
314
+ }
315
+ }
316
+ WHEN (" Parsing the InnerClasses attribute for a non-static anonymous class " )
317
+ {
318
+ THEN (" The class should not be marked as static" )
319
+ {
320
+ const symbolt &class_symbol =
321
+ new_symbol_table.lookup_ref (" java::StaticInnerClass$2" );
322
+ const java_class_typet java_class =
323
+ to_java_class_type (class_symbol.type );
324
+ REQUIRE_FALSE (java_class.get_is_inner_class ());
325
+ REQUIRE_FALSE (java_class.get_is_static_class ());
326
+ }
327
+ }
328
+ }
269
329
}
0 commit comments