-
Notifications
You must be signed in to change notification settings - Fork 37
Fix local objects detector #422
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
f.isEnumConstant || | ||
f.name == "serialVersionUID" | ||
) return@traverseObjectGraph null | ||
if (f.isEnumConstant || f.name == "serialVersionUID") |
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.
Please always use brackets when the return
statement is not on the same line
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 PR looks good, please address the only minor comment and rebase when #420 is merged
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
77cc10b
to
55a6833
Compare
This PR changes our approach to the local objects tracking.
Current approach maintains a map
LocalObject -> List<LocalObject>
, which for each local object stores a list of objects immediately reachable from it (via its fields). This map is used to compute a set of local objects reachable from another given local object. Once a local object is assigned to a field of non-local object, all reachable objects are marked as non-local.The problem with this approach is that it is error prone and requires a lot of efforts to maintain the map in the correct state. If the map is not maintained in the correct state, some objects might be incorrectly classified as local (see new test added in this PR).
So instead, in this PR we implement an alternative approach. We still maintain a set of local objects, however when we need to compute a set of objects reachable from given one, we instead traverse the object graph using the utility function.
Thus there is no need to maintain a separate data structure approximating reachable objects.
This PR also should help with #415 , as it would be much more easier to just traverse all objects reachable from the given
Thread
objects once it starts, and mark them as non-local.Note this PR depends on PR #420 , so we first need to merge it, and then rebase.