Skip to content

Commit

Permalink
Missing code implementation (eclipse-jdt#2342)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephan-herrmann authored Apr 14, 2024
1 parent ed670e7 commit edd371e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6422,6 +6422,8 @@ else if (expr instanceof CastExpression)
return false;
}
// fall through to bottom
} else if (expr instanceof LambdaExpression) {
// not very useful code, but humor the user
} else {
needImplementation(expr); // want to see if we get here
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18737,4 +18737,31 @@ class Bar{}
----------
""");
}
public void testGH1755() {
runNegativeTest(
new String[] {
"X.java",
"""
import java.util.function.Supplier;

public class X {
public static void main(String[] args) {
String a = "Hello";
if (((Supplier<String>) () -> a) instanceof Supplier)
System.out.print("yes");
if (((Supplier<String>) () -> a) != null)
System.out.print("yes");
}
}
"""
},
"""
----------
1. ERROR in X.java (at line 8)
if (((Supplier<String>) () -> a) != null)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Redundant null check: this expression cannot be null
----------
""");
}
}

0 comments on commit edd371e

Please sign in to comment.