Skip to content

Commit abc4eac

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 0475c87 commit abc4eac

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
@@ -341,7 +341,6 @@ void java_bytecode_convert_method_lazy(
341341
member_type.set(ID_is_synchronized, true);
342342
if(m.is_static)
343343
member_type.set(ID_is_static, true);
344-
member_type.set_native(m.is_native);
345344
member_type.set_is_varargs(m.is_varargs);
346345
member_type.set_is_synthetic(m.is_synthetic);
347346

@@ -433,7 +432,6 @@ void java_bytecode_convert_methodt::convert(
433432
// to the symbol later.
434433
java_method_typet method_type =
435434
to_java_method_type(symbol_table.lookup_ref(method_identifier).type);
436-
method_type.set_is_final(m.is_final);
437435
method_return_type = method_type.return_type();
438436
java_method_typet::parameterst &parameters = method_type.parameters();
439437

@@ -2211,7 +2209,6 @@ void java_bytecode_convert_methodt::convert_invoke(
22112209
id2string(symbol.base_name) + "()";
22122210
symbol.type = method_type;
22132211
symbol.type.set(ID_access, ID_private);
2214-
to_java_method_type(symbol.type).set_is_final(true);
22152212
symbol.value.make_nil();
22162213
symbol.mode = ID_java;
22172214
assign_parameter_names(

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

-20
Original file line numberDiff line numberDiff line change
@@ -389,26 +389,6 @@ class java_method_typet : public code_typet
389389
add(ID_exceptions_thrown_list).get_sub().push_back(irept(exception));
390390
}
391391

392-
bool get_is_final() const
393-
{
394-
return get_bool(ID_final);
395-
}
396-
397-
void set_is_final(bool is_final)
398-
{
399-
set(ID_final, is_final);
400-
}
401-
402-
bool get_native() const
403-
{
404-
return get_bool(ID_is_native_method);
405-
}
406-
407-
void set_native(bool is_native)
408-
{
409-
set(ID_is_native_method, is_native);
410-
}
411-
412392
bool get_is_varargs() const
413393
{
414394
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
@@ -86,10 +86,6 @@ SCENARIO(
8686
{
8787
REQUIRE(function_type.get_bool(ID_C_java_method_type));
8888
}
89-
THEN("And the method should be marked as a native method")
90-
{
91-
REQUIRE(to_java_method_type(function_type).get_native());
92-
}
9389
THEN("The method should be marked as declared by its class")
9490
{
9591
REQUIRE(
@@ -101,13 +97,6 @@ SCENARIO(
10197
{
10298
const symbolt function_symbol =
10399
symbol_table.lookup_ref(method_name + ":(I)Z");
104-
105-
const java_method_typet &function_type =
106-
require_type::require_java_method(function_symbol.type);
107-
THEN("The method should not be marked as a native method.")
108-
{
109-
REQUIRE_FALSE(to_java_method_type(function_type).get_native());
110-
}
111100
THEN("The method should be marked as declared by its class")
112101
{
113102
REQUIRE(
@@ -131,12 +120,6 @@ SCENARIO(
131120
{
132121
const symbolt function_symbol =
133122
symbol_table.lookup_ref("java::ClassWithFinalMethod.finalFunc:()I");
134-
const java_method_typet &function_type =
135-
require_type::require_java_method(function_symbol.type);
136-
THEN("The method should be marked as final")
137-
{
138-
REQUIRE(function_type.get_is_final());
139-
}
140123
THEN("The method should be marked as declared by its class")
141124
{
142125
REQUIRE(
@@ -148,12 +131,6 @@ SCENARIO(
148131
{
149132
const symbolt function_symbol =
150133
symbol_table.lookup_ref("java::ClassWithFinalMethod.nonFinalFunc:()I");
151-
const java_method_typet &function_type =
152-
require_type::require_java_method(function_symbol.type);
153-
THEN("The method should not be marked as final")
154-
{
155-
REQUIRE(!function_type.get_is_final());
156-
}
157134
THEN("The method should be marked as declared by its class")
158135
{
159136
REQUIRE(
@@ -165,12 +142,6 @@ SCENARIO(
165142
{
166143
const symbolt function_symbol =
167144
symbol_table.lookup_ref("java::OpaqueClass.staticFunc:()I");
168-
const java_method_typet &function_type =
169-
require_type::require_java_method(function_symbol.type);
170-
THEN("The method should be marked as final")
171-
{
172-
REQUIRE(function_type.get_is_final());
173-
}
174145
THEN("The method should be marked as declared by its class")
175146
{
176147
REQUIRE(

0 commit comments

Comments
 (0)