[java] The highest language level is now 22

Some tests are adjusted, as now (after unnamed variables release), we warn on every unused lambda parameter

GitOrigin-RevId: 17ce095a19332d22ba0cbcef1e6751ea309ca774
This commit is contained in:
Tagir Valeev
2024-03-14 15:01:17 +01:00
committed by intellij-monorepo-bot
parent 22f3891aa5
commit d4b107d27a
12 changed files with 18 additions and 13 deletions

View File

@@ -14,7 +14,7 @@ interface P<<warning descr="Type parameter 'T' is never used">T</warning>> {
class Test {
void foo(P p) {
p.subscribe(s -> {});
p.subscribe(<warning descr="Parameter 's' is never used">s</warning> -> {});
}
}

View File

@@ -4,7 +4,7 @@ import java.util.function.Function;
class Test {
{
transform(1, (String l) -> null);
transform(1, (String <warning descr="Parameter 'l' is never used">l</warning>) -> null);
}
public static <I, O> void transform(int input, Function<I, O> function) {

View File

@@ -12,6 +12,6 @@ abstract class PertinentToApplicabilityOfExplicitlyTypedLambdaTest {
abstract void foo(B b);
{
<error descr="Ambiguous method call: both 'PertinentToApplicabilityOfExplicitlyTypedLambdaTest.foo(A)' and 'PertinentToApplicabilityOfExplicitlyTypedLambdaTest.foo(B)' match">foo</error>(x -> y -> 42);
<error descr="Ambiguous method call: both 'PertinentToApplicabilityOfExplicitlyTypedLambdaTest.foo(A)' and 'PertinentToApplicabilityOfExplicitlyTypedLambdaTest.foo(B)' match">foo</error>(<warning descr="Parameter 'x' is never used">x</warning> -> <warning descr="Parameter 'y' is never used">y</warning> -> 42);
}
}

View File

@@ -4,7 +4,7 @@ import java.util.function.Predicate;
class Main {
{
new LinkedList<Object>().forEach((value)->{
new LinkedList<Object>().forEach((<warning descr="Parameter 'value' is never used">value</warning>)->{
new LinkedList<Object>().stream().filter((c)->{
return c == null;
});

View File

@@ -15,9 +15,9 @@ abstract class Test {
return x += 1;
});
<error descr="Ambiguous method call: both 'Test.foo(A)' and 'Test.foo(B)' match">foo</error>(x -> <error descr="Incompatible types. Found: 'int', required: '<lambda parameter>'">x += 1</error>);
foo(x -> 1);
foo(<warning descr="Parameter 'x' is never used">x</warning> -> 1);
foo(x -> <error descr="Operator '!' cannot be applied to 'int'">!x</error>);
<error descr="Ambiguous method call: both 'Test.foo(A)' and 'Test.foo(B)' match">foo</error>(x -> <error descr="Operator '++' cannot be applied to '<lambda parameter>'">++x</error>);
foo(x -> o instanceof String ? 1 : 0);
foo(<warning descr="Parameter 'x' is never used">x</warning> -> o instanceof String ? 1 : 0);
}
}