Code cleanup: fixed all remaining (generics) warnings

Also set compiler warnings and save actions accordingly.

Bug: 470699
Change-Id: I00b3d088bc840fa4ea19ed6915ef687a333af3c9
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
diff --git a/bundles/org.eclipse.equinox.preferences/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.preferences/.settings/org.eclipse.jdt.core.prefs
index 8671401..f8dadf7 100644
--- a/bundles/org.eclipse.equinox.preferences/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.preferences/.settings/org.eclipse.jdt.core.prefs
@@ -6,7 +6,14 @@
 org.eclipse.jdt.core.circularClasspath=error
 org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
 org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
 org.eclipse.jdt.core.compiler.compliance=1.7
@@ -18,17 +25,23 @@
 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
 org.eclipse.jdt.core.compiler.problem.deprecation=warning
 org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
 org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
 org.eclipse.jdt.core.compiler.problem.discouragedReference=error
 org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
 org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
 org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
 org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
 org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
 org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
 org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
 org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
@@ -36,7 +49,10 @@
 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
 org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
 org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
 org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
 org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
@@ -46,19 +62,37 @@
 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
 org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
 org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
 org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
 org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
 org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
 org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
 org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
 org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
 org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
 org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
 org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
 org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
 org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
@@ -66,13 +100,21 @@
 org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
 org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
 org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
 org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
 org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
 org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
 org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
 org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
 org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
 org.eclipse.jdt.core.compiler.source=1.7
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
diff --git a/bundles/org.eclipse.equinox.preferences/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.preferences/.settings/org.eclipse.jdt.ui.prefs
index 4e8e46e..0fcb124 100644
--- a/bundles/org.eclipse.equinox.preferences/.settings/org.eclipse.jdt.ui.prefs
+++ b/bundles/org.eclipse.equinox.preferences/.settings/org.eclipse.jdt.ui.prefs
@@ -1,4 +1,3 @@
-#Tue Aug 21 11:31:47 CDT 2007
 eclipse.preferences.version=1
 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
 formatter_profile=_core
@@ -12,23 +11,29 @@
 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=false
 sp_cleanup.convert_to_enhanced_for_loop=false
 sp_cleanup.correct_indentation=false
 sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=true
+sp_cleanup.insert_inferred_type_arguments=false
 sp_cleanup.make_local_variable_final=false
 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=true
 sp_cleanup.never_use_blocks=false
 sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=false
+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
@@ -36,12 +41,13 @@
 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_trailing_whitespaces=false
+sp_cleanup.remove_redundant_type_arguments=false
+sp_cleanup.remove_trailing_whitespaces=true
 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=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
@@ -49,10 +55,13 @@
 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=false
 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
+sp_cleanup.use_type_arguments=false
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/Activator.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/Activator.java
index fcf4021..5d51d7f 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/Activator.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/Activator.java
@@ -23,7 +23,7 @@
 /**
  * The Preferences bundle activator.
  */
-public class Activator implements BundleActivator, ServiceTrackerCustomizer {
+public class Activator implements BundleActivator, ServiceTrackerCustomizer<Object, Object> {
 
 	public static final String PI_PREFERENCES = "org.eclipse.equinox.preferences"; //$NON-NLS-1$
 
@@ -39,7 +39,7 @@
 	 * Track the registry service - only register preference service if the registry is
 	 * available
 	 */
-	private ServiceTracker registryServiceTracker;
+	private ServiceTracker<?, ?> registryServiceTracker;
 
 	/**
 	 * The bundle associated this plug-in
@@ -49,12 +49,12 @@
 	/**
 	 * This plugin provides a Preferences service.
 	 */
-	private ServiceRegistration preferencesService = null;
+	private ServiceRegistration<IPreferencesService> preferencesService;
 
 	/**
 	 * This plugin provides the OSGi Preferences service.
 	 */
-	private ServiceRegistration osgiPreferencesService = null;
+	private ServiceRegistration<org.osgi.service.prefs.PreferencesService> osgiPreferencesService;
 
 
 	@Override
@@ -66,11 +66,11 @@
 
 		boolean shouldRegister = !"false".equalsIgnoreCase(context.getProperty(PROP_REGISTER_PERF_SERVICE)); //$NON-NLS-1$
 		if (shouldRegister) {
-			preferencesService = bundleContext.registerService(IPreferencesService.class.getName(), PreferencesService.getDefault(), new Hashtable());
-			osgiPreferencesService = bundleContext.registerService(org.osgi.service.prefs.PreferencesService.class.getName(), new OSGiPreferencesServiceManager(bundleContext), null);
+			preferencesService = bundleContext.registerService(IPreferencesService.class, PreferencesService.getDefault(), new Hashtable<String, Object>());
+			osgiPreferencesService = bundleContext.registerService(org.osgi.service.prefs.PreferencesService.class, new OSGiPreferencesServiceManager(bundleContext), null);
 		}
 		// use the string for the class name here in case the registry isn't around
-		registryServiceTracker = new ServiceTracker(bundleContext, "org.eclipse.core.runtime.IExtensionRegistry", this); //$NON-NLS-1$
+		registryServiceTracker = new ServiceTracker<>(bundleContext, "org.eclipse.core.runtime.IExtensionRegistry", this); //$NON-NLS-1$
 		registryServiceTracker.open();
 	}
 
@@ -99,7 +99,7 @@
 
 
 	@Override
-	public synchronized Object addingService(ServiceReference reference) {
+	public synchronized Object addingService(ServiceReference<Object> reference) {
 		Object service = bundleContext.getService(reference);
 		// this check is important as it avoids early loading of PreferenceServiceRegistryHelper and allows
 		// this bundle to operate with out necessarily resolving against the registry
@@ -125,13 +125,13 @@
 
 
 	@Override
-	public void modifiedService(ServiceReference reference, Object service) {
+	public void modifiedService(ServiceReference<Object> reference, Object service) {
 		// nothing to do
 	}
 
 
 	@Override
-	public synchronized void removedService(ServiceReference reference, Object service) {
+	public synchronized void removedService(ServiceReference<Object> reference, Object service) {
 		PreferencesService.getDefault().setRegistryHelper(null);
 		bundleContext.ungetService(reference);
 	}
@@ -148,9 +148,9 @@
 			return;
 		}
 
-		ServiceTracker environmentTracker = new ServiceTracker(bundleContext, EnvironmentInfo.class.getName(), null);
+		ServiceTracker<?, EnvironmentInfo> environmentTracker = new ServiceTracker<>(bundleContext, EnvironmentInfo.class, null);
 		environmentTracker.open();
-		EnvironmentInfo environmentInfo = (EnvironmentInfo) environmentTracker.getService();
+		EnvironmentInfo environmentInfo = environmentTracker.getService();
 		environmentTracker.close();
 		if (environmentInfo == null)
 			return;
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/BundleDefaultPreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/BundleDefaultPreferences.java
index 9ec2427..34339a4 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/BundleDefaultPreferences.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/BundleDefaultPreferences.java
@@ -27,7 +27,7 @@
  */
 public class BundleDefaultPreferences extends EclipsePreferences {
 
-	private static Set loadedNodes = Collections.synchronizedSet(new HashSet());
+	private static Set<String> loadedNodes = Collections.synchronizedSet(new HashSet<String>());
 	private String qualifier;
 	private int segmentCount;
 	private IEclipsePreferences loadLevel;
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ConfigurationPreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ConfigurationPreferences.java
index 09a9b10..ae6d6e9 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ConfigurationPreferences.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ConfigurationPreferences.java
@@ -28,7 +28,7 @@
 	private IPath location;
 	private IEclipsePreferences loadLevel;
 	// cache which nodes have been loaded from disk
-	private static Set loadedNodes = Collections.synchronizedSet(new HashSet());
+	private static Set<String> loadedNodes = Collections.synchronizedSet(new HashSet<String>());
 	private static boolean initialized = false;
 	private static IPath baseLocation;
 
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/DefaultPreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/DefaultPreferences.java
index c566a6f..31bf945 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/DefaultPreferences.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/DefaultPreferences.java
@@ -33,7 +33,7 @@
  */
 public class DefaultPreferences extends EclipsePreferences {
 	// cache which nodes have been loaded from disk
-	private static Set loadedNodes = Collections.synchronizedSet(new HashSet());
+	private static Set<String> loadedNodes = Collections.synchronizedSet(new HashSet<String>());
 	private static final String KEY_PREFIX = "%"; //$NON-NLS-1$
 	private static final String KEY_DOUBLE_PREFIX = "%%"; //$NON-NLS-1$
 	private static final IPath NL_DIR = new Path("$nl$"); //$NON-NLS-1$
@@ -48,7 +48,7 @@
 	// cached values
 	private String qualifier;
 	private int segmentCount;
-	private WeakReference pluginReference;
+	private WeakReference<Object> pluginReference;
 
 	public static String pluginCustomizationFile = null;
 
@@ -61,7 +61,7 @@
 
 	private DefaultPreferences(EclipsePreferences parent, String name, Object context) {
 		this(parent, name);
-		this.pluginReference = new WeakReference(context);
+		this.pluginReference = new WeakReference<>(context);
 	}
 
 	private DefaultPreferences(EclipsePreferences parent, String name) {
@@ -118,7 +118,7 @@
 	 * 	key=value
 	 */
 	private void applyDefaults(String id, Properties defaultValues, Properties translations) {
-		for (Enumeration e = defaultValues.keys(); e.hasMoreElements();) {
+		for (Enumeration<?> e = defaultValues.keys(); e.hasMoreElements();) {
 			String fullKey = (String) e.nextElement();
 			String value = defaultValues.getProperty(fullKey);
 			if (value == null)
@@ -150,7 +150,7 @@
 	private boolean containsNode(Properties props, IPath path) {
 		if (props == null)
 			return false;
-		for (Enumeration e = props.keys(); e.hasMoreElements();) {
+		for (Enumeration<?> e = props.keys(); e.hasMoreElements();) {
 			String fullKey = (String) e.nextElement();
 			if (props.getProperty(fullKey) == null)
 				continue;
@@ -182,9 +182,9 @@
 		if (productCustomization == null) {
 			BundleContext context = Activator.getContext();
 			if (context != null) {
-				ServiceTracker productTracker = new ServiceTracker(context, IProductPreferencesService.class.getName(), null);
+				ServiceTracker<?, IProductPreferencesService> productTracker = new ServiceTracker<>(context, IProductPreferencesService.class, null);
 				productTracker.open();
-				IProductPreferencesService productSpecials = (IProductPreferencesService) productTracker.getService();
+				IProductPreferencesService productSpecials = productTracker.getService();
 				if (productSpecials != null) {
 					productCustomization = productSpecials.getProductCustomization();
 					productTranslation = productSpecials.getProductTranslation();
@@ -219,7 +219,7 @@
 	 * extension to the plug-in default customizer extension point.
 	 */
 	private void applyRuntimeDefaults() {
-		WeakReference ref = PreferencesService.getDefault().applyRuntimeDefaults(name(), pluginReference);
+		WeakReference<Object> ref = PreferencesService.getDefault().applyRuntimeDefaults(name(), pluginReference);
 		if (ref != null)
 			pluginReference = ref;
 	}
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
index 9482329..9016cb5 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
@@ -13,6 +13,7 @@
 
 import java.io.*;
 import java.util.*;
+import java.util.Map.Entry;
 import org.eclipse.core.internal.runtime.RuntimeLog;
 import org.eclipse.core.runtime.*;
 import org.eclipse.core.runtime.preferences.*;
@@ -49,11 +50,11 @@
 
 	private String cachedPath;
 	protected ImmutableMap properties = ImmutableMap.EMPTY;
-	protected Map children;
+	protected Map<String, Object> children;
 	/**
 	 * Protects write access to properties and children.
 	 */
-	private Object childAndPropertyLock = new Object();
+	private final Object childAndPropertyLock = new Object();
 	protected boolean dirty = false;
 	protected boolean loading = false;
 	protected final String name;
@@ -86,25 +87,25 @@
 
 
 		@Override
-		public synchronized Enumeration keys() {
-			TreeSet set = new TreeSet();
-			for (Enumeration e = super.keys(); e.hasMoreElements();)
+		public synchronized Enumeration<Object> keys() {
+			TreeSet<Object> set = new TreeSet<>();
+			for (Enumeration<?> e = super.keys(); e.hasMoreElements();)
 				set.add(e.nextElement());
 			return Collections.enumeration(set);
 		}
 
 
 		@Override
-		public Set entrySet() {
-			TreeSet set = new TreeSet(new Comparator() {
+		public Set<Entry<Object, Object>> entrySet() {
+			TreeSet<Entry<Object, Object>> set = new TreeSet<>(new Comparator<Entry<Object, Object>>() {
 				@Override
-				public int compare(Object e1, Object e2) {
-					String s1 = (String) ((Map.Entry) e1).getKey();
-					String s2 = (String) ((Map.Entry) e2).getKey();
+				public int compare(Entry<Object, Object> e1, Entry<Object, Object> e2) {
+					String s1 = (String) e1.getKey();
+					String s2 = (String) e2.getKey();
 					return s1.compareTo(s2);
 				}
 			});
-			for (Iterator i = super.entrySet().iterator(); i.hasNext();)
+			for (Iterator<Entry<Object, Object>> i = super.entrySet().iterator(); i.hasNext();)
 				set.add(i.next());
 			return set;
 		}
@@ -153,7 +154,7 @@
 		//Thread safety: synchronize method to protect modification of children field
 		synchronized (childAndPropertyLock) {
 			if (children == null)
-				children = Collections.synchronizedMap(new HashMap());
+				children = Collections.synchronizedMap(new HashMap<String, Object>());
 			children.put(childName, child == null ? (Object) childName : child);
 			return child;
 		}
@@ -217,7 +218,7 @@
 		synchronized (childAndPropertyLock) {
 			if (children == null || children.size() == 0)
 				return EMPTY_STRING_ARRAY;
-			return (String[]) children.keySet().toArray(EMPTY_STRING_ARRAY);
+			return children.keySet().toArray(EMPTY_STRING_ARRAY);
 		}
 	}
 
@@ -242,7 +243,7 @@
 		if (root == null)
 			return EMPTY_STRING_ARRAY;
 		IPath dir = root.append(DEFAULT_PREFERENCES_DIRNAME);
-		final ArrayList result = new ArrayList();
+		final ArrayList<String> result = new ArrayList<>();
 		final String extension = '.' + PREFS_FILE_EXTENSION;
 		File file = dir.toFile();
 		File[] totalFiles = file.listFiles();
@@ -257,7 +258,7 @@
 				}
 			}
 		}
-		return (String[]) result.toArray(EMPTY_STRING_ARRAY);
+		return result.toArray(EMPTY_STRING_ARRAY);
 	}
 
 	protected IPath computeLocation(IPath root, String qualifier) {
@@ -274,7 +275,7 @@
 			// ignore for now
 		}
 		table.remove(VERSION_KEY);
-		for (Iterator i = table.keySet().iterator(); i.hasNext();) {
+		for (Iterator<?> i = table.keySet().iterator(); i.hasNext();) {
 			String fullKey = (String) i.next();
 			String value = table.getProperty(fullKey);
 			if (value != null) {
@@ -528,14 +529,14 @@
 	 * Thread safe way to obtain all children of this node. Never returns null.
 	 */
 	protected IEclipsePreferences[] getChildren(boolean create) {
-		ArrayList result = new ArrayList();
+		ArrayList<IEclipsePreferences> result = new ArrayList<>();
 		String[] names = internalChildNames();
 		for (int i = 0; i < names.length; i++) {
 			IEclipsePreferences child = getChild(names[i], null, create);
 			if (child != null)
 				result.add(child);
 		}
-		return (IEclipsePreferences[]) result.toArray(EMPTY_NODE_ARRAY);
+		return result.toArray(EMPTY_NODE_ARRAY);
 	}
 
 
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/InstancePreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/InstancePreferences.java
index 485cb07..84f4b0f 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/InstancePreferences.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/InstancePreferences.java
@@ -29,7 +29,7 @@
 	private IEclipsePreferences loadLevel;
 	private IPath location;
 	// cache which nodes have been loaded from disk
-	private static Set loadedNodes = Collections.synchronizedSet(new HashSet());
+	private static Set<String> loadedNodes = Collections.synchronizedSet(new HashSet<String>());
 	private static boolean initialized = false;
 	private static IPath baseLocation;
 
@@ -145,7 +145,7 @@
 		}
 
 		// Store values in the preferences object
-		for (Iterator i = values.keySet().iterator(); i.hasNext();) {
+		for (Iterator<?> i = values.keySet().iterator(); i.hasNext();) {
 			String key = (String) i.next();
 			String value = values.getProperty(key);
 			// value shouldn't be null but check just in case...
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/OSGiPreferencesServiceManager.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/OSGiPreferencesServiceManager.java
index 6bbfca0..4191fc8 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/OSGiPreferencesServiceManager.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/OSGiPreferencesServiceManager.java
@@ -28,7 +28,7 @@
  * Also deletes saved preferences for bundles which are uninstalled.
  * </p>
  */
-public class OSGiPreferencesServiceManager implements ServiceFactory, BundleListener {
+public class OSGiPreferencesServiceManager implements ServiceFactory<org.osgi.service.prefs.PreferencesService>, BundleListener {
 
 	private static final String ORG_ECLIPSE_CORE_INTERNAL_PREFERENCES_OSGI = "org.eclipse.core.internal.preferences.osgi"; //$NON-NLS-1$
 
@@ -47,7 +47,7 @@
 
 			//get list of currently installed bundles
 			Bundle[] allBundles = context.getBundles();
-			Set bundleQualifiers = new TreeSet();
+			Set<String> bundleQualifiers = new TreeSet<>();
 			for (int i = 0; i < allBundles.length; i++) {
 				bundleQualifiers.add(getQualifier(allBundles[i]));
 			}
@@ -71,7 +71,7 @@
 	 * Creates a new OSGiPreferencesServiceImpl for each bundle.
 	 */
 	@Override
-	public Object getService(Bundle bundle, ServiceRegistration registration) {
+	public org.osgi.service.prefs.PreferencesService getService(Bundle bundle, ServiceRegistration<org.osgi.service.prefs.PreferencesService> registration) {
 		String qualifier = getQualifier(bundle);
 		//remember we created prefs for this bundle
 		Preferences bundlesNode = getBundlesNode();
@@ -97,7 +97,7 @@
 	 * Flush the bundle's preferences.
 	 */
 	@Override
-	public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
+	public void ungetService(Bundle bundle, ServiceRegistration<org.osgi.service.prefs.PreferencesService> registration, org.osgi.service.prefs.PreferencesService service) {
 		try {
 			//new InstanceScope().getNode(getQualifier(bundle)).flush();
 			ConfigurationScope.INSTANCE.getNode(getQualifier(bundle)).flush();
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferenceServiceRegistryHelper.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferenceServiceRegistryHelper.java
index d1399ca..5f55d95 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferenceServiceRegistryHelper.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferenceServiceRegistryHelper.java
@@ -34,10 +34,10 @@
 	private static final String ELEMENT_MODIFIER = "modifier"; //$NON-NLS-1$
 	// Store this around for performance
 	private final static IExtension[] EMPTY_EXTENSION_ARRAY = new IExtension[0];
-	private static final Map scopeRegistry = Collections.synchronizedMap(new HashMap());
+	private static final Map<String, Object> scopeRegistry = Collections.synchronizedMap(new HashMap<String, Object>());
 	private ListenerList modifyListeners;
-	private PreferencesService service;
-	private IExtensionRegistry registry;
+	private final PreferencesService service;
+	private final IExtensionRegistry registry;
 
 	/*
 	 * Create and return an IStatus object with ERROR severity and the
@@ -104,7 +104,7 @@
 	 * to see if there is a preference initializer registered and if so, then run it.
 	 * Otherwise call the legacy Plugin preference initialization code.
 	 */
-	public WeakReference applyRuntimeDefaults(String name, WeakReference pluginReference) {
+	public WeakReference<Object> applyRuntimeDefaults(String name, WeakReference<Object> pluginReference) {
 		IExtension[] extensions = getPrefExtensions();
 		if (extensions.length == 0) {
 			if (EclipsePreferences.DEBUG_PREFERENCE_GENERAL)
@@ -145,7 +145,7 @@
 		ILegacyPreferences initService = PreferencesOSGiUtils.getDefault().getLegacyPreferences();
 		if (initService != null)
 			plugin = initService.init(plugin, name);
-		return new WeakReference(plugin);
+		return new WeakReference<>(plugin);
 	}
 
 	/*
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesOSGiUtils.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesOSGiUtils.java
index c754dbb..6eac555 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesOSGiUtils.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesOSGiUtils.java
@@ -24,11 +24,11 @@
  * @since org.eclipse.equinox.preferences 3.2
  */
 public class PreferencesOSGiUtils {
-	private ServiceTracker initTracker = null;
-	private ServiceTracker debugTracker = null;
-	private ServiceTracker bundleTracker = null;
-	private ServiceTracker configurationLocationTracker = null;
-	private ServiceTracker instanceLocationTracker = null;
+	private ServiceTracker<?, ILegacyPreferences> initTracker;
+	private ServiceTracker<?, DebugOptions> debugTracker;
+	private ServiceTracker<?, PackageAdmin> bundleTracker;
+	private ServiceTracker<?, ?> configurationLocationTracker;
+	private ServiceTracker<?, ?> instanceLocationTracker;
 
 	private static final PreferencesOSGiUtils singleton = new PreferencesOSGiUtils();
 
@@ -51,13 +51,13 @@
 			return;
 		}
 
-		initTracker = new ServiceTracker(context, ILegacyPreferences.class.getName(), null);
+		initTracker = new ServiceTracker<>(context, ILegacyPreferences.class, null);
 		initTracker.open(true);
 
-		debugTracker = new ServiceTracker(context, DebugOptions.class.getName(), null);
+		debugTracker = new ServiceTracker<>(context, DebugOptions.class, null);
 		debugTracker.open();
 
-		bundleTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
+		bundleTracker = new ServiceTracker<>(context, PackageAdmin.class, null);
 		bundleTracker.open();
 
 		// locations
@@ -68,7 +68,7 @@
 		} catch (InvalidSyntaxException e) {
 			// ignore this.  It should never happen as we have tested the above format.
 		}
-		configurationLocationTracker = new ServiceTracker(context, filter, null);
+		configurationLocationTracker = new ServiceTracker<>(context, filter, null);
 		configurationLocationTracker.open();
 
 		try {
@@ -76,7 +76,7 @@
 		} catch (InvalidSyntaxException e) {
 			// ignore this.  It should never happen as we have tested the above format.
 		}
-		instanceLocationTracker = new ServiceTracker(context, filter, null);
+		instanceLocationTracker = new ServiceTracker<>(context, filter, null);
 		instanceLocationTracker.open();
 	}
 
@@ -105,7 +105,7 @@
 
 	public ILegacyPreferences getLegacyPreferences() {
 		if (initTracker != null)
-			return (ILegacyPreferences) initTracker.getService();
+			return initTracker.getService();
 		if (EclipsePreferences.DEBUG_PREFERENCE_GENERAL)
 			PrefsMessages.message("Legacy preference tracker is not set"); //$NON-NLS-1$
 		return null;
@@ -117,7 +117,7 @@
 				PrefsMessages.message("Debug tracker is not set"); //$NON-NLS-1$
 			return defaultValue;
 		}
-		DebugOptions options = (DebugOptions) debugTracker.getService();
+		DebugOptions options = debugTracker.getService();
 		if (options != null) {
 			String value = options.getOption(option);
 			if (value != null)
@@ -132,7 +132,7 @@
 				PrefsMessages.message("Bundle tracker is not set"); //$NON-NLS-1$
 			return null;
 		}
-		PackageAdmin packageAdmin = (PackageAdmin) bundleTracker.getService();
+		PackageAdmin packageAdmin = bundleTracker.getService();
 		if (packageAdmin == null)
 			return null;
 		Bundle[] bundles = packageAdmin.getBundles(bundleName, null);
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java
index c63638a..bd55d9f 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java
@@ -47,9 +47,9 @@
 
 	private static PreferencesService instance;
 	static final RootPreferences root = new RootPreferences();
-	private static final Map defaultsRegistry = Collections.synchronizedMap(new HashMap());
+	private static final Map<String, LookupOrder> defaultsRegistry = Collections.synchronizedMap(new HashMap<String, LookupOrder>());
 	private Object registryHelper = null;
-	private Map defaultScopes = new HashMap();
+	private final Map<String, EclipsePreferences> defaultScopes = new HashMap<>();
 
 	/**
 	 * The last time analysis was done to remove duplicate strings
@@ -149,7 +149,7 @@
 					globalNode = (IEclipsePreferences) root.node(node.absolutePath());
 
 				// the list for properties to remove
-				List propsToRemove = new ArrayList();
+				List<String> propsToRemove = new ArrayList<>();
 				for (int i = 0; i < globalNode.keys().length; i++) {
 					propsToRemove.add(globalNode.keys()[i]);
 				}
@@ -177,8 +177,8 @@
 				}
 
 				String keyToRemove = null;
-				for (Iterator it = propsToRemove.iterator(); it.hasNext();) {
-					keyToRemove = (String) it.next();
+				for (Iterator<String> it = propsToRemove.iterator(); it.hasNext();) {
+					keyToRemove = it.next();
 					keyToRemove = keyToRemove.intern();
 					if (EclipsePreferences.DEBUG_PREFERENCE_SET)
 						PrefsMessages.message("Removing: " + globalNode.absolutePath() + '/' + keyToRemove); //$NON-NLS-1$
@@ -235,7 +235,7 @@
 	private Properties convertFromLegacy(Properties properties) {
 		Properties result = new Properties();
 		String prefix = IPath.SEPARATOR + InstanceScope.SCOPE + IPath.SEPARATOR;
-		for (Iterator i = properties.keySet().iterator(); i.hasNext();) {
+		for (Iterator<?> i = properties.keySet().iterator(); i.hasNext();) {
 			String key = (String) i.next();
 			String value = properties.getProperty(key);
 			if (value != null) {
@@ -259,7 +259,7 @@
 	 */
 	private IExportedPreferences convertFromProperties(Properties properties) {
 		IExportedPreferences result = ExportedPreferences.newRoot();
-		for (Iterator i = properties.keySet().iterator(); i.hasNext();) {
+		for (Iterator<?> i = properties.keySet().iterator(); i.hasNext();) {
 			String path = (String) i.next();
 			String value = properties.getProperty(path);
 			if (path.charAt(0) == EXPORT_ROOT_PREFIX) {
@@ -363,7 +363,7 @@
 			copyFromTo(source.node(children[i]), destination.node(children[i]), keys, depth);
 	}
 
-	public WeakReference applyRuntimeDefaults(String name, WeakReference pluginReference) {
+	public WeakReference<Object> applyRuntimeDefaults(String name, WeakReference<Object> pluginReference) {
 		if (registryHelper == null)
 			return null;
 		return ((PreferenceServiceRegistryHelper) registryHelper).applyRuntimeDefaults(name, pluginReference);
@@ -381,7 +381,7 @@
 	}
 
 	public IEclipsePreferences createNode(String key) {
-		IScope scope = (IScope) defaultScopes.get(key);
+		IScope scope = defaultScopes.get(key);
 		if (scope == null) {
 			if (registryHelper == null)
 				return new EclipsePreferences(root, key);
@@ -517,7 +517,7 @@
 
 	@Override
 	public String[] getDefaultLookupOrder(String qualifier, String key) {
-		LookupOrder order = (LookupOrder) defaultsRegistry.get(getRegistryKey(qualifier, key));
+		LookupOrder order = defaultsRegistry.get(getRegistryKey(qualifier, key));
 		return order == null ? null : order.getOrder();
 	}
 
@@ -591,7 +591,7 @@
 	private Preferences[] getNodes(final String qualifier, String key, final IScopeContext[] contexts) {
 		String[] order = getLookupOrder(qualifier, key);
 		final String childPath = EclipsePreferences.makeRelative(EclipsePreferences.decodePath(key)[0]);
-		final ArrayList result = new ArrayList();
+		final ArrayList<Preferences> result = new ArrayList<>();
 		for (int i = 0; i < order.length; i++) {
 			final String scopeString = order[i];
 			SafeRunner.run(new ISafeRunnable() {
@@ -625,7 +625,7 @@
 				}
 			});
 		}
-		return (Preferences[]) result.toArray(new Preferences[result.size()]);
+		return result.toArray(new Preferences[result.size()]);
 	}
 
 	/*
@@ -681,11 +681,11 @@
 	 * then apply the resulting tree to the main preference tree.
 	 */
 	private void internalApply(IEclipsePreferences tree, IPreferenceFilter[] filters) throws BackingStoreException {
-		ArrayList trees = new ArrayList();
+		ArrayList<IEclipsePreferences> trees = new ArrayList<>();
 		for (int i = 0; i < filters.length; i++)
 			trees.add(trimTree(tree, filters[i]));
 		// merge the union of the matching filters
-		IEclipsePreferences toApply = mergeTrees((IEclipsePreferences[]) trees.toArray(new IEclipsePreferences[trees.size()]));
+		IEclipsePreferences toApply = mergeTrees(trees.toArray(new IEclipsePreferences[trees.size()]));
 
 		// fire an event to give people a chance to modify the tree
 		toApply = firePreApplyEvent(toApply);
@@ -709,10 +709,10 @@
 	 * Then export the resulting tree to the given output stream.
 	 */
 	private void internalExport(IEclipsePreferences node, IPreferenceFilter filters[], OutputStream output) throws BackingStoreException, CoreException {
-		ArrayList trees = new ArrayList();
+		ArrayList<IEclipsePreferences> trees = new ArrayList<>();
 		for (int i = 0; i < filters.length; i++)
 			trees.add(trimTree(node, filters[i]));
-		IEclipsePreferences toExport = mergeTrees((IEclipsePreferences[]) trees.toArray(new IEclipsePreferences[trees.size()]));
+		IEclipsePreferences toExport = mergeTrees(trees.toArray(new IEclipsePreferences[trees.size()]));
 		exportPreferences(toExport, output, (String[]) null);
 	}
 
@@ -728,7 +728,7 @@
 		// see if this node is applicable by going over all our scopes
 		for (int i = 0; i < scopes.length; i++) {
 			String scope = scopes[i];
-			Map mapping = filter.getMapping(scope);
+			Map<String, PreferenceFilterEntry[]> mapping = filter.getMapping(scope);
 			// if the mapping is null then we match everything
 			if (mapping == null) {
 				// if we are the root check to see if the scope exists
@@ -742,8 +742,8 @@
 				continue;
 			}
 			// iterate over the list of declared nodes
-			for (Iterator iter = mapping.keySet().iterator(); iter.hasNext();) {
-				String nodePath = (String) iter.next();
+			for (Iterator<String> iter = mapping.keySet().iterator(); iter.hasNext();) {
+				String nodePath = iter.next();
 				String nodeFullPath = '/' + scope + '/' + nodePath;
 				// if this subtree isn't in a hierarchy we are interested in, then go to the next one
 				if (!nodeFullPath.startsWith(treePath))
@@ -755,7 +755,7 @@
 					PreferenceFilterEntry[] entries;
 					// protect against wrong classes since this is user-code
 					try {
-						entries = (PreferenceFilterEntry[]) mapping.get(nodePath);
+						entries = mapping.get(nodePath);
 					} catch (ClassCastException e) {
 						log(createStatusError(PrefsMessages.preferences_classCastFilterEntry, e));
 						continue;
@@ -788,11 +788,11 @@
 	 * Internal method that collects the matching filters for the given tree and returns them.
 	 */
 	private IPreferenceFilter[] internalMatches(IEclipsePreferences tree, IPreferenceFilter[] filters) throws BackingStoreException {
-		ArrayList result = new ArrayList();
+		ArrayList<IPreferenceFilter> result = new ArrayList<>();
 		for (int i = 0; i < filters.length; i++)
 			if (internalMatches(tree, filters[i]))
 				result.add(filters[i]);
-		return (IPreferenceFilter[]) result.toArray(new IPreferenceFilter[result.size()]);
+		return result.toArray(new IPreferenceFilter[result.size()]);
 	}
 
 	/*
@@ -954,7 +954,7 @@
 		// see if this node is applicable by going over all our scopes
 		for (int i = 0; i < scopes.length; i++) {
 			String scope = scopes[i];
-			Map mapping = filter.getMapping(scope);
+			Map<String, PreferenceFilterEntry[]> mapping = filter.getMapping(scope);
 			// if the mapping is null then copy everything if the scope matches
 			if (mapping == null) {
 				// if we are the root node then check our children
@@ -966,8 +966,8 @@
 				continue;
 			}
 			// iterate over the list of declared nodes
-			for (Iterator iter = mapping.keySet().iterator(); iter.hasNext();) {
-				String nodePath = (String) iter.next();
+			for (Iterator<String> iter = mapping.keySet().iterator(); iter.hasNext();) {
+				String nodePath = iter.next();
 				String nodeFullPath = '/' + scope + '/' + nodePath;
 				// if this subtree isn't in a hierarchy we are interested in, then go to the next one
 				if (!nodeFullPath.startsWith(treePath))
@@ -980,19 +980,19 @@
 					PreferenceFilterEntry[] entries;
 					// protect against wrong classes since this is passed in by the user
 					try {
-						entries = (PreferenceFilterEntry[]) mapping.get(nodePath);
+						entries = mapping.get(nodePath);
 					} catch (ClassCastException e) {
 						log(createStatusError(PrefsMessages.preferences_classCastFilterEntry, e));
 						continue;
 					}
 					String[] keys = null;
 					if (entries != null) {
-						ArrayList list = new ArrayList();
+						ArrayList<String> list = new ArrayList<>();
 						for (int j = 0; j < entries.length; j++) {
 							if (entries[j] != null)
 								addMatchedKeys(list, entries[j], child.keys());
 						}
-						keys = (String[]) list.toArray(new String[list.size()]);
+						keys = list.toArray(new String[list.size()]);
 					}
 					// do infinite depth if there are no keys specified since the parent matched.
 					copyFromTo(tree.node(childPath), result.node(childPath), keys, keys == null ? -1 : 0);
@@ -1005,7 +1005,7 @@
 	/*
 	 * Internal method that adds to the given list the matching preferences for entry with or without specific match type.
 	 */
-	private void addMatchedKeys(ArrayList list, PreferenceFilterEntry entry, String[] keys) {
+	private void addMatchedKeys(ArrayList<String> list, PreferenceFilterEntry entry, String[] keys) {
 		String matchType = entry.getMatchType();
 		if (matchType == null) {
 			list.add(entry.getKey());
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ScopeDescriptor.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ScopeDescriptor.java
index cbac9f5..6126414 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ScopeDescriptor.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ScopeDescriptor.java
@@ -22,7 +22,7 @@
 
 	String name;
 	AbstractPreferenceStorage storage;
-	Set loadedNodes = Collections.synchronizedSet(new HashSet());
+	Set<String> loadedNodes = Collections.synchronizedSet(new HashSet<String>());
 
 	public ScopeDescriptor(AbstractPreferenceStorage storage) {
 		super();
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/StringPool.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/StringPool.java
index e22478a..9291eaa 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/StringPool.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/StringPool.java
@@ -27,7 +27,7 @@
  */
 public final class StringPool {
 	private int savings;
-	private final HashMap map = new HashMap();
+	private final HashMap<String, String> map = new HashMap<>();
 
 	/**
 	 * Adds a <code>String</code> to the pool.  Returns a <code>String</code>
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/runtime/preferences/IPreferenceFilter.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/runtime/preferences/IPreferenceFilter.java
index 6ca8fc5..14960f7 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/runtime/preferences/IPreferenceFilter.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/runtime/preferences/IPreferenceFilter.java
@@ -72,6 +72,6 @@
 	 * @return the mapping table
 	 * @see PreferenceFilterEntry
 	 */
-	public Map getMapping(String scope);
+	public Map<String, PreferenceFilterEntry[]> getMapping(String scope);
 
 }