False positive: UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS
clo-vis opened this issue · comments
Clovis commented
import java.util.stream.Stream;
class Test {
public static void main(String[] args) {
record Foo(int a) {
int aPlus1() {
return a + 1;
}
int aPlus2() {
return a + 2;
}
}
var foo = new Foo(1);
Stream.of(foo).mapToInt(Foo::aPlus1).forEach(System.out::println);
Stream.of(foo).mapToInt(r -> r.aPlus2()).forEach(System.out::println);
}
}
Warning: Uncallable method Test$1Foo.aPlus1() defined in anonymous class [Scary(5), High confidence]
But:
- There is no anonymous class (all classes in the example have a name)
- Both methods aPlus2 and aPlus1 are callable and are called.