Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/redundantCast/InvalidConditional.java
Anna Kozlova 78891be4bb java redundant cast: cleanup: extract conditional
GitOrigin-RevId: ca95c0e70c197e27943596e91df8d526bbfbf1bb
2020-05-11 08:33:17 +00:00

20 lines
630 B
Java

import java.util.function.Function;
class Main {
public static void main(String[] args) {
Test test = new Test();
((Function<String, Long>)(args.length == 2 ? (<error descr="Method reference expression is not expected here">test::foo</error>) : <error descr="Method reference expression is not expected here">test::bar</error>)).apply("");
String s = ((<warning descr="Casting '(test != null)' to 'boolean' is redundant">boolean</warning>) (test != null)) ? "a" : "b";
}
static class Test {
public long foo(String s) {
return 0;
}
public long bar(String s) {
return 0;
}
}
}