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

UnusedVariable false positive on private record class #3495

Closed
olsavmic opened this issue Oct 17, 2022 · 2 comments
Closed

UnusedVariable false positive on private record class #3495

olsavmic opened this issue Oct 17, 2022 · 2 comments

Comments

@olsavmic
Copy link

Following code reports:

[WARNING] /Users/michael/Dev/Work/error-prone-testing/src/main/java/org/example/Main.java:[16,13] [UnusedVariable] The parameter 'value' is never read. (see https://errorprone.info/bugpattern/UnusedVariable)

class Main
{

    public static void main(String[] args)
    {
        var data = new Data(10);
        data.value();
    }

    private record Data(
        int value
    )
    {

    }

}

Changing the record visibility to package-private solves the issue but is not optimal.

com.google.errorprone.error_prone_core: 2.16
JDK 17, source & target 17

@tbroyer
Copy link
Contributor

tbroyer commented Oct 17, 2022

AFAICT this is a duplicate of #2713

@olsavmic
Copy link
Author

Thanks, I was somehow not able to find it, closing in favor of the existing one :)

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

No branches or pull requests

2 participants