Skip to content

Commit 141503e

Browse files
author
Joel Allred
authored
Merge pull request #2857 from allredj/fix-opaque-accessibility
Remove wrong assumption on opaque methods
2 parents 62e24f1 + 1d8c735 commit 141503e

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

+6-11
Original file line numberDiff line numberDiff line change
@@ -2189,18 +2189,13 @@ void java_bytecode_convert_methodt::convert_invoke(
21892189
// inherit a definition from a super-class, we create a new symbol and
21902190
// insert it in the symbol table. The name and type of the method are
21912191
// derived from the information we have in the call.
2192-
// We fix the access attribute to ID_public, because of the following
2192+
// We fix the access attribute to ID_private, because of the following
21932193
// reasons:
2194-
// - We don't know the orignal access attribute and since the .class file
2194+
// - We don't know the original access attribute and since the .class file is
21952195
// unavailable, we have no way to know.
2196-
// - Whatever it was, we assume that the bytecode we are translating
2197-
// compiles correctly, so such a method has to be accessible from this
2198-
// method.
2199-
// - We will never generate code that calls that method unless we
2200-
// translate bytecode that calls that method. As a result we will never
2201-
// generate code that may wrongly assume that such a method is
2202-
// accessible if we assume that its access attribute is "more
2203-
// accessible" than it actually is.
2196+
// - The translated method could be an inherited protected method, hence
2197+
// accessible from the original caller, but not from the generated test.
2198+
// Therefore we must assume that the method is not accessible.
22042199
irep_idt id = arg0.get(ID_identifier);
22052200
if(
22062201
symbol_table.symbols.find(id) == symbol_table.symbols.end() &&
@@ -2213,7 +2208,7 @@ void java_bytecode_convert_methodt::convert_invoke(
22132208
symbol.pretty_name = id2string(arg0.get(ID_C_class)).substr(6) + "." +
22142209
id2string(symbol.base_name) + "()";
22152210
symbol.type = arg0.type();
2216-
symbol.type.set(ID_access, ID_public);
2211+
symbol.type.set(ID_access, ID_private);
22172212
symbol.value.make_nil();
22182213
symbol.mode = ID_java;
22192214
assign_parameter_names(

0 commit comments

Comments
 (0)