Closed
Description
Using error-prone 2.10.0.
Here's a trivial example of a record where I get a warning that the x
value is never being used, even though there are public methods that access it both directly and via its getter.
public class Example
{
private static record MyRecord(int x) { }
public static int testMethod1(int x) {
return new MyRecord(x).x();
}
public static int testMethod2(int x) {
return new MyRecord(x).x;
}
}
Example.java:[3,12] [UnusedVariable] The parameter 'x' is never read.
I don't know the exact conditions that trigger this, but for example if I make the record itself public
the warning goes away.
Metadata
Metadata
Assignees
Labels
No labels