File tree 4 files changed +41
-0
lines changed
java_bytecode/java_bytecode_parse_generics 4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ SRC += java_bytecode/ci_lazy_methods/lazy_load_lambdas.cpp \
33
33
java_bytecode/java_bytecode_parse_generics/parse_nested_generics.cpp \
34
34
java_bytecode/java_bytecode_parse_generics/parse_recursive_generic_class.cpp \
35
35
java_bytecode/java_bytecode_parse_generics/parse_signature_descriptor_mismatch.cpp \
36
+ java_bytecode/java_bytecode_parse_generics/parse_lvtt_generic_local_vars.cpp \
36
37
java_bytecode/java_bytecode_parse_lambdas/java_bytecode_convert_class_lambda_method_handles.cpp \
37
38
java_bytecode/java_bytecode_parse_lambdas/java_bytecode_parse_lambda_method_table.cpp \
38
39
java_bytecode/java_bytecode_parser/parse_java_annotations.cpp \
Original file line number Diff line number Diff line change
1
+ public class GenericLocalVar {
2
+ public void f () {
3
+ java .util .ArrayList <Double > l = null ;
4
+ }
5
+ }
Original file line number Diff line number Diff line change
1
+ /* ******************************************************************\
2
+
3
+ Module: Unit tests for parsing generic local variables from the LVTT
4
+
5
+ Author: Diffblue Ltd.
6
+
7
+ \*******************************************************************/
8
+
9
+ #include < java-testing-utils/load_java_class.h>
10
+ #include < java-testing-utils/require_type.h>
11
+ #include < testing-utils/catch.hpp>
12
+
13
+ SCENARIO (
14
+ " parse_lvtt_generic_local_vars" ,
15
+ " [core][java_bytecode][java_bytecode_parse_generics]" )
16
+ {
17
+ const symbol_tablet &new_symbol_table = load_java_class (
18
+ " GenericLocalVar" , " ./java_bytecode/java_bytecode_parse_generics" );
19
+
20
+ const std::string var_name (" java::GenericLocalVar.f:()V::1::l" );
21
+ REQUIRE (new_symbol_table.has_symbol (var_name));
22
+
23
+ WHEN (" Local variable has an entry in the LVTT" )
24
+ {
25
+ THEN (" The type should be generic and instantiated with Double" )
26
+ {
27
+ const symbolt &var_symbol = new_symbol_table.lookup_ref (var_name);
28
+ java_generic_typet local_var_type =
29
+ require_type::require_java_generic_type (
30
+ var_symbol.type ,
31
+ {{require_type::type_argument_kindt::Inst,
32
+ " java::java.lang.Double" }});
33
+ }
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments