Skip to content
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

UnusedMethod no longer works #2215

Closed
anthonyvdotbe opened this issue Mar 4, 2021 · 2 comments
Closed

UnusedMethod no longer works #2215

anthonyvdotbe opened this issue Mar 4, 2021 · 2 comments

Comments

@anthonyvdotbe
Copy link
Contributor

Description of the problem / feature request:

UnusedMethod doesn't detect unused methods.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

  1. create a file Test.java with the following content:
class Test {
    private static void unusedStatic() {
    }

    private void unused() {
    }
}
  1. run ErrorProne (in this case, in PowerShell on Windows, with javac 15.0.1):
javac '-XDcompilePolicy=simple' '-processorpath' 'error_prone_core-2.5.1-with-dependencies.jar;dataflow-shaded-3.7.1.jar;jFormatString-3.0.0.jar' '-Xplugin:ErrorProne -Xep:DefaultPackage:OFF' Test.java
  1. no errors occur

What version of Error Prone are you using?

2.5.1

Have you found anything relevant by searching the web?

No.

@cushon
Copy link
Collaborator

cushon commented Mar 5, 2021

I don't think this is a regression, it has had a heuristic that looks for methods that start with "unused" since a17a68e. We treat that as a suppression mechanism that documents methods that are deliberately unused.

@anthonyvdotbe
Copy link
Contributor Author

anthonyvdotbe commented Mar 5, 2021

@cushon My bad, I just wanted to verify my Maven setup worked, and adding unused methods with these most original names was the first thing I came up with. I've filed a PR to document this mechanism.

@cushon cushon closed this as completed Mar 8, 2021
copybara-service bot pushed a commit that referenced this issue Mar 15, 2021
Closes #2215. Being unaware of this convention, I filed a bug report for what is in fact a feature. So documenting this would be helpful.

Fixes #2223

COPYBARA_INTEGRATE_REVIEW=#2223 from anthonyvdotbe:master 9471ef2
PiperOrigin-RevId: 362976622
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants