-
Notifications
You must be signed in to change notification settings - Fork 273
add visibility information for fields and methods #847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor suggestions for improvements.
@@ -287,13 +287,14 @@ void java_bytecode_convert_classt::convert( | |||
component.set_base_name(f.name); | |||
component.set_pretty_name(f.name); | |||
component.type()=field_type; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this blank line is safe to stay ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the line is back :-) this was an artifact from squashing some commits
@@ -232,6 +232,14 @@ void java_bytecode_convert_method_lazy( | |||
method_symbol.mode=ID_java; | |||
method_symbol.location=m.source_location; | |||
method_symbol.location.set_function(method_identifier); | |||
if(m.is_public) | |||
member_type.set(ID_access, ID_public); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be using the same set_access
API? (member_type
will thus need to be converted to a more specific type than typet
.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the problem is that set_access
is defined for struct_union_typet
and therefore is only really usable for fields here. I had thought about using a special java_typet
derived from typet
which could have the set_access
, too. Would you prefer that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I would like to avoid is having typet
objects floating around that have ID_access
set without anything ever making use of that. Notably, would equality comparison succeed on two typet
with ID_access
set to different values -- likely not. Thus such information should either be communicated via "#access" ("ID_C_access") or with objects of proper type and API. Maybe it takes introducing java_typet
, but then this needs to propagate to, e.g., base_type_eq
.
efa5962
to
dbb9cfd
Compare
membert
has Booleansis_public
,is_private
andis_protected
. This was used, but not set infieldt
and set but not used inmethodt
.This also adds
ID_default
when no other flag is set, in Java this allows visibility in the package, but not subclasses outside the package (cf. https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html)