My java code has these error squiggles. What do they mean and how do I disable them?
Mouse Over Drop Down 1
Mouse Over Drop Down 2
What do these mean? What does the software suggest me to do?
PS: I'm a complete newb
CodePudding user response:
Hints, no error. For proposing code changes, and SonarLint: code style warnings.
Here it suggests (wrongly so) to replace System.out by a shorter final PrintWriter, say out
, so you need only to use out.println(...)
. That is not normally done.
But a similar rule states that one should use a Logger instead.
For the main: new Hello().execute();
and then in a separate non-static method (execute
) do the code you wrote in main
.
SonarLint: code style checker, named after the C lint tool to find "lint" in the code, dubious code pieces, like unitialized variables, dangerous lossy conversions and such.
Writing to System.out (the console) is not good style in a web server or a GUI desktop application, hence the advice is to use a Logger for logging interesting information, possibly to the console, but also possibly to a log file.
You should especially as a beginner not disable the linting extension. Ignore the squiggles, only from time to time look at them. One can also disable specific SonarLint rules one finds dumb.
CodePudding user response:
I disabled the extension "Language Support for Java(TM) by Red Hat" . This was the extension that did the code linting. Now the squiggles are gone.