diff --git a/java/java-tests/testData/inspection/redundantCast/lambda/CastToPrimitive.java b/java/java-tests/testData/inspection/redundantCast/lambda/CastToPrimitive.java new file mode 100644 index 000000000000..69f9684edbb0 --- /dev/null +++ b/java/java-tests/testData/inspection/redundantCast/lambda/CastToPrimitive.java @@ -0,0 +1,16 @@ + +import java.util.function.Consumer; + +class Program { + static T foo(Consumer c) { + c.accept(null); + return null; + } + + public static void main(String[] args) { + long l = (long)foo(x -> bar(x)); + } + + static void bar(Long x) { System.out.println(1);} + static void bar(Object x) { System.out.println(2); } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/java/codeInspection/RedundantCast18Test.java b/java/java-tests/testSrc/com/intellij/java/codeInspection/RedundantCast18Test.java index ff0591a4272e..f54cea75b53a 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInspection/RedundantCast18Test.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInspection/RedundantCast18Test.java @@ -48,4 +48,5 @@ public class RedundantCast18Test extends LightDaemonAnalyzerTestCase { public void testDiamondWithUpperBounds() { doTest();} public void testBinaryConversions() { doTest();} public void testInferenceIncompatibilityWithoutCast() { doTest();} + public void testCastToPrimitive() { doTest();} } \ No newline at end of file