File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed
jbmc/unit/java_bytecode/java_bytecode_convert_method Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ public class ClassWithFinalMethod {
2
+ public final int finalFunc () {
3
+ return 0 ;
4
+ }
5
+ public int nonFinalFunc () {
6
+ return 0 ;
7
+ }
8
+ }
Original file line number Diff line number Diff line change @@ -57,3 +57,37 @@ SCENARIO(
57
57
}
58
58
}
59
59
}
60
+
61
+ SCENARIO (
62
+ " java_bytecode_convert_final_method" ,
63
+ " [core][java_bytecode][java_bytecode_convert_method]" )
64
+ {
65
+ GIVEN (" A class with final and non-final methods" )
66
+ {
67
+ const symbol_tablet symbol_table = load_java_class (
68
+ " ClassWithFinalMethod" , " ./java_bytecode/java_bytecode_convert_method" );
69
+
70
+ WHEN (" When parsing a final method" )
71
+ {
72
+ const symbolt function_symbol =
73
+ symbol_table.lookup_ref (" java::ClassWithFinalMethod.finalFunc:()I" );
74
+ const java_method_typet &function_type =
75
+ require_type::require_java_method (function_symbol.type );
76
+ THEN (" The method should be marked as final" )
77
+ {
78
+ REQUIRE (function_type.get_is_final ());
79
+ }
80
+ }
81
+ WHEN (" When parsing a non-final method" )
82
+ {
83
+ const symbolt function_symbol =
84
+ symbol_table.lookup_ref (" java::ClassWithFinalMethod.nonFinalFunc:()I" );
85
+ const java_method_typet &function_type =
86
+ require_type::require_java_method (function_symbol.type );
87
+ THEN (" The method should not be marked as final" )
88
+ {
89
+ REQUIRE (!function_type.get_is_final ());
90
+ }
91
+ }
92
+ }
93
+ }
You can’t perform that action at this time.
0 commit comments