Skip to content

Commit 6abaf25

Browse files
author
Daniel Kroening
committed
remove java_method_typet::final/native
This removes four methods from java_method_typet. They do not belong there, as neither 'native' nor 'final' are part of the type of the method (they are field modifiers). They are never read.
1 parent b20cf69 commit 6abaf25

File tree

3 files changed

+0
-52
lines changed

3 files changed

+0
-52
lines changed

Diff for: jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ void java_bytecode_convert_method_lazy(
326326
member_type.set(ID_is_synchronized, true);
327327
if(m.is_static)
328328
member_type.set(ID_is_static, true);
329-
member_type.set_native(m.is_native);
330329
member_type.set_is_varargs(m.is_varargs);
331330
member_type.set_is_synthetic(m.is_synthetic);
332331

@@ -418,7 +417,6 @@ void java_bytecode_convert_methodt::convert(
418417
// to the symbol later.
419418
java_method_typet method_type =
420419
to_java_method_type(symbol_table.lookup_ref(method_identifier).type);
421-
method_type.set_is_final(m.is_final);
422420
method_return_type = method_type.return_type();
423421
java_method_typet::parameterst &parameters = method_type.parameters();
424422

@@ -2231,7 +2229,6 @@ void java_bytecode_convert_methodt::convert_invoke(
22312229
id2string(symbol.base_name) + "()";
22322230
symbol.type = method_type;
22332231
symbol.type.set(ID_access, ID_private);
2234-
to_java_method_type(symbol.type).set_is_final(true);
22352232
symbol.value.make_nil();
22362233
symbol.mode = ID_java;
22372234
assign_parameter_names(

Diff for: jbmc/src/java_bytecode/java_types.h

-20
Original file line numberDiff line numberDiff line change
@@ -136,26 +136,6 @@ class java_method_typet : public code_typet
136136
add(ID_exceptions_thrown_list).get_sub().push_back(irept(exception));
137137
}
138138

139-
bool get_is_final() const
140-
{
141-
return get_bool(ID_final);
142-
}
143-
144-
void set_is_final(bool is_final)
145-
{
146-
set(ID_final, is_final);
147-
}
148-
149-
bool get_native() const
150-
{
151-
return get_bool(ID_is_native_method);
152-
}
153-
154-
void set_native(bool is_native)
155-
{
156-
set(ID_is_native_method, is_native);
157-
}
158-
159139
bool get_is_varargs() const
160140
{
161141
return get_bool(ID_is_varargs_method);

Diff for: jbmc/unit/java_bytecode/java_bytecode_convert_method/convert_method.cpp

-29
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,6 @@ SCENARIO(
8989
{
9090
REQUIRE(function_type.get_bool(ID_C_java_method_type));
9191
}
92-
THEN("And the method should be marked as a native method")
93-
{
94-
REQUIRE(to_java_method_type(function_type).get_native());
95-
}
9692
THEN("The method should be marked as declared by its class")
9793
{
9894
REQUIRE(
@@ -104,13 +100,6 @@ SCENARIO(
104100
{
105101
const symbolt function_symbol =
106102
symbol_table.lookup_ref(method_name + ":(I)Z");
107-
108-
const java_method_typet &function_type =
109-
require_type::require_java_method(function_symbol.type);
110-
THEN("The method should not be marked as a native method.")
111-
{
112-
REQUIRE_FALSE(to_java_method_type(function_type).get_native());
113-
}
114103
THEN("The method should be marked as declared by its class")
115104
{
116105
REQUIRE(
@@ -134,12 +123,6 @@ SCENARIO(
134123
{
135124
const symbolt function_symbol =
136125
symbol_table.lookup_ref("java::ClassWithFinalMethod.finalFunc:()I");
137-
const java_method_typet &function_type =
138-
require_type::require_java_method(function_symbol.type);
139-
THEN("The method should be marked as final")
140-
{
141-
REQUIRE(function_type.get_is_final());
142-
}
143126
THEN("The method should be marked as declared by its class")
144127
{
145128
REQUIRE(
@@ -151,12 +134,6 @@ SCENARIO(
151134
{
152135
const symbolt function_symbol =
153136
symbol_table.lookup_ref("java::ClassWithFinalMethod.nonFinalFunc:()I");
154-
const java_method_typet &function_type =
155-
require_type::require_java_method(function_symbol.type);
156-
THEN("The method should not be marked as final")
157-
{
158-
REQUIRE(!function_type.get_is_final());
159-
}
160137
THEN("The method should be marked as declared by its class")
161138
{
162139
REQUIRE(
@@ -168,12 +145,6 @@ SCENARIO(
168145
{
169146
const symbolt function_symbol =
170147
symbol_table.lookup_ref("java::OpaqueClass.staticFunc:()I");
171-
const java_method_typet &function_type =
172-
require_type::require_java_method(function_symbol.type);
173-
THEN("The method should be marked as final")
174-
{
175-
REQUIRE(function_type.get_is_final());
176-
}
177148
THEN("The method should be marked as declared by its class")
178149
{
179150
REQUIRE(

0 commit comments

Comments
 (0)