66
77\*******************************************************************/
88
9-
109#ifndef CPROVER_JAVA_BYTECODE_JAVA_TYPES_H
1110#define CPROVER_JAVA_BYTECODE_JAVA_TYPES_H
1211
1615#include < util/type.h>
1716#include < util/std_types.h>
1817#include < util/c_types.h>
19- #include < util/config.h>
2018#include < util/optional.h>
2119
2220class java_class_typet :public class_typet
@@ -83,10 +81,8 @@ std::vector<typet> java_generic_type_from_string(
8381typet java_bytecode_promotion (const typet &);
8482exprt java_bytecode_promotion (const exprt &);
8583
86- bool is_java_array_tag (const irep_idt& tag);
87-
88- bool is_valid_java_array (const struct_typet &type);
89-
84+ bool is_java_array_tag (const irep_idt &tag);
85+ bool is_valid_java_array (const struct_typet &);
9086
9187// / class to hold a Java generic type
9288// / upper bound can specify type requirements
@@ -96,14 +92,12 @@ class java_generic_parametert:public reference_typet
9692 typedef symbol_typet type_variablet;
9793 typedef std::vector<type_variablet> type_variablest;
9894
99- java_generic_parametert (const irep_idt &_type_var_name, const typet &_bound) :
100- // the reference_typet now needs a pointer width, here it uses the one
101- // defined in the reference_type function from c_types.cpp
102- reference_typet (_bound, config.ansi_c.pointer_width )
95+ java_generic_parametert (
96+ const irep_idt &_type_var_name,
97+ const symbol_typet &_bound):
98+ reference_typet (java_reference_type( _bound) )
10399 {
104- PRECONDITION (_bound.id ()==ID_symbol);
105100 set (ID_C_java_generic_parameter, true );
106- // bound must be symbol type
107101 type_variables ().push_back (symbol_typet (_type_var_name));
108102 }
109103
@@ -156,7 +150,7 @@ class java_generic_inst_parametert:public java_generic_parametert
156150public:
157151 // uses empty name for base type variable java_generic_parametert as real name
158152 // is not known here
159- explicit java_generic_inst_parametert (const typet &type) :
153+ explicit java_generic_inst_parametert (const symbol_typet &type):
160154 java_generic_parametert(irep_idt(), type)
161155 {
162156 set (ID_C_java_generic_inst_parameter, true );
@@ -205,27 +199,27 @@ class java_generic_typet:public reference_typet
205199public:
206200 typedef std::vector<java_generic_parametert> generic_type_variablest;
207201
208- explicit java_generic_typet (const typet &_type) :
209- reference_typet(_type, config.ansi_c.pointer_width )
202+ explicit java_generic_typet (const typet &_type):
203+ reference_typet(java_reference_type( _type) )
210204 {
211205 set (ID_C_java_generic_type, true );
212206 }
213207
214-
215208 // / \return vector of type variables
216209 const generic_type_variablest &generic_type_variables () const
217210 {
218- return (const generic_type_variablest &)(find (ID_type_variables).get_sub ());
211+ return (const generic_type_variablest &)(
212+ find (ID_type_variables).get_sub ());
219213 }
220214
221215 // / \return vector of type variables
222216 generic_type_variablest &generic_type_variables ()
223217 {
224- return (generic_type_variablest &)(add (ID_type_variables).get_sub ());
218+ return (generic_type_variablest &)(
219+ add (ID_type_variables).get_sub ());
225220 }
226221};
227222
228-
229223// / \param type: the type to check
230224// / \return true if type is java type containing with generics, e.g., List<T>
231225inline bool is_java_generic_type (const typet &type)
@@ -353,7 +347,6 @@ inline const typet &java_generics_class_type_bound(
353347 return gen_type.subtype ();
354348}
355349
356-
357350// / An exception that is raised for unsupported class signature.
358351// / Currently we do not parse multiple bounds.
359352class unsupported_java_class_signature_exceptiont :public std ::logic_error
@@ -375,7 +368,7 @@ inline typet java_type_from_string_with_exception(
375368 {
376369 return java_type_from_string (signature.value (), class_name);
377370 }
378- catch (unsupported_java_class_signature_exceptiont &e )
371+ catch (unsupported_java_class_signature_exceptiont &)
379372 {
380373 return java_type_from_string (descriptor, class_name);
381374 }
@@ -389,7 +382,8 @@ inline const optionalt<size_t> java_generics_get_index_for_subtype(
389382 const java_generics_class_typet &t,
390383 const irep_idt &identifier)
391384{
392- const std::vector<java_generic_parametert> &gen_types=t.generic_types ();
385+ const std::vector<java_generic_parametert> &gen_types=
386+ t.generic_types ();
393387
394388 const auto iter = std::find_if (
395389 gen_types.cbegin (),
0 commit comments