vscode-java
vscode-java copied to clipboard
Better quick fix to "Potential null pointer access": check if the variable is not null
I have the following code:
String s = null;
// do conditional stuff with "s"
s.length() // "Potential null pointer access" warning
Currently VS Code offers me 2 quick fixes:
- "Ignore compiler problem(s)"
- "Add @SuppressWarnings 'null' to myMethod"
A better quick fix option would be to add a "not nulll" check before the method calling.