-
-
Notifications
You must be signed in to change notification settings - Fork 710
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
fix UnitBox memory leak in UCE #1655
base: develop
Are you sure you want to change the base?
Conversation
@swissiety can you review this? |
|
||
// Assert that the set of boxes obtained from all units equals the set | ||
// obtained by checking Unit#getBoxesPointingToThis() on all units. | ||
Assert.assertEquals(new HashSet<>(getAllUnitBoxes(body)), new HashSet<>(getAllBoxesPointingToUnits(body))); |
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 assert that the transformer changed sth i.e. removed the trap
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.
done.
UnitBox beginBox = trap.getBeginUnitBox(); | ||
UnitBox endBox = trap.getEndUnitBox(); | ||
UnitBox handlerBox = trap.getHandlerUnitBox(); | ||
if ((beginBox.getUnit() == endBox.getUnit()) || !reachable.contains(handlerBox.getUnit())) { |
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 restructure the UnitBox assignments inside the if block so the assignments are just executed when needed
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 don't think any improvement can be made. The first two (beginBox and endBox) will always be used since they are in the first condition. The final variable (handlerBox) will always be used as well. If the first condition is true, it will be used inside the if statement body and if the first condition is false, it will be used in the second condition (and possibly again inside the body).
This ensures the trap was actually removed as expected. Also, rename the test method to something more meaningful.
No description provided.