You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
UnnecessaryMethodReference gives a false-positive when variable is super.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
package test;
public class TestErrorProneSuper
{
public static class S
implements Closeable
{
@Override
public void close()
throws IOException
{
System.out.println("Closing S");
}
}
public static class T
extends S
{
Closer closer = Closer.create();
@Override
public void close() throws IOException
{
System.out.println("Closing T");
closer.register(super::close);
}
}
public static void main(String[] args)
{
try {
new T().close();
}
catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}
Gives false-positive:
TestErrorProneSuper.java:[44,29] [UnnecessaryMethodReference] This method reference is unnecessary, and can be replaced with the variable itself.
(see https://errorprone.info/bugpattern/UnnecessaryMethodReference)
Did you mean 'closer.register(super);'?
which is not correct (cannot pass super as a variable: TestErrorProneSuper.java:[44,34] '.' expected)
What version of Error Prone are you using?
2.5.0
Have you found anything relevant by searching the web?
Nope :)
The text was updated successfully, but these errors were encountered:
Description of the problem / feature request:
UnnecessaryMethodReference
gives a false-positive when variable issuper
.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Gives false-positive:
which is not correct (cannot pass super as a variable:
TestErrorProneSuper.java:[44,34] '.' expected
)What version of Error Prone are you using?
2.5.0
Have you found anything relevant by searching the web?
Nope :)
The text was updated successfully, but these errors were encountered: