6
6
7
7
\*******************************************************************/
8
8
9
-
10
9
#ifndef CPROVER_JAVA_BYTECODE_JAVA_TYPES_H
11
10
#define CPROVER_JAVA_BYTECODE_JAVA_TYPES_H
12
11
16
15
#include < util/type.h>
17
16
#include < util/std_types.h>
18
17
#include < util/c_types.h>
19
- #include < util/config.h>
20
18
#include < util/optional.h>
21
19
22
20
class java_class_typet :public class_typet
@@ -83,10 +81,8 @@ std::vector<typet> java_generic_type_from_string(
83
81
typet java_bytecode_promotion (const typet &);
84
82
exprt java_bytecode_promotion (const exprt &);
85
83
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 &);
90
86
91
87
// / class to hold a Java generic type
92
88
// / upper bound can specify type requirements
@@ -96,14 +92,12 @@ class java_generic_parametert:public reference_typet
96
92
typedef symbol_typet type_variablet;
97
93
typedef std::vector<type_variablet> type_variablest;
98
94
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) )
103
99
{
104
- PRECONDITION (_bound.id ()==ID_symbol);
105
100
set (ID_C_java_generic_parameter, true );
106
- // bound must be symbol type
107
101
type_variables ().push_back (symbol_typet (_type_var_name));
108
102
}
109
103
@@ -156,7 +150,7 @@ class java_generic_inst_parametert:public java_generic_parametert
156
150
public:
157
151
// uses empty name for base type variable java_generic_parametert as real name
158
152
// is not known here
159
- explicit java_generic_inst_parametert (const typet &type) :
153
+ explicit java_generic_inst_parametert (const symbol_typet &type):
160
154
java_generic_parametert(irep_idt(), type)
161
155
{
162
156
set (ID_C_java_generic_inst_parameter, true );
@@ -205,27 +199,27 @@ class java_generic_typet:public reference_typet
205
199
public:
206
200
typedef std::vector<java_generic_parametert> generic_type_variablest;
207
201
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) )
210
204
{
211
205
set (ID_C_java_generic_type, true );
212
206
}
213
207
214
-
215
208
// / \return vector of type variables
216
209
const generic_type_variablest &generic_type_variables () const
217
210
{
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 ());
219
213
}
220
214
221
215
// / \return vector of type variables
222
216
generic_type_variablest &generic_type_variables ()
223
217
{
224
- return (generic_type_variablest &)(add (ID_type_variables).get_sub ());
218
+ return (generic_type_variablest &)(
219
+ add (ID_type_variables).get_sub ());
225
220
}
226
221
};
227
222
228
-
229
223
// / \param type: the type to check
230
224
// / \return true if type is java type containing with generics, e.g., List<T>
231
225
inline bool is_java_generic_type (const typet &type)
@@ -353,7 +347,6 @@ inline const typet &java_generics_class_type_bound(
353
347
return gen_type.subtype ();
354
348
}
355
349
356
-
357
350
// / An exception that is raised for unsupported class signature.
358
351
// / Currently we do not parse multiple bounds.
359
352
class unsupported_java_class_signature_exceptiont :public std ::logic_error
@@ -375,7 +368,7 @@ inline typet java_type_from_string_with_exception(
375
368
{
376
369
return java_type_from_string (signature.value (), class_name);
377
370
}
378
- catch (unsupported_java_class_signature_exceptiont &e )
371
+ catch (unsupported_java_class_signature_exceptiont &)
379
372
{
380
373
return java_type_from_string (descriptor, class_name);
381
374
}
@@ -389,7 +382,8 @@ inline const optionalt<size_t> java_generics_get_index_for_subtype(
389
382
const java_generics_class_typet &t,
390
383
const irep_idt &identifier)
391
384
{
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 ();
393
387
394
388
const auto iter = std::find_if (
395
389
gen_types.cbegin (),
0 commit comments