Open NikitashP opened 3 years ago
@mkr-plse Will unused variables caused due to the refactoring also be removed by this change ?
When the two pass analysis is implemented, unused variables will also be handled. We don't have a timeline for the two pass analysis though.
@mkr-plse hi after reading this blog from uber https://eng.uber.com/piranha/ it says
Delete code that becomes unreachable due to performing the previous step. We refer to this as deep cleaning.
Does this quote mean piranha implements dep cleaning or I need to run tools like proguard
?
I think the question is related to this issue so I'm posting it here. thanks for help
Other variants of Piranha (Swift, JS) have already implemented some form of deep cleaning. AFAIK, Proguard may be able to delete the deadcode from bytecode but not from source. We expect to add this feature to PiranhaJava. Unfortunately, we haven't yet gotten to this milestone yet.
@NikitashP Looks like the milestone hasn't been implemented yet. What workaround did you choose to enable such refactoring?
After the Feature Flag clean-up, another round of dead code clean-up using ErrorProne works. The clean up is not Targetting "only" the Feature Flag clean-up left overs, that is an issue. In the end with or without Feature Flag clean up you don't want dead code on master so can justify it that way.
-Xplugin:ErrorProne -XepPatchChecks:UnusedMethod,UnusedNestedClass,UnusedAnonymousClass,RemoveUnusedImports,DeadException,DeadThread,UnusedCollectionModifiedInPlace -XepPatchLocation:IN_PLACE
The un-referenced methods inside the code Piranha cleaned up is not removed. I was hoping the code which is no more referenced after clean up (dummyMethod in below example) will also be removed and hence a deep cleanup.
Before:
After: