Community
Participate
Working Groups
3.4 M5 The following test case, which I suggest we add to OptionTests, fails on the second assertion: public void test13_immutable_option() { Hashtable options = JavaCore.getDefaultOptions(); String immutableValue = (String) options.get(JavaCore.CORE_ENCODING); assertEquals(ResourcesPlugin.getEncoding(), immutableValue); // ok options.put(JavaCore.CORE_ENCODING, immutableValue + "_extra_tail"); JavaCore.setOptions(options); assertEquals(immutableValue, JavaCore.getOptions().get(JavaCore.CORE_ENCODING)); // ko } I cannot really relate the 'immutable' term in the javadoc to the observed behavior. I would suggest that the doc be explained further (what do we mean by immutable?) and that the behavior be fixed (while modifying the map in client code is unavoidable and OK anyway, JavaCore.getOptions().get(JavaCore.CORE_ENCODING) should always return the same value as ResourcesPlugin.getEncoding()).
If the user modifies the value, then it cannot expect it to be equal to the ResourcesPlugin.getEncoding() value. Closing as INVALID. Please reopen if you disagree.
Sorry. Reopen. The value of this option should not be changed.
The problem comes from the cached value set in the JavaModelManager.setOptions(HashTable) call. CORE_ENCODING option is properly skipped, but the value of the given table is not reset for this key.
Created attachment 142181 [details] Proposed fix + regression test
Released for 3.6M1. Regression test added in org.eclipse.jdt.core.tests.model.OptionTests#test13
Verified for 3.6M1 by code inspection and regression test verification.