eclipse-jdt / eclipse-jdt/eclipse.jdt.core

Bug 195757 - Missing redundant null check in if condition through ternary operator

Open
#3,990 1 comment 0 reactions 1 assignee Claimed by @mpalat View on GitHub
null
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

From https://bugs.eclipse.org/bugs/show_bug.cgi?id=195757

```java
public class X {

boolean test() {
return true;
}

int foo() {
if ((test() ? null : null) == null)
return 1;
return 0;
}

// more complex

int bar() {
String s = null;
if ((test() ? s : null) == null)
return 1;
return 0;
}
}
```
In both case, a "redundant null check" should be reported.

For initial discussion see bugzilla.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.