在VS Code中声明了未使用的变量会有警告信息和绿色波浪线提示,强迫症看着难受。查了很多方法,终于找到解决方法:
https://*.com/questions/49667888/visual-studio-code-java-disable-serialversionuid-warning
Currently Java Support for VSCode reads a file called .settings/org.eclipse.jdt.core.prefs as part of its Eclipse project support. That’s a folder called .settings in the root folder of the project, then a file called org.eclipse.jdt.core.prefs in that folder.
In this file, we can suppress the serialVersionUID warning by adding the following line: org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
Now just restart VS Code, and those warnings will no longer show up.
参照这个方法,在org.eclipse.jdt.core.prefs文件中添加“org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore”解决问题!