rpau / javalang-compiler

Java compiler elements (symbol and type tables) to perform code semantic analysis
GNU Lesser General Public License v3.0
10 stars 4 forks source link

MethodDeclaration.usages should include usages by lambdas #76

Closed pleschev closed 6 years ago

pleschev commented 6 years ago

I have previously raised https://github.com/walkmod/walkmod-dead-code-cleaner-plugin/issues/4 where code was incorrectly deleted because classes & methods that were being used in lambdas were incorrectly being identified as unused. The dead code cleaner plugin uses MethodDeclaration.usages to determine whether a method is in use or not. This list is not being populated with usages from lambdas.

pleschev commented 6 years ago

I have created a test case that recreates the problem. Please see PR#77

Any guidance on how to fix the problem would be much appreciated

rpau commented 6 years ago

Fixed here: https://github.com/rpau/javalang-compiler/pull/78

pleschev commented 6 years ago

Thank you for fixing this! I've raised #79 which is a similar corner case,