From 0ed0e007eef817810015a372e1afb09a1c7764a5 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Tue, 5 May 2020 09:55:02 +0200 Subject: [PATCH] testdata for IDEA-157926 GitOrigin-RevId: 0227aa27f1329ae64011e737291f27338ed5a825 --- .../redundantCast/lambda/CastToPrimitive.java | 16 ++++++++++++++++ .../java/codeInspection/RedundantCast18Test.java | 1 + 2 files changed, 17 insertions(+) create mode 100644 java/java-tests/testData/inspection/redundantCast/lambda/CastToPrimitive.java 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