We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Returning null through a ternary operator does not give Type mismatch error. It should.
null
Code 1:
public double getValue() { return null; }
null is error-underlined with the error [Java] Type mismatch: cannot convert from null to double.
[Java] Type mismatch: cannot convert from null to double
Code 2:
public double getValue() { return value == null ? null : Double.parseDouble(value); }
No errors shown on the returned null.
Code 3:
public double getValue() { if (value == null) return null; else return Double.parseDouble(value); }
Same error:
Code 1 & 3 shows error. Code 2 doesn't.
All Code blocks should show error.
Please let me know if you need any logs or anything.
The text was updated successfully, but these errors were encountered:
This is a known bug in the jdt compiler: https://bugs.eclipse.org/bugs/show_bug.cgi?id=416815
Sorry, something went wrong.
Since 2013? 😮
No branches or pull requests
Returning
nullthrough a ternary operator does not give Type mismatch error. It should.Code 1:
nullis error-underlined with the error[Java] Type mismatch: cannot convert from null to double.Code 2:
No errors shown on the returned

null.Code 3:
Same error:

Environment
Steps To Reproduce
Current Result
Code 1 & 3 shows error. Code 2 doesn't.
Expected Result
All Code blocks should show error.
Additional Information
Please let me know if you need any logs or anything.
The text was updated successfully, but these errors were encountered: