You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"The value of the local variable XXXX is not used" throws error instead of warning #1404
changed the title [-]The value of the local variable XXXX is not used throws error instead of warning[/-][+]"The value of the local variable XXXX is not used" throws error instead of warning[/+]on Apr 21, 2020
No. You should have a .settings/ folder at the root of your project, containing Eclipse preference files (as Eclipse is used under the hood to provide Java support). It should be hidden by default, you can make it visible in vscode by adding this to your settings.json
Curious, the settings in this file, are we allowed to modify it? or is the content of this files autogenerated by vscode-java extension, and the values are derived from some other places, such that developers should not modify this file directly?
It might be nice to make a UI for the compiler settings now that we've set a precedent for this kind of thing in vscode-java, and the current "correct" way to do it is messy.
Anyways, here's my best explanation:
Check for a file .settings/org.eclipse.jdt.core.prefs in your project folder. If that file exists, then it will contain the compiler preferences. It's a file with key/value pairs, one per line, similar to Java .properties and Windows .ini files, with setting name as the key and value as the setting value.
Here's an example entry: org.eclipse.jdt.core.compiler.problem.forbiddenReference=error.
In the case mentioned here, you'd want to find the entry for "unused local variable" and change it from error to warn.
If that file doesn't exist in your project folder, there's a setting called java.import.generatesMetadataFilesAtProjectRoot which can be enabled to generate the file in your project folder. By default, vscode-java generates this configuration into a folder provided by VS Code for storing extension data to avoid cluttering the user's project, but disabling this feature makes it much easier to modify these files if that's what you want to do.
Activity
[-]The value of the local variable XXXX is not used throws error instead of warning[/-][+]"The value of the local variable XXXX is not used" throws error instead of warning[/+]fbricon commentedon Apr 21, 2020
Probably because your project is configured to report such problems as errors. Can you share you .settings/ folder?
hannah23280 commentedon Apr 21, 2020
Hi,
Thanks for the response. Do u mean the settings in the workspace file?
fbricon commentedon Apr 21, 2020
No. You should have a
.settings/folder at the root of your project, containing Eclipse preference files (as Eclipse is used under the hood to provide Java support). It should be hidden by default, you can make it visible in vscode by adding this to your settings.jsonhannah23280 commentedon Apr 21, 2020
Hi,
Yes. I can see the .settings folder. Inside contain a file called org.eclipse.buildship.core.prefs, whose content as shown below
Curious, the settings in this file, are we allowed to modify it? or is the content of this files autogenerated by vscode-java extension, and the values are derived from some other places, such that developers should not modify this file directly?
robstryker commentedon Oct 29, 2026
@datho7561 It would be good to document here in this issue how a user might override these settings.
datho7561 commentedon Oct 29, 2026
It might be nice to make a UI for the compiler settings now that we've set a precedent for this kind of thing in vscode-java, and the current "correct" way to do it is messy.
Anyways, here's my best explanation:
.settings/org.eclipse.jdt.core.prefsin your project folder. If that file exists, then it will contain the compiler preferences. It's a file with key/value pairs, one per line, similar to Java.propertiesand Windows.inifiles, with setting name as the key and value as the setting value.Here's an example entry:
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error.In the case mentioned here, you'd want to find the entry for "unused local variable" and change it from
errortowarn.In the case you can't find the relevant setting being set in the file, you can reference the complete list of compiler settings here: https://github.com/eclipse-jdt/eclipse.jdt.core/blob/1d9ec5242bd76a8dfebbf3f896de97583d448cf2/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java#L173 . Unfortunately, that's the only spot I can think of where the full list is documented for the time being.
java.import.generatesMetadataFilesAtProjectRootwhich can be enabled to generate the file in your project folder. By default, vscode-java generates this configuration into a folder provided by VS Code for storing extension data to avoid cluttering the user's project, but disabling this feature makes it much easier to modify these files if that's what you want to do.