aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-05-15 09:36:47 -0400
committerAlexander Kurtakov2018-05-15 09:36:47 -0400
commitd25253b5d2e2fe83132ac8296ae8abadea1d231f (patch)
tree4d8bbd2d63856c86a901ad2ddd5f951ce68404d7
parentfd57f9ef289f97629c92440c689b75ca3c39a2d5 (diff)
downloadrt.equinox.bundles-d25253b5d2e2fe83132ac8296ae8abadea1d231f.tar.gz
rt.equinox.bundles-d25253b5d2e2fe83132ac8296ae8abadea1d231f.tar.xz
rt.equinox.bundles-d25253b5d2e2fe83132ac8296ae8abadea1d231f.zip
Bug 444188 - EclipsePreferences is not thread safeI20180515-1300I20180515-0950
Enable save actions so import warnings and etc. doesn't happen again. Change-Id: Ib2bc0f90011d0a4614cc6f7fa4c723da0f9716a3 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.preferences.tests/.settings/org.eclipse.jdt.ui.prefs60
-rw-r--r--bundles/org.eclipse.equinox.preferences.tests/src/org/eclipse/equinox/preferences/tests/EclipsePreferencesTest.java24
2 files changed, 73 insertions, 11 deletions
diff --git a/bundles/org.eclipse.equinox.preferences.tests/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.preferences.tests/.settings/org.eclipse.jdt.ui.prefs
index a970245b..00f83add 100644
--- a/bundles/org.eclipse.equinox.preferences.tests/.settings/org.eclipse.jdt.ui.prefs
+++ b/bundles/org.eclipse.equinox.preferences.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -1,3 +1,61 @@
-#Mon Dec 15 14:14:24 EET 2008
eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=true
+sp_cleanup.convert_to_enhanced_for_loop=true
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_modifiers=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.preferences.tests/src/org/eclipse/equinox/preferences/tests/EclipsePreferencesTest.java b/bundles/org.eclipse.equinox.preferences.tests/src/org/eclipse/equinox/preferences/tests/EclipsePreferencesTest.java
index accbd2dc..1089e976 100644
--- a/bundles/org.eclipse.equinox.preferences.tests/src/org/eclipse/equinox/preferences/tests/EclipsePreferencesTest.java
+++ b/bundles/org.eclipse.equinox.preferences.tests/src/org/eclipse/equinox/preferences/tests/EclipsePreferencesTest.java
@@ -30,23 +30,25 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChange
import org.junit.After;
import org.junit.Test;
import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
/**
* Test suite for class org.eclipse.core.internal.preferences.EclipsePreferences
- * WARNING: many tests are still located in org.eclipse.core.tests.internal.preferences.EclipsePreferencesTest from eclipse.platform.runtime
+ * WARNING: many tests are still located in
+ * org.eclipse.core.tests.internal.preferences.EclipsePreferencesTest from
+ * eclipse.platform.runtime
*/
public class EclipsePreferencesTest {
- /**
+ /**
* Concurrent access to listener collection should not lead to exceptions
+ *
* @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=444188
*/
@Test
public void testConcurrentPreferenceChangeListener() throws InterruptedException, CoreException {
final IEclipsePreferences node = createTestNode();
final int runSize = 100000;
-
+
executeInTwoThreads(new ICoreRunnable() {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
@@ -65,8 +67,9 @@ public class EclipsePreferencesTest {
});
}
- /**
+ /**
* Concurrent access to listener collection should not lead to exceptions
+ *
* @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=444188
*/
@Test
@@ -91,7 +94,8 @@ public class EclipsePreferencesTest {
try {
node.node(Thread.currentThread().getName()).removeNode(); // Should not throw
} catch (BackingStoreException e) {
- throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.core.tests.runtime", 0, "", null));
+ throw new CoreException(
+ new Status(IStatus.ERROR, "org.eclipse.core.tests.runtime", 0, "", null));
}
node.removeNodeChangeListener(listener); // Should not throw
}
@@ -111,7 +115,7 @@ public class EclipsePreferencesTest {
job.schedule();
try {
latch.await();
- runnable.run(new NullProgressMonitor());
+ runnable.run(new NullProgressMonitor());
} finally {
job.cancel();
job.join();
@@ -122,12 +126,12 @@ public class EclipsePreferencesTest {
}
}
}
-
+
@After
public void after() throws BackingStoreException {
getScopeRoot().removeNode();
}
-
+
private static String getUniqueString() {
return System.currentTimeMillis() + "-" + Math.random();
}
@@ -135,7 +139,7 @@ public class EclipsePreferencesTest {
private static IEclipsePreferences createTestNode() {
return (IEclipsePreferences) getScopeRoot().node(getUniqueString());
}
-
+
private static IEclipsePreferences getScopeRoot() {
return (IEclipsePreferences) Platform.getPreferencesService().getRootNode().node("EclipsePreferencesTest");
}