diff options
| author | Sergey Prigogin | 2015-02-08 00:20:19 +0000 |
|---|---|---|
| committer | Sergey Prigogin | 2015-03-04 00:18:36 +0000 |
| commit | 0c67910e71af04408dd2571066d9a70b3ce0bcc2 (patch) | |
| tree | ef2f746cfda515ccac654f2432344758e0560f0b | |
| parent | 5d0c9c029dbf67ac6f608ea89e60bebdcda42d77 (diff) | |
| download | eclipse.platform.resources-0c67910e71af04408dd2571066d9a70b3ce0bcc2.tar.gz eclipse.platform.resources-0c67910e71af04408dd2571066d9a70b3ce0bcc2.tar.xz eclipse.platform.resources-0c67910e71af04408dd2571066d9a70b3ce0bcc2.zip | |
Bug 459373 - Move all Platform Resources plugins to Java 1.6 BREE
Changes include generification, enhanced loops and some @Override
annotations.
Change-Id: I628413f5b8a18354f9ff21ea2cc1df8ad331abc8
Signed-off-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
79 files changed, 416 insertions, 413 deletions
diff --git a/bundles/org.eclipse.core.filesystem/.classpath b/bundles/org.eclipse.core.filesystem/.classpath index 2fbb7a23e..4c62a8048 100644 --- a/bundles/org.eclipse.core.filesystem/.classpath +++ b/bundles/org.eclipse.core.filesystem/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/bundles/org.eclipse.core.filesystem/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.filesystem/.settings/org.eclipse.jdt.core.prefs index e90e292c4..24722a21a 100644 --- a/bundles/org.eclipse.core.filesystem/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.core.filesystem/.settings/org.eclipse.jdt.core.prefs @@ -14,10 +14,11 @@ org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonN 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=disabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +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.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -116,7 +117,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enab org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 diff --git a/bundles/org.eclipse.core.filesystem/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.filesystem/META-INF/MANIFEST.MF index 7a8861b08..8835fef13 100644 --- a/bundles/org.eclipse.core.filesystem/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.core.filesystem/META-INF/MANIFEST.MF @@ -13,6 +13,6 @@ Export-Package: org.eclipse.core.filesystem, org.eclipse.core.internal.filesystem.local;x-internal:=true, org.eclipse.core.internal.filesystem.local.unix;x-internal:=true Bundle-Vendor: %providerName -Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Bundle-Activator: org.eclipse.core.internal.filesystem.Activator diff --git a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/IFileInfo.java b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/IFileInfo.java index 7c9eade9b..c0f8e7806 100644 --- a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/IFileInfo.java +++ b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/IFileInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,7 +26,7 @@ import org.eclipse.core.runtime.IProgressMonitor; * @noimplement This interface is not intended to be implemented by clients. File store * implementations should use the concrete class {@link org.eclipse.core.filesystem.provider.FileStore} */ -public interface IFileInfo extends Comparable, Cloneable { +public interface IFileInfo extends Comparable<IFileInfo>, Cloneable { /** * The constant indicating that file information was retrieved successfully. * @since 1.4 diff --git a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/provider/FileInfo.java b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/provider/FileInfo.java index 6c3afa6f2..963ad5ffe 100644 --- a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/provider/FileInfo.java +++ b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/filesystem/provider/FileInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -104,8 +104,9 @@ public class FileInfo implements IFileInfo { * (non-Javadoc) * @see java.lang.Comparable#compareTo(java.lang.Object) */ - public int compareTo(Object o) { - return name.compareTo(((FileInfo) o).name); + @Override + public int compareTo(IFileInfo o) { + return name.compareTo(o.getName()); } /* (non-Javadoc) diff --git a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/Activator.java b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/Activator.java index aaf09bcc2..dfcd70889 100644 --- a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/Activator.java +++ b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/Activator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. + * Copyright (c) 2007, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,6 +11,8 @@ package org.eclipse.core.internal.filesystem; import java.io.File; +import java.net.URL; +import java.util.Collection; import java.util.Enumeration; import org.eclipse.core.runtime.*; import org.eclipse.osgi.service.datalocation.Location; @@ -37,12 +39,13 @@ public class Activator implements BundleActivator { if (instance != null) { BundleContext ctx = instance.context; if (ctx != null) { - ServiceReference[] refs = ctx.getServiceReferences(Location.class.getName(), Location.INSTANCE_FILTER); - if (refs != null && refs.length == 1) { - Location location = (Location) ctx.getService(refs[0]); + Collection<ServiceReference<Location>> refs = ctx.getServiceReferences(Location.class, Location.INSTANCE_FILTER); + if (refs != null && refs.size() == 1) { + ServiceReference<Location> ref = refs.iterator().next(); + Location location = ctx.getService(ref); if (location != null) { IPath instancePath = new Path(new File(location.getURL().getFile()).toString()); - ctx.ungetService(refs[0]); + ctx.ungetService(ref); return instancePath.append(".metadata/.plugins").append(Policy.PI_FILE_SYSTEM); //$NON-NLS-1$ } } @@ -61,7 +64,7 @@ public class Activator implements BundleActivator { instance = this; } - public static Enumeration findEntries(String path, String filePattern, boolean recurse) { + public static Enumeration<URL> findEntries(String path, String filePattern, boolean recurse) { if (instance != null && instance.context != null) return instance.context.getBundle().findEntries(path, filePattern, recurse); return null; diff --git a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/InternalFileSystemCore.java b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/InternalFileSystemCore.java index c8e6f7325..52c9d2eba 100644 --- a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/InternalFileSystemCore.java +++ b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/InternalFileSystemCore.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -31,7 +31,7 @@ public class InternalFileSystemCore implements IRegistryChangeListener { * element for the extension. Once the file system has been created, the * map contains the IFileSystem instance for that scheme. */ - private HashMap fileSystems; + private HashMap<String, Object> fileSystems; /** * Returns the singleton instance of this class. @@ -59,7 +59,7 @@ public class InternalFileSystemCore implements IRegistryChangeListener { public IFileSystem getFileSystem(String scheme) throws CoreException { if (scheme == null) throw new NullPointerException(); - final HashMap registry = getFileSystemRegistry(); + final HashMap<String, Object> registry = getFileSystemRegistry(); Object result = registry.get(scheme); if (result == null) Policy.error(EFS.ERROR_INTERNAL, NLS.bind(Messages.noFileSystem, scheme)); @@ -111,9 +111,9 @@ public class InternalFileSystemCore implements IRegistryChangeListener { * Returns the fully initialized file system registry * @return The file system registry */ - private synchronized HashMap getFileSystemRegistry() { + private synchronized HashMap<String, Object> getFileSystemRegistry() { if (fileSystems == null) { - fileSystems = new HashMap(); + fileSystems = new HashMap<String, Object>(); IExtensionPoint point = RegistryFactory.getRegistry().getExtensionPoint(EFS.PI_FILE_SYSTEM, EFS.PT_FILE_SYSTEMS); IExtension[] extensions = point.getExtensions(); for (int i = 0; i < extensions.length; i++) { diff --git a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFile.java b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFile.java index f66cf044c..8d972304b 100644 --- a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFile.java +++ b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFile.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2014 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -174,6 +174,8 @@ public class LocalFile extends FileStore { return info; } + @Deprecated + @Override public IFileStore getChild(IPath path) { return new LocalFile(new File(file, path.toOSString())); } diff --git a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNatives.java b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNatives.java index 95d8a91c4..49d0b5d78 100644 --- a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNatives.java +++ b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNatives.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,6 +11,7 @@ *******************************************************************************/ package org.eclipse.core.internal.filesystem.local; +import java.net.URL; import java.util.Enumeration; import org.eclipse.core.filesystem.IFileInfo; import org.eclipse.core.filesystem.IFileSystem; @@ -47,7 +48,7 @@ abstract class LocalFileNatives { private static boolean isLibraryPresent() { String libName = System.mapLibraryName(LIBRARY_NAME); - Enumeration entries = Activator.findEntries("/", libName, true); //$NON-NLS-1$ + Enumeration<URL> entries = Activator.findEntries("/", libName, true); //$NON-NLS-1$ return entries != null && entries.hasMoreElements(); } diff --git a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNativesManager.java b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNativesManager.java index e0e0eab40..c969b7c7c 100644 --- a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNativesManager.java +++ b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNativesManager.java @@ -50,8 +50,8 @@ public class LocalFileNativesManager { DELEGATE = new LocalFileHandler(); } else { try { - Class c = LocalFileNativesManager.class.getClassLoader().loadClass("org.eclipse.core.internal.filesystem.java7.HandlerFactory"); //$NON-NLS-1$ - DELEGATE = (NativeHandler) c.getMethod("getHandler", null).invoke(null, null); //$NON-NLS-1$ + Class<?> c = LocalFileNativesManager.class.getClassLoader().loadClass("org.eclipse.core.internal.filesystem.java7.HandlerFactory"); //$NON-NLS-1$ + DELEGATE = (NativeHandler) c.getMethod("getHandler", (Class<?>) null).invoke(null, (Object) null); //$NON-NLS-1$ } catch (ClassNotFoundException e) { // Class was missing? // Leave the delegate as default diff --git a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileNatives.java b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileNatives.java index bdd1640dc..4872c6365 100644 --- a/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileNatives.java +++ b/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/unix/UnixFileNatives.java @@ -12,6 +12,7 @@ package org.eclipse.core.internal.filesystem.local.unix; import java.io.*; +import java.net.URL; import java.util.Enumeration; import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileInfo; @@ -49,7 +50,7 @@ public abstract class UnixFileNatives { private static boolean isLibraryPresent() { String libName = System.mapLibraryName(LIBRARY_NAME); - Enumeration entries = Activator.findEntries("/", libName, true); //$NON-NLS-1$ + Enumeration<URL> entries = Activator.findEntries("/", libName, true); //$NON-NLS-1$ return entries != null && entries.hasMoreElements(); } diff --git a/bundles/org.eclipse.core.resources.spysupport/.classpath b/bundles/org.eclipse.core.resources.spysupport/.classpath index 2fbb7a23e..4c62a8048 100644 --- a/bundles/org.eclipse.core.resources.spysupport/.classpath +++ b/bundles/org.eclipse.core.resources.spysupport/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/bundles/org.eclipse.core.resources.spysupport/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.resources.spysupport/.settings/org.eclipse.jdt.core.prefs index 94a6466c4..a6784f0c2 100644 --- a/bundles/org.eclipse.core.resources.spysupport/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.core.resources.spysupport/.settings/org.eclipse.jdt.core.prefs @@ -1,15 +1,15 @@ -#Fri Feb 20 11:55:12 CET 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=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=error @@ -18,7 +18,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore @@ -84,7 +84,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 @@ -158,7 +158,12 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert diff --git a/bundles/org.eclipse.core.resources.spysupport/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.resources.spysupport/META-INF/MANIFEST.MF index 3601d4c12..4ae5495ee 100644 --- a/bundles/org.eclipse.core.resources.spysupport/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.core.resources.spysupport/META-INF/MANIFEST.MF @@ -8,4 +8,4 @@ Fragment-Host: org.eclipse.core.resources;bundle-version="[3.0.0,4.0.0)" Export-Package: org.eclipse.core.internal.dtree;x-friends:="org.eclipse.core.tools.resources", org.eclipse.core.internal.properties;x-friends:="org.eclipse.core.tools.resources", org.eclipse.core.internal.resources;x-friends:="org.eclipse.core.tools.resources" -Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/bundles/org.eclipse.core.resources.spysupport/src/org/eclipse/core/internal/resources/SpySupport.java b/bundles/org.eclipse.core.resources.spysupport/src/org/eclipse/core/internal/resources/SpySupport.java index 5a2345b6e..4213e2449 100644 --- a/bundles/org.eclipse.core.resources.spysupport/src/org/eclipse/core/internal/resources/SpySupport.java +++ b/bundles/org.eclipse.core.resources.spysupport/src/org/eclipse/core/internal/resources/SpySupport.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2005 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,6 +15,7 @@ import org.eclipse.core.internal.utils.Cache; import org.eclipse.core.internal.watson.ElementTree; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.QualifiedName; /** * Provides special internal access to the workspace resource implementation. @@ -36,16 +37,17 @@ public class SpySupport { * @param resource the resource to get the properties from * @return the resource's session properties or <code>null</code> */ - public static Map getSessionProperties(IResource resource) { + public static Map<QualifiedName, Object> getSessionProperties(IResource resource) { ResourceInfo info = ((Resource) resource).getResourceInfo(true, false); if (info == null) return null; return getSessionProperties(info); } - public static Map getSessionProperties(ResourceInfo info) { - return info.sessionProperties == null ? null : (Map) info.sessionProperties.clone(); + @SuppressWarnings("unchecked") + public static Map<QualifiedName, Object> getSessionProperties(ResourceInfo info) { + return info.sessionProperties == null ? null : (Map<QualifiedName, Object>) info.sessionProperties.clone(); } - public static Map getSyncInfo(ResourceInfo info) { + public static Map<QualifiedName, Object> getSyncInfo(ResourceInfo info) { return info.syncInfo; } public static ElementTree getOldestTree() { @@ -57,7 +59,7 @@ public class SpySupport { public static IMarkerSetElement[] getElements(MarkerSet markerSet) { return markerSet.elements; } - public static Object[] getElements(MarkerAttributeMap markerMap) { + public static Object[] getElements(MarkerAttributeMap<?> markerMap) { return markerMap.elements; } public static boolean isContentDescriptionCached(File file) { diff --git a/bundles/org.eclipse.core.resources/.classpath b/bundles/org.eclipse.core.resources/.classpath index 7ab511392..cb5cbad88 100644 --- a/bundles/org.eclipse.core.resources/.classpath +++ b/bundles/org.eclipse.core.resources/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src_ant"/> diff --git a/bundles/org.eclipse.core.resources/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.resources/.settings/org.eclipse.jdt.core.prefs index 1507c9b7a..e7a634ab8 100644 --- a/bundles/org.eclipse.core.resources/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.core.resources/.settings/org.eclipse.jdt.core.prefs @@ -13,9 +13,10 @@ org.eclipse.jdt.core.compiler.annotation.nonnullisdefault=disabled 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.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -112,7 +113,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enab org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF index b33665358..434977fe2 100644 --- a/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF @@ -29,4 +29,4 @@ Require-Bundle: org.eclipse.ant.core;bundle-version="[3.1.0,4.0.0)";resolution:= org.eclipse.core.filesystem;bundle-version="[1.3.0,2.0.0)", org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java index 897691fbd..23dbf0416 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -83,7 +83,7 @@ public class FileSystemResourceManager implements ICoreConstants, IManager, Pref if (!project.exists()) continue; //check the project location - URI testLocation = locationURIFor(project, true);; + URI testLocation = locationURIFor(project, true); if (testLocation == null) continue; boolean usingAnotherScheme = !inputLocation.getScheme().equals(testLocation.getScheme()); @@ -802,6 +802,8 @@ public class FileSystemResourceManager implements ICoreConstants, IManager, Pref getStore(source).move(destination, EFS.NONE, monitor); } + @Deprecated + @Override public void propertyChange(PropertyChangeEvent event) { if (ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH.equals(event.getProperty())) lightweightAutoRefreshEnabled = Boolean.valueOf(event.getNewValue().toString()); diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/UnifiedTree.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/UnifiedTree.java index 15921f5fa..70039334c 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/UnifiedTree.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/UnifiedTree.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -518,7 +518,6 @@ public class UnifiedTree { * Sorts the given array of strings in place. This is * not using the sorting framework to avoid casting overhead. */ - @SuppressWarnings("unchecked") protected void quickSort(IFileInfo[] infos, int left, int right) { int originalLeft = left; int originalRight = right; diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/refresh/RefreshManager.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/refresh/RefreshManager.java index 30c573a36..0cdb55541 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/refresh/RefreshManager.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/refresh/RefreshManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2014 IBM Corporation and others. + * Copyright (c) 2004, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -65,6 +65,8 @@ public class RefreshManager implements IRefreshResult, IManager, Preferences.IPr * Checks for changes to the PREF_AUTO_UPDATE property. * @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(Preferences.PropertyChangeEvent) */ + @Deprecated + @Override public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); if (ResourcesPlugin.PREF_AUTO_REFRESH.equals(property)) { diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/PathVariableManager.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/PathVariableManager.java index 671e4d8a4..577d56bbb 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/PathVariableManager.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/PathVariableManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -163,6 +163,8 @@ public class PathVariableManager implements IPathVariableManager, IManager { * * @see org.eclipse.core.resources.IPathVariableManager#getValue(String) */ + @Deprecated + @Override public IPath getValue(String varName) { String key = getKeyForName(varName); String value = preferences.getString(key); @@ -196,6 +198,8 @@ public class PathVariableManager implements IPathVariableManager, IManager { /** * @see org.eclipse.core.resources.IPathVariableManager#resolvePath(IPath) */ + @Deprecated + @Override public IPath resolvePath(IPath path) { if (path == null || path.segmentCount() == 0 || path.isAbsolute() || path.getDevice() != null) return path; diff --git a/bundles/org.eclipse.core.tools.resources/.classpath b/bundles/org.eclipse.core.tools.resources/.classpath index aea1fb5c1..9b07f190c 100644 --- a/bundles/org.eclipse.core.tools.resources/.classpath +++ b/bundles/org.eclipse.core.tools.resources/.classpath @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="/org.eclipse.core.resources.spysupport"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/bundles/org.eclipse.core.tools.resources/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.tools.resources/.settings/org.eclipse.jdt.core.prefs index 8f3cd899d..c565f1114 100644 --- a/bundles/org.eclipse.core.tools.resources/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.core.tools.resources/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,3 @@ -#Fri Feb 23 16:59:25 EST 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -7,22 +6,23 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch 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.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+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.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
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=ignore
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@@ -140,7 +140,12 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
diff --git a/bundles/org.eclipse.core.tools.resources/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.tools.resources/META-INF/MANIFEST.MF index 34f6b87ac..55c1cf011 100644 --- a/bundles/org.eclipse.core.tools.resources/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.core.tools.resources/META-INF/MANIFEST.MF @@ -1,11 +1,12 @@ Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 Bundle-Name: Core Resources Tools -Bundle-SymbolicName: org.eclipse.core.tools.resources;singleton=true +Bundle-SymbolicName: org.eclipse.core.tools.resources;singleton:=true Bundle-Version: 1.4.100.qualifier Bundle-Vendor: Eclipse.org Bundle-Activator: org.eclipse.core.tools.resources.CoreResourcesToolsPlugin Bundle-Localization: plugin -Provide-Package: org.eclipse.core.tools.resources, +Export-Package: org.eclipse.core.tools.resources, org.eclipse.core.tools.resources.markers Require-Bundle: org.eclipse.core.resources, org.eclipse.core.runtime, @@ -16,4 +17,5 @@ Require-Bundle: org.eclipse.core.resources, org.eclipse.ui.ide, org.eclipse.ui.views, org.eclipse.core.tools -Eclipse-LazyStart: true +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/CountResourcesAction.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/CountResourcesAction.java index 42fd924ea..c4fa8fc5b 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/CountResourcesAction.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/CountResourcesAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2009 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.core.tools.resources; +import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IContainer; - import java.util.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.CoreException; @@ -41,7 +41,7 @@ public class CountResourcesAction implements IWorkbenchWindowActionDelegate { * @see org.eclipse.jface.action.Action#run() */ public void run(IAction action) { - List resources = getSelectedResources(); + List<IResource> resources = getSelectedResources(); try { int count = countResources(resources); showResourcesCount(resources, count); @@ -57,9 +57,10 @@ public class CountResourcesAction implements IWorkbenchWindowActionDelegate { * * @return a list of resources */ - private List getSelectedResources() { + @SuppressWarnings("rawtypes") + private List<IResource> getSelectedResources() { - List resources = new LinkedList(); + List<IResource> resources = new LinkedList<IResource>(); ISelectionService selectionService = window.getSelectionService(); ISelection selection = selectionService.getSelection(); @@ -90,14 +91,14 @@ public class CountResourcesAction implements IWorkbenchWindowActionDelegate { * @param count the number of resources found */ - private void showResourcesCount(List resources, int count) { + private void showResourcesCount(List<IResource> resources, int count) { StringBuffer message = new StringBuffer(); message.append("Number of resources visited: "); //$NON-NLS-1$ message.append(count); message.append("\nStarting point(s): \n"); //$NON-NLS-1$ - for (Iterator resourcesIter = resources.iterator(); resourcesIter.hasNext();) { + for (IResource resource : resources) { message.append('\t'); - message.append(((IResource) resourcesIter.next()).getFullPath()); + message.append(resource.getFullPath()); message.append('\n'); } MessageDialog.openInformation(window.getShell(), "Resource counting", message.toString()); //$NON-NLS-1$ @@ -136,12 +137,12 @@ public class CountResourcesAction implements IWorkbenchWindowActionDelegate { * @throws CoreException if a visited resource does not exist * @see IResource#accept(org.eclipse.core.resources.IResourceVisitor) */ - private int countResources(List resources) throws CoreException { + private int countResources(List<IResource> resources) throws CoreException { ResourceCounterVisitor counter = new ResourceCounterVisitor(); - for (Iterator resourcesIter = resources.iterator(); resourcesIter.hasNext();) - ((IResource) resourcesIter.next()).accept(counter, IResource.DEPTH_INFINITE, IContainer.INCLUDE_PHANTOMS | IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS | IContainer.INCLUDE_HIDDEN); + for (IResource resource : resources) + resource.accept(counter, IResource.DEPTH_INFINITE, IContainer.INCLUDE_PHANTOMS | IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS | IContainer.INCLUDE_HIDDEN); return counter.count; } @@ -193,25 +194,23 @@ public class CountResourcesAction implements IWorkbenchWindowActionDelegate { * * @param resourcesList a <code>List</code> object containing resource objects. */ - private void eliminateRedundancies(List resourcesList) { + private void eliminateRedundancies(List<IResource> resourcesList) { if (resourcesList.size() <= 1) return; // we sort the resources list by path so it is easier to check for redundancies - Collections.sort(resourcesList, new Comparator() { - public int compare(Object arg1, Object arg2) { - IResource resource1 = (IResource) arg1; - IResource resource2 = (IResource) arg2; + Collections.sort(resourcesList, new Comparator<IResource>() { + public int compare(IResource resource1, IResource resource2) { return resource1.getFullPath().toString().compareTo(resource2.getFullPath().toString()); } }); // We iterate through the list removing any resource which is descendant // from any resource previously visited - Iterator resourcesIter = resourcesList.iterator(); - IResource last = (IResource) resourcesIter.next(); + Iterator<IResource> resourcesIter = resourcesList.iterator(); + IResource last = resourcesIter.next(); while (resourcesIter.hasNext()) { - IResource current = (IResource) resourcesIter.next(); + IResource current = resourcesIter.next(); if (last.getFullPath().isPrefixOf(current.getFullPath())) resourcesIter.remove(); else diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ElementTreeView.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ElementTreeView.java index 45bbb9551..7362bc635 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ElementTreeView.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ElementTreeView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -38,7 +38,7 @@ public class ElementTreeView extends SpyView implements IResourceChangeListener class UpdateAction extends Action { - class Counter implements Comparable { + class Counter implements Comparable<Counter> { int count = 1; String name; @@ -50,8 +50,8 @@ public class ElementTreeView extends SpyView implements IResourceChangeListener count++; } - public int compareTo(Object o) { - return ((Counter) o).getCount() - count; + public int compareTo(Counter o) { + return o.getCount() - count; } int getCount() { @@ -74,10 +74,10 @@ public class ElementTreeView extends SpyView implements IResourceChangeListener int resourceCount; DeepSize sessionPropertyMemory; - List sortedList; + List<Counter> sortedList; int stringMemory; - final Map strings = new HashMap(); + final Map<String, Counter> strings = new HashMap<String, Counter>(); int syncInfoCount; int syncInfoMemory; int teamPrivateCount; @@ -102,7 +102,7 @@ public class ElementTreeView extends SpyView implements IResourceChangeListener stringMemory += basicSizeof(name); //now want to count the number of duplicate equal but non-identical strings - Counter counter = (Counter) strings.get(name); + Counter counter = strings.get(name); if (counter == null) strings.put(name, new Counter(name)); else @@ -111,7 +111,7 @@ public class ElementTreeView extends SpyView implements IResourceChangeListener } void analyzeStrings() { - sortedList = new ArrayList(strings.values()); + sortedList = new ArrayList<Counter>(strings.values()); Collections.sort(sortedList); } @@ -125,22 +125,21 @@ public class ElementTreeView extends SpyView implements IResourceChangeListener } } - int basicSizeof(Map map) { + int basicSizeof(Map<?, ?> map) { if (map == null) return 0; //formula taken from BundleStats int count = (int) Math.round(44 + (16 + (map.size() * 1.25 * 4)) + (24 * map.size())); - for (Iterator it = map.entrySet().iterator(); it.hasNext();) { - Map.Entry entry = (Map.Entry) it.next(); + for (Map.Entry<?, ?> entry : map.entrySet()) { count += sizeof(entry.getKey()); count += sizeof(entry.getValue()); } return count; } - int basicSizeof(MarkerAttributeMap markerMap) { + int basicSizeof(MarkerAttributeMap<?> markerMap) { int count = DeepSize.OBJECT_HEADER_SIZE + 8;//object header plus two slots Object[] elements = SpySupport.getElements(markerMap); if (elements != null) { @@ -200,7 +199,7 @@ public class ElementTreeView extends SpyView implements IResourceChangeListener MarkerSet markers = info.getMarkers(); if (markers != null) markerCount += markers.size(); - Map syncInfo = SpySupport.getSyncInfo(info); + Map<QualifiedName, Object> syncInfo = SpySupport.getSyncInfo(info); if (syncInfo != null) syncInfoCount += syncInfo.size(); return true; @@ -274,7 +273,7 @@ public class ElementTreeView extends SpyView implements IResourceChangeListener if (object instanceof byte[]) return DeepSize.ARRAY_HEADER_SIZE + ((byte[]) object).length; if (object instanceof MarkerAttributeMap) - return basicSizeof((MarkerAttributeMap) object); + return basicSizeof((MarkerAttributeMap<?>) object); if (object instanceof MarkerInfo) return basicSizeof((MarkerInfo) object); if (object instanceof MarkerSet) @@ -282,7 +281,7 @@ public class ElementTreeView extends SpyView implements IResourceChangeListener if (object instanceof Integer) return DeepSize.OBJECT_HEADER_SIZE + 4; if (object instanceof Map) - return basicSizeof((Map) object); + return basicSizeof((Map<?, ?>) object); if (object instanceof QualifiedName) { QualifiedName name = (QualifiedName) object; return 20 + sizeof(name.getQualifier()) + sizeof(name.getLocalName()); @@ -317,14 +316,12 @@ public class ElementTreeView extends SpyView implements IResourceChangeListener * Sorts a set of entries whose keys are strings and values are Integer * objects, in decreasing order by the integer value. */ - private List sortEntrySet(Set set) { - List result = new ArrayList(); + private List<Map.Entry<Object, Integer>> sortEntrySet(Set<Map.Entry<Object, Integer>> set) { + List<Map.Entry<Object, Integer>> result = new ArrayList<Map.Entry<Object, Integer>>(); result.addAll(set); - Collections.sort(result, new Comparator() { - public int compare(Object arg0, Object arg1) { - Integer value1 = (Integer) ((Map.Entry) arg0).getValue(); - Integer value2 = (Integer) ((Map.Entry) arg1).getValue(); - return value2.intValue() - value1.intValue(); + Collections.sort(result, new Comparator<Map.Entry<Object, Integer>>() { + public int compare(Map.Entry<Object, Integer> arg0, Map.Entry<Object, Integer> arg1) { + return arg1.getValue().intValue() - arg0.getValue().intValue(); } }); return result; @@ -351,17 +348,17 @@ public class ElementTreeView extends SpyView implements IResourceChangeListener buffer.append("\tSync info: " + prettyPrint(syncInfoMemory) + "\n"); buffer.append("\tSession properties: " + prettyPrint(sessionSize) + "\n"); //breakdown of session property size by class - List sortedEntries = sortEntrySet(sessionPropertyMemory.getSizes().entrySet()); - for (Iterator it = sortedEntries.iterator(); it.hasNext();) { - Map.Entry entry = (Map.Entry) it.next(); - buffer.append("\t\t" + entry.getKey() + ": " + prettyPrint(((Integer) entry.getValue()).intValue()) + "\n"); + @SuppressWarnings("unchecked") + List<Map.Entry<Object, Integer>> sortedEntries = sortEntrySet(sessionPropertyMemory.getSizes().entrySet()); + for (Map.Entry<Object, Integer> entry : sortedEntries) { + buffer.append("\t\t" + entry.getKey() + ": " + prettyPrint(entry.getValue().intValue()) + "\n"); } int max = 20; int savings = 0; buffer.append("The top " + max + " equal but non-identical strings are:\n"); - for (int i = 0; i < sortedList.size() && ((Counter) sortedList.get(i)).getCount() > 1; i++) { - Counter c = (Counter) sortedList.get(i); + for (int i = 0; i < sortedList.size() && sortedList.get(i).getCount() > 1; i++) { + Counter c = sortedList.get(i); if (i < max) buffer.append("\t" + c.getName() + "->" + prettyPrint(c.getCount()) + "\n"); savings += ((c.getCount() - 1) * basicSizeof(c.getName())); diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/LocalHistoryBrowserView.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/LocalHistoryBrowserView.java index 8d438241a..4d4706950 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/LocalHistoryBrowserView.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/LocalHistoryBrowserView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. + * Copyright (c) 2004, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -81,7 +81,7 @@ public class LocalHistoryBrowserView extends ViewPart { return null; } - public Object getAdapter(Class adapter) { + public <T> T getAdapter(Class<T> adapter) { return null; } } @@ -90,13 +90,13 @@ public class LocalHistoryBrowserView extends ViewPart { Node parent; String name; - ArrayList children; + ArrayList<Object> children; public Node(Node parent, String name) { super(); this.parent = parent; this.name = name; - this.children = new ArrayList(); + this.children = new ArrayList<Object>(); } public void addChild(Object child) { @@ -116,11 +116,10 @@ public class LocalHistoryBrowserView extends ViewPart { } public Object getChild(String childName) { - for (Iterator i = children.iterator(); i.hasNext();) { - Object next = i.next(); - if (next instanceof Node) { - if (((Node) next).getName().equals(childName)) - return next; + for (Object child : children) { + if (child instanceof Node) { + if (((Node) child).getName().equals(childName)) + return child; } } return null; @@ -167,9 +166,8 @@ public class LocalHistoryBrowserView extends ViewPart { public void initialize() { invisibleRoot = new Node(null, "/"); //$NON-NLS-1$ - Set allFiles = store.allFiles(Path.ROOT, IResource.DEPTH_INFINITE, null); - for (Iterator iterator = allFiles.iterator(); iterator.hasNext();) { - IPath path = (IPath) iterator.next(); + Set<IPath> allFiles = store.allFiles(Path.ROOT, IResource.DEPTH_INFINITE, null); + for (IPath path : allFiles) { Node current = invisibleRoot; String[] segments = path.segments(); for (int i = 0; i < segments.length; i++) { diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ProjectContentProvider.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ProjectContentProvider.java index 0237f08cc..fa5b032b4 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ProjectContentProvider.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ProjectContentProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2009 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -89,7 +89,7 @@ public class ProjectContentProvider extends AbstractTreeContentProvider { // project's builder spec Workspace workspace = (Workspace) ResourcesPlugin.getWorkspace(); BuildManager manager = workspace.getBuildManager(); - ArrayList allPersistInfo = null; + ArrayList<BuilderPersistentInfo> allPersistInfo = null; try { allPersistInfo = manager.getBuildersPersistentInfo(project); } catch (CoreException ce) { @@ -111,8 +111,7 @@ public class ProjectContentProvider extends AbstractTreeContentProvider { // extracts information from persistent info (if available) if (allPersistInfo != null) { //find persistent info for this builder - for (Iterator it = allPersistInfo.iterator(); it.hasNext();) { - BuilderPersistentInfo info = (BuilderPersistentInfo) it.next(); + for (BuilderPersistentInfo info : allPersistInfo) { if (info.getBuilderName().equals(builderName)) { extractBuilderPersistentInfo(builderNode, info); break; @@ -128,15 +127,14 @@ public class ProjectContentProvider extends AbstractTreeContentProvider { * @param builderNode the node where to add builder arguments nodes * @param builderArgs a map containing arguments for a builder */ - protected void extractBuilderArguments(TreeContentProviderNode builderNode, Map builderArgs) { - if (builderArgs == null || builderArgs.size() == 0) + protected void extractBuilderArguments(TreeContentProviderNode builderNode, Map<String, String> builderArgs) { + if (builderArgs == null || builderArgs.isEmpty()) return; TreeContentProviderNode builderArgsRoot = createNode("Builder args"); //$NON-NLS-1$ builderNode.addChild(builderArgsRoot); - for (Iterator builderArgsIter = builderArgs.entrySet().iterator(); builderArgsIter.hasNext();) { - Map.Entry entry = (Map.Entry) builderArgsIter.next(); - TreeContentProviderNode builderArgNode = createNode((String) entry.getKey(), entry.getValue()); + for (Map.Entry<String, String> entry : builderArgs.entrySet()) { + TreeContentProviderNode builderArgNode = createNode(entry.getKey(), entry.getValue()); builderArgsRoot.addChild(builderArgNode); } } diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ProjectView.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ProjectView.java index 591d05e56..cf6857510 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ProjectView.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ProjectView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2005 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -183,6 +183,9 @@ public class ProjectView extends SpyView { } private class SelectedResourceChangeListener implements IResourceChangeListener { + public SelectedResourceChangeListener() { + } + public void resourceChanged(IResourceChangeEvent event) { final IResource currentResource = (IResource) viewer.getInput(); diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ResourceChangeView.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ResourceChangeView.java index 6d515f0eb..97497dcf9 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ResourceChangeView.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ResourceChangeView.java @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (c) 2002, 2006 Geoff Longman and others. + * Copyright (c) 2002, 2015 Geoff Longman and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,6 +11,8 @@ **********************************************************************/ package org.eclipse.core.tools.resources; +import org.eclipse.jface.action.Action; + import java.util.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.IAdaptable; @@ -30,7 +32,7 @@ import org.eclipse.ui.*; */ public class ResourceChangeView extends SpyView implements IResourceChangeListener { class DeltaNode implements IAdaptable { - private ArrayList children; + private ArrayList<DeltaNode> children; private int deltaFlags = -1; private int deltaKind = -1; private DeltaNode parent = null; @@ -38,7 +40,7 @@ public class ResourceChangeView extends SpyView implements IResourceChangeListen private IResource resource; public DeltaNode() { - children = new ArrayList(); + children = new ArrayList<DeltaNode>(); } public DeltaNode(IResourceDelta delta) { @@ -51,14 +53,14 @@ public class ResourceChangeView extends SpyView implements IResourceChangeListen child.setParent(this); } - public Object getAdapter(Class key) { + public Object getAdapter(@SuppressWarnings("rawtypes") Class key) { if (key != IResource.class) return null; return resource; } public DeltaNode[] getChildren() { - return (DeltaNode[]) children.toArray(new DeltaNode[children.size()]); + return children.toArray(new DeltaNode[children.size()]); } public int getDeltaFlags() { @@ -122,8 +124,7 @@ public class ResourceChangeView extends SpyView implements IResourceChangeListen */ public void run() { typeFilter = type; - for (Iterator i = eventActions.iterator(); i.hasNext();) { - IAction action = (IAction) i.next(); + for (Action action : eventActions) { action.setChecked(action.equals(this)); } } @@ -334,7 +335,7 @@ public class ResourceChangeView extends SpyView implements IResourceChangeListen } } - protected Set eventActions = new HashSet(); + protected Set<Action> eventActions = new HashSet<Action>(); private Action PHANTOMS; private Action POST_BUILD; @@ -404,8 +405,8 @@ public class ResourceChangeView extends SpyView implements IResourceChangeListen protected void fillPullDownBar(IMenuManager manager) { manager.removeAll(); - for (Iterator i = eventActions.iterator(); i.hasNext();) - manager.add((IAction) i.next()); + for (Action action : eventActions) + manager.add(action); manager.add(new Separator("phantoms")); //$NON-NLS-1$ manager.add(PHANTOMS); } diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ResourceContentProvider.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ResourceContentProvider.java index 3be0877f2..a4e085169 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ResourceContentProvider.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ResourceContentProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -83,15 +83,14 @@ public class ResourceContentProvider extends AbstractTreeContentProvider { */ protected void extractPersistentProperties(IResource resource) { try { - Map properties = ((Workspace) ResourcesPlugin.getWorkspace()).getPropertyManager().getProperties(resource); + Map<QualifiedName, String> properties = ((Workspace) ResourcesPlugin.getWorkspace()).getPropertyManager().getProperties(resource); if (properties.isEmpty()) return; // creates a node for persistent properties and populates it TreeContentProviderNode propertiesRootNode = createNode(Messages.resource_persistent_properties); //$NON-NLS-1$ getRootNode().addChild(propertiesRootNode); - for (Iterator i = properties.entrySet().iterator(); i.hasNext();) { - Map.Entry entry = (Map.Entry) i.next(); - propertiesRootNode.addChild(createNode(entry.getKey().toString(), entry.getValue().toString())); + for (Map.Entry<QualifiedName, String> entry : properties.entrySet()) { + propertiesRootNode.addChild(createNode(entry.getKey().toString(), entry.getValue())); } } catch (CoreException ce) { getRootNode().addChild(createNode(NLS.bind(Messages.resource_error_stored_properties, ce.toString()))); //$NON-NLS-1$ @@ -106,7 +105,7 @@ public class ResourceContentProvider extends AbstractTreeContentProvider { protected void extractSessionProperties(IResource resource) { // retrieves all session properties for the selected resource - Map properties = org.eclipse.core.internal.resources.SpySupport.getSessionProperties(resource); + Map<QualifiedName, Object> properties = org.eclipse.core.internal.resources.SpySupport.getSessionProperties(resource); if (properties == null || properties.size() == 0) return; @@ -114,9 +113,7 @@ public class ResourceContentProvider extends AbstractTreeContentProvider { TreeContentProviderNode propertiesRootNode = createNode(Messages.resource_session_properties); //$NON-NLS-1$ getRootNode().addChild(propertiesRootNode); - Set set = properties.entrySet(); - for (Iterator propertiesIter = set.iterator(); propertiesIter.hasNext();) { - Map.Entry entry = (Map.Entry) propertiesIter.next(); + for (Map.Entry<QualifiedName, Object> entry : properties.entrySet()) { propertiesRootNode.addChild(createNode(entry.getKey().toString(), entry.getValue())); } @@ -268,15 +265,13 @@ public class ResourceContentProvider extends AbstractTreeContentProvider { */ protected void extractMarkerAttributes(TreeContentProviderNode markerNode, IMarker marker) throws CoreException { - Map attributes = marker.getAttributes(); + Map<String, Object> attributes = marker.getAttributes(); if (attributes == null || attributes.size() == 0) return; // create a node (under markerNode) for each attribute found - Set entrySet = attributes.entrySet(); - for (Iterator iterator = entrySet.iterator(); iterator.hasNext();) { - Map.Entry mapEntry = (Map.Entry) iterator.next(); - String attributeName = (String) mapEntry.getKey(); + for (Map.Entry<String, Object> mapEntry : attributes.entrySet()) { + String attributeName = mapEntry.getKey(); Object attributeValue = mapEntry.getValue(); // adds each attribute as a subnode under // this marker's node @@ -293,17 +288,15 @@ public class ResourceContentProvider extends AbstractTreeContentProvider { * @param info the resource info object from where to extract information */ protected void extractSyncInfo(ResourceInfo info) { - Map syncInfo = info.getSyncInfo(true); - if (syncInfo == null || syncInfo.size() == 0) + Map<QualifiedName, Object> syncInfo = info.getSyncInfo(true); + if (syncInfo == null || syncInfo.isEmpty()) return; // creates a root node for all sync info TreeContentProviderNode syncInfoParentNode = createNode(Messages.resource_sync_info); //$NON-NLS-1$ getRootNode().addChild(syncInfoParentNode); - Set entrySet = syncInfo.entrySet(); - for (Iterator syncInfoIterator = entrySet.iterator(); syncInfoIterator.hasNext();) { - Map.Entry entry = (Map.Entry) syncInfoIterator.next(); + for (Map.Entry<QualifiedName, Object> entry : syncInfo.entrySet()) { // creates a sync info node String name = entry.getKey().toString(); String value = ByteUtil.byteArrayToString((byte[]) entry.getValue(), MAX_SYNC_INFO_BYTES); diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ResourceView.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ResourceView.java index b7fb0733f..2ec91ff50 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ResourceView.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/ResourceView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -224,6 +224,9 @@ public class ResourceView extends SpyView { * being currently shown. */ private class SelectedResourceChangeListener implements IResourceChangeListener { + public SelectedResourceChangeListener() { + } + public void resourceChanged(IResourceChangeEvent event) { final IResource currentResource = (IResource) viewer.getInput(); diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/markers/MarkerExtensionModel.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/markers/MarkerExtensionModel.java index b7efe9550..1ec711a69 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/markers/MarkerExtensionModel.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/markers/MarkerExtensionModel.java @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (c) 2003, 2005 Geoff Longman and others. + * Copyright (c) 2003, 2015 Geoff Longman and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,7 +28,7 @@ public class MarkerExtensionModel { static public class MarkerInfo { - public MarkerInfo(String id, boolean persistent, List supers, List attributes) { + public MarkerInfo(String id, boolean persistent, List<String> supers, List<String> attributes) { this.id = id; this.persistent = persistent; this.declaredSupers = supers; @@ -36,8 +36,8 @@ public class MarkerExtensionModel { } public boolean persistent; - public List declaredSupers = empty; - public List declaredAttributes = empty; + public List<String> declaredSupers = Collections.emptyList(); + public List<String> declaredAttributes = Collections.emptyList(); public String id; } @@ -45,12 +45,11 @@ public class MarkerExtensionModel { public void markerModelChanged(MarkerExtensionModel newModel); } - static List empty = Collections.unmodifiableList(new ArrayList()); static public String RESOURCES_PROBLEM = IMarker.PROBLEM; static public String RESOURCES_TASK = IMarker.TASK; static public String RESOURCES_BOOKMARK = IMarker.BOOKMARK; static public String RESOURCES_TEXT = IMarker.TEXT; - Map markerMap = new HashMap(); + Map<String, MarkerInfo> markerMap = new HashMap<String, MarkerInfo>(); /** * Constructor for MarkerExtensionHandler. @@ -62,7 +61,7 @@ public class MarkerExtensionModel { } public synchronized MarkerInfo getInfo(String id) { - return (MarkerInfo) markerMap.get(id); + return markerMap.get(id); } private void registerForExtensionChanges() { @@ -93,8 +92,8 @@ public class MarkerExtensionModel { IExtension extension = extensions[i]; String identifier = extension.getUniqueIdentifier(); boolean persistent = false; - ArrayList supersList = new ArrayList(); - ArrayList attributes = new ArrayList(); + ArrayList<String> supersList = new ArrayList<String>(); + ArrayList<String> attributes = new ArrayList<String>(); IConfigurationElement[] configElements = extension.getConfigurationElements(); for (int j = 0; j < configElements.length; ++j) { IConfigurationElement elt = configElements[j]; @@ -122,14 +121,13 @@ public class MarkerExtensionModel { // a cruddy debugging tool. Dumps the model out in pseudo xml // so it's easier to see the relationships! private void dumpMarkerTypes() { - for (Iterator iter = markerMap.keySet().iterator(); iter.hasNext();) { - String type = (String) iter.next(); + for (String type : markerMap.keySet()) { dumpMarkerType(type, 0); } } private void dumpMarkerType(String type, int indent) { - MarkerInfo mtype = (MarkerInfo) markerMap.get(type); + MarkerInfo mtype = markerMap.get(type); printIndented(indent, "<marker type='" + type + "' "); if (mtype == null) { System.out.println("not-found='true'/>"); @@ -150,8 +148,7 @@ public class MarkerExtensionModel { } printlnIndented(indent + 1, "<supers>"); if (hasSupers) { - for (Iterator iter = mtype.declaredSupers.iterator(); iter.hasNext();) { - String superType = (String) iter.next(); + for (String superType : mtype.declaredSupers) { dumpMarkerType(superType, indent + 2); } } diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/markers/MarkerView.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/markers/MarkerView.java index 416332168..7f409b98a 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/markers/MarkerView.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/markers/MarkerView.java @@ -12,6 +12,8 @@ **********************************************************************/ package org.eclipse.core.tools.resources.markers; +import org.eclipse.core.resources.IResource; +import org.eclipse.jface.viewers.ISelectionChangedListener; import java.lang.reflect.InvocationTargetException; import java.util.*; import java.util.List; @@ -67,7 +69,7 @@ public class MarkerView extends ViewPart implements ISelectionListener, IResourc protected MarkerViewPropertySheetPage propertyPage; class SelectionProvider implements ISelectionProvider { - private List listeners = new ArrayList(); + private List<ISelectionChangedListener> listeners = new ArrayList<ISelectionChangedListener>(); private ISelection selection; public void addSelectionChangedListener(ISelectionChangedListener listener) { @@ -85,8 +87,7 @@ public class MarkerView extends ViewPart implements ISelectionListener, IResourc public synchronized void setSelection(ISelection selection) { this.selection = selection; SelectionChangedEvent event = new SelectionChangedEvent(this, selection); - for (Iterator iter = listeners.iterator(); iter.hasNext();) { - ISelectionChangedListener listener = (ISelectionChangedListener) iter.next(); + for (ISelectionChangedListener listener : listeners) { listener.selectionChanged(event); } } @@ -142,7 +143,7 @@ public class MarkerView extends ViewPart implements ISelectionListener, IResourc int count = selection.size(); int deleted = 1; monitor.beginTask("deleting #" + deleted + " of " + count + " markers.", count); - for (Iterator iter = selection.iterator(); iter.hasNext();) { + for (Iterator<?> iter = selection.iterator(); iter.hasNext();) { IMarker marker = (IMarker) iter.next(); try { marker.delete(); @@ -550,7 +551,7 @@ public class MarkerView extends ViewPart implements ISelectionListener, IResourc /** * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class) */ - public Object getAdapter(Class adapter) { + public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { if (adapter == IPropertySheetPage.class) { propertyPage = new MarkerViewPropertySheetPage(this); return propertyPage; @@ -601,4 +602,4 @@ public class MarkerView extends ViewPart implements ISelectionListener, IResourc else child.putTextData(currentResource.getFullPath().toString()); } -}
\ No newline at end of file +} diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/markers/ReadOnlyMarkerPropertySource.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/markers/ReadOnlyMarkerPropertySource.java index 6ebe4f454..bda226a3c 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/markers/ReadOnlyMarkerPropertySource.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/markers/ReadOnlyMarkerPropertySource.java @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (c) 2003, 2005 Geoff Longman and others. + * Copyright (c) 2003, 2015 Geoff Longman and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,6 +11,7 @@ **********************************************************************/ package org.eclipse.core.tools.resources.markers; +import org.eclipse.ui.views.properties.PropertyDescriptor; import java.util.*; import org.eclipse.core.resources.IMarker; import org.eclipse.core.runtime.CoreException; @@ -46,20 +47,19 @@ public class ReadOnlyMarkerPropertySource implements IPropertySource { * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors() */ public IPropertyDescriptor[] getPropertyDescriptors() { - ArrayList descriptors = new ArrayList(); + ArrayList<PropertyDescriptor> descriptors = new ArrayList<PropertyDescriptor>(); findPropertyDescriptors(descriptors); - return (IPropertyDescriptor[]) descriptors.toArray(new IPropertyDescriptor[descriptors.size()]); + return descriptors.toArray(new IPropertyDescriptor[descriptors.size()]); } - private void findPropertyDescriptors(ArrayList descriptorList) { + private void findPropertyDescriptors(ArrayList<PropertyDescriptor> descriptorList) { try { - Set attributesWithoutDescriptors = new HashSet(marker.getAttributes().keySet()); + Set<String> attributesWithoutDescriptors = new HashSet<String>(marker.getAttributes().keySet()); findDeclaredPropertyDescriptorsFor(info, descriptorList, attributesWithoutDescriptors); if (!attributesWithoutDescriptors.isEmpty()) { // we have extra, undeclared attributes. // we will create the correct property descriptor - for (Iterator iter = attributesWithoutDescriptors.iterator(); iter.hasNext();) { - String name = (String) iter.next(); + for (String name : attributesWithoutDescriptors) { PropertyDescriptor desc = new PropertyDescriptor(name, name); desc.setCategory("undeclared attributes"); descriptorList.add(desc); @@ -70,7 +70,7 @@ public class ReadOnlyMarkerPropertySource implements IPropertySource { } } - private void findDeclaredPropertyDescriptorsFor(MarkerExtensionModel.MarkerInfo anInfo, ArrayList descriptorList, Set actualAttributeSet) { + private void findDeclaredPropertyDescriptorsFor(MarkerExtensionModel.MarkerInfo anInfo, List<PropertyDescriptor> descriptorList, Set<String> actualAttributeSet) { if (anInfo == null) return; try { @@ -81,15 +81,13 @@ public class ReadOnlyMarkerPropertySource implements IPropertySource { } catch (CoreException e) { // ignore } - for (Iterator iter = anInfo.declaredAttributes.iterator(); iter.hasNext();) { - String attr = (String) iter.next(); + for (String attr : anInfo.declaredAttributes) { PropertyDescriptor desc = new PropertyDescriptor(attr, attr); desc.setCategory(anInfo.id); descriptorList.add(desc); actualAttributeSet.remove(attr); } - for (Iterator iter = anInfo.declaredSupers.iterator(); iter.hasNext();) { - String superId = (String) iter.next(); + for (String superId : anInfo.declaredSupers) { MarkerExtensionModel.MarkerInfo superInfo = model.getInfo(superId); if (superInfo == null) { CoreResourcesToolsPlugin.logProblem("internal error. could not find supertype" + superId + "of marker" + info.id, IStatus.ERROR); diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersDumpingStrategy_1.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersDumpingStrategy_1.java index f5b3ba3ec..26d3572fd 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersDumpingStrategy_1.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersDumpingStrategy_1.java @@ -40,13 +40,10 @@ import org.eclipse.core.tools.metadata.*; * </pre> */ public class MarkersDumpingStrategy_1 implements IStringDumpingStrategy { - - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#dumpStringContents(DataInputStream) - */ + @Override public String dumpStringContents(DataInputStream dataInput) throws IOException, DumpException { - StringBuffer contents = new StringBuffer(); - List markerTypes = new ArrayList(); + StringBuilder contents = new StringBuilder(); + List<String> markerTypes = new ArrayList<String>(); while (dataInput.available() > 0) { String resourceName = dataInput.readUTF(); contents.append("Resource: "); //$NON-NLS-1$ @@ -58,7 +55,7 @@ public class MarkersDumpingStrategy_1 implements IStringDumpingStrategy { return contents.toString(); } - private void dumpMarkers(DataInputStream input, StringBuffer contents, List markerTypes) throws IOException, DumpException { + private void dumpMarkers(DataInputStream input, StringBuilder contents, List<String> markerTypes) throws IOException, DumpException { int markersSize = input.readInt(); contents.append("Markers ["); //$NON-NLS-1$ contents.append(markersSize); @@ -74,7 +71,7 @@ public class MarkersDumpingStrategy_1 implements IStringDumpingStrategy { } } - private void dumpAttributes(DataInputStream input, StringBuffer contents) throws IOException, DumpException { + private void dumpAttributes(DataInputStream input, StringBuilder contents) throws IOException, DumpException { int attributesSize = input.readInt(); contents.append("Attributes ["); //$NON-NLS-1$ contents.append(attributesSize); @@ -105,7 +102,7 @@ public class MarkersDumpingStrategy_1 implements IStringDumpingStrategy { } } - private void dumpMarkerType(DataInputStream input, StringBuffer contents, List markerTypes) throws IOException, DumpException { + private void dumpMarkerType(DataInputStream input, StringBuilder contents, List<String> markerTypes) throws IOException, DumpException { String markerType; int constant = input.readInt(); switch (constant) { @@ -114,7 +111,7 @@ public class MarkersDumpingStrategy_1 implements IStringDumpingStrategy { markerTypes.add(markerType); break; case MarkersDumper.INDEX : - markerType = (String) markerTypes.get(input.readInt()); + markerType = markerTypes.get(input.readInt()); break; default : throw new PartialDumpException("Invalid marker type constant found: " + constant, contents); //$NON-NLS-1$ @@ -124,9 +121,7 @@ public class MarkersDumpingStrategy_1 implements IStringDumpingStrategy { contents.append('\n'); } - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#getFormatDescription() - */ + @Override public String getFormatDescription() { return "Markers snapshot file version 1"; //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersDumpingStrategy_2.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersDumpingStrategy_2.java index 0c8ea5d1d..81f1fa701 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersDumpingStrategy_2.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersDumpingStrategy_2.java @@ -40,13 +40,10 @@ import org.eclipse.core.tools.metadata.*; * </pre> */ public class MarkersDumpingStrategy_2 implements IStringDumpingStrategy { - - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#dumpStringContents(DataInputStream) - */ + @Override public String dumpStringContents(DataInputStream dataInput) throws IOException, DumpException { - StringBuffer contents = new StringBuffer(); - List markerTypes = new ArrayList(); + StringBuilder contents = new StringBuilder(); + List<String> markerTypes = new ArrayList<String>(); while (dataInput.available() > 0) { String resourceName = dataInput.readUTF(); contents.append("Resource: "); //$NON-NLS-1$ @@ -58,7 +55,7 @@ public class MarkersDumpingStrategy_2 implements IStringDumpingStrategy { return contents.toString(); } - private void dumpMarkers(DataInputStream input, StringBuffer contents, List markerTypes) throws IOException, DumpException { + private void dumpMarkers(DataInputStream input, StringBuilder contents, List<String> markerTypes) throws IOException, DumpException { int markersSize = input.readInt(); contents.append("Markers ["); //$NON-NLS-1$ contents.append(markersSize); @@ -73,7 +70,7 @@ public class MarkersDumpingStrategy_2 implements IStringDumpingStrategy { } } - private void dumpAttributes(DataInputStream input, StringBuffer contents) throws IOException, DumpException { + private void dumpAttributes(DataInputStream input, StringBuilder contents) throws IOException, DumpException { int attributesSize = input.readShort(); contents.append("Attributes ["); //$NON-NLS-1$ contents.append(attributesSize); @@ -104,7 +101,7 @@ public class MarkersDumpingStrategy_2 implements IStringDumpingStrategy { } } - private void dumpMarkerType(DataInputStream input, StringBuffer contents, List markerTypes) throws IOException, DumpException { + private void dumpMarkerType(DataInputStream input, StringBuilder contents, List<String> markerTypes) throws IOException, DumpException { String markerType; byte constant = input.readByte(); switch (constant) { @@ -113,7 +110,7 @@ public class MarkersDumpingStrategy_2 implements IStringDumpingStrategy { markerTypes.add(markerType); break; case MarkersDumper.INDEX : - markerType = (String) markerTypes.get(input.readInt()); + markerType = markerTypes.get(input.readInt()); break; default : throw new PartialDumpException("Invalid marker type constant found: " + constant, contents); //$NON-NLS-1$ @@ -123,9 +120,7 @@ public class MarkersDumpingStrategy_2 implements IStringDumpingStrategy { contents.append('\n'); } - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#getFormatDescription() - */ + @Override public String getFormatDescription() { return "Markers snapshot file version 2"; //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersDumpingStrategy_3.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersDumpingStrategy_3.java index 8b6be37f1..900814b15 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersDumpingStrategy_3.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersDumpingStrategy_3.java @@ -42,13 +42,10 @@ import org.eclipse.core.tools.metadata.*; */ public class MarkersDumpingStrategy_3 implements IStringDumpingStrategy { - - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#dumpStringContents(DataInputStream) - */ + @Override public String dumpStringContents(DataInputStream dataInput) throws IOException, DumpException { - StringBuffer contents = new StringBuffer(); - List markerTypes = new ArrayList(); + StringBuilder contents = new StringBuilder(); + List<String> markerTypes = new ArrayList<String>(); while (dataInput.available() > 0) { String resourceName = dataInput.readUTF(); contents.append("Resource: "); //$NON-NLS-1$ @@ -60,7 +57,7 @@ public class MarkersDumpingStrategy_3 implements IStringDumpingStrategy { return contents.toString(); } - private void dumpMarkers(DataInputStream input, StringBuffer contents, List markerTypes) throws IOException, DumpException { + private void dumpMarkers(DataInputStream input, StringBuilder contents, List<String> markerTypes) throws IOException, DumpException { int markersSize = input.readInt(); contents.append("Markers ["); //$NON-NLS-1$ @@ -79,7 +76,7 @@ public class MarkersDumpingStrategy_3 implements IStringDumpingStrategy { } } - private void dumpAttributes(DataInputStream input, StringBuffer contents) throws IOException, DumpException { + private void dumpAttributes(DataInputStream input, StringBuilder contents) throws IOException, DumpException { int attributesSize = input.readShort(); contents.append("Attributes ["); //$NON-NLS-1$ contents.append(attributesSize); @@ -110,7 +107,7 @@ public class MarkersDumpingStrategy_3 implements IStringDumpingStrategy { } } - private void dumpMarkerType(DataInputStream input, StringBuffer contents, List markerTypes) throws IOException, DumpException { + private void dumpMarkerType(DataInputStream input, StringBuilder contents, List<String> markerTypes) throws IOException, DumpException { String markerType; byte constant = input.readByte(); switch (constant) { @@ -119,7 +116,7 @@ public class MarkersDumpingStrategy_3 implements IStringDumpingStrategy { markerTypes.add(markerType); break; case MarkersDumper.INDEX : - markerType = (String) markerTypes.get(input.readInt()); + markerType = markerTypes.get(input.readInt()); break; default : throw new PartialDumpException("Invalid marker type constant found: " + constant, contents); //$NON-NLS-1$ @@ -129,9 +126,7 @@ public class MarkersDumpingStrategy_3 implements IStringDumpingStrategy { contents.append('\n'); } - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#getFormatDescription() - */ + @Override public String getFormatDescription() { return "Markers snapshot file version 3"; //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersSnapshotDumpingStrategy_1.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersSnapshotDumpingStrategy_1.java index f61d76e00..0f0acf1ed 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersSnapshotDumpingStrategy_1.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersSnapshotDumpingStrategy_1.java @@ -41,14 +41,11 @@ import org.eclipse.core.tools.metadata.*; * </pre> */ class MarkersSnapshotDumpingStrategy_1 implements IStringDumpingStrategy { - - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#dumpStringContents(DataInputStream) - */ + @Override public String dumpStringContents(DataInputStream input) throws IOException, DumpException { - StringBuffer contents = new StringBuffer(); + StringBuilder contents = new StringBuilder(); DataInputStream dataInput = new DataInputStream(input); - List markerTypes = new ArrayList(); + List<String> markerTypes = new ArrayList<String>(); String resourceName = dataInput.readUTF(); contents.append("Resource: "); //$NON-NLS-1$ contents.append(resourceName); @@ -57,7 +54,7 @@ class MarkersSnapshotDumpingStrategy_1 implements IStringDumpingStrategy { return contents.toString(); } - private void dumpMarkers(DataInputStream input, StringBuffer contents, List markerTypes) throws IOException, DumpException { + private void dumpMarkers(DataInputStream input, StringBuilder contents, List<String> markerTypes) throws IOException, DumpException { int markersSize = input.readInt(); contents.append("Markers ["); //$NON-NLS-1$ contents.append(markersSize); @@ -72,7 +69,7 @@ class MarkersSnapshotDumpingStrategy_1 implements IStringDumpingStrategy { } } - private void dumpAttributes(DataInputStream input, StringBuffer contents) throws IOException, DumpException { + private void dumpAttributes(DataInputStream input, StringBuilder contents) throws IOException, DumpException { int attributesSize = input.readShort(); contents.append("Attributes ["); //$NON-NLS-1$ contents.append(attributesSize); @@ -103,7 +100,7 @@ class MarkersSnapshotDumpingStrategy_1 implements IStringDumpingStrategy { } } - private void dumpMarkerType(DataInputStream input, StringBuffer contents, List markerTypes) throws IOException, DumpException { + private void dumpMarkerType(DataInputStream input, StringBuilder contents, List<String> markerTypes) throws IOException, DumpException { String markerType; byte constant = input.readByte(); switch (constant) { @@ -112,7 +109,7 @@ class MarkersSnapshotDumpingStrategy_1 implements IStringDumpingStrategy { markerTypes.add(markerType); break; case MarkersSnapshotDumper.INDEX : - markerType = (String) markerTypes.get(input.readInt()); + markerType = markerTypes.get(input.readInt()); break; default : throw new PartialDumpException("Invalid marker type constant found: " + constant, contents); //$NON-NLS-1$ @@ -122,9 +119,7 @@ class MarkersSnapshotDumpingStrategy_1 implements IStringDumpingStrategy { contents.append('\n'); } - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#getFormatDescription() - */ + @Override public String getFormatDescription() { return "Markers snapshot file version 1"; //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersSnapshotDumpingStrategy_2.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersSnapshotDumpingStrategy_2.java index b327849b8..b3f2f2261 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersSnapshotDumpingStrategy_2.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/MarkersSnapshotDumpingStrategy_2.java @@ -42,14 +42,11 @@ import org.eclipse.core.tools.metadata.*; * </pre> */ class MarkersSnapshotDumpingStrategy_2 implements IStringDumpingStrategy { - - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#dumpStringContents(DataInputStream) - */ + @Override public String dumpStringContents(DataInputStream input) throws IOException, DumpException { - StringBuffer contents = new StringBuffer(); + StringBuilder contents = new StringBuilder(); DataInputStream dataInput = new DataInputStream(input); - List markerTypes = new ArrayList(); + List<String> markerTypes = new ArrayList<String>(); String resourceName = dataInput.readUTF(); contents.append("Resource: "); //$NON-NLS-1$ contents.append(resourceName); @@ -58,7 +55,7 @@ class MarkersSnapshotDumpingStrategy_2 implements IStringDumpingStrategy { return contents.toString(); } - private void dumpMarkers(DataInputStream input, StringBuffer contents, List markerTypes) throws IOException, DumpException { + private void dumpMarkers(DataInputStream input, StringBuilder contents, List<String> markerTypes) throws IOException, DumpException { int markersSize = input.readInt(); contents.append("Markers ["); //$NON-NLS-1$ contents.append(markersSize); @@ -76,7 +73,7 @@ class MarkersSnapshotDumpingStrategy_2 implements IStringDumpingStrategy { } } - private void dumpAttributes(DataInputStream input, StringBuffer contents) throws IOException, DumpException { + private void dumpAttributes(DataInputStream input, StringBuilder contents) throws IOException, DumpException { int attributesSize = input.readShort(); contents.append("Attributes ["); //$NON-NLS-1$ contents.append(attributesSize); @@ -108,7 +105,7 @@ class MarkersSnapshotDumpingStrategy_2 implements IStringDumpingStrategy { } } - private void dumpMarkerType(DataInputStream input, StringBuffer contents, List markerTypes) throws IOException, DumpException { + private void dumpMarkerType(DataInputStream input, StringBuilder contents, List<String> markerTypes) throws IOException, DumpException { String markerType; byte constant = input.readByte(); @@ -118,7 +115,7 @@ class MarkersSnapshotDumpingStrategy_2 implements IStringDumpingStrategy { markerTypes.add(markerType); break; case MarkersSnapshotDumper.INDEX : - markerType = (String) markerTypes.get(input.readInt()); + markerType = markerTypes.get(input.readInt()); break; default : throw new PartialDumpException("Invalid marker type constant found: " + constant, contents); //$NON-NLS-1$ @@ -128,9 +125,7 @@ class MarkersSnapshotDumpingStrategy_2 implements IStringDumpingStrategy { contents.append('\n'); } - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#getFormatDescription() - */ + @Override public String getFormatDescription() { return "Markers file version 2"; //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/PropertiesIndexDumper.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/PropertiesIndexDumper.java index 25e1ba3f2..2e1a0e297 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/PropertiesIndexDumper.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/PropertiesIndexDumper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,7 +29,7 @@ public class PropertiesIndexDumper extends AbstractDumper { contents.append("entries: "); contents.append(entryCount); contents.append('\n'); - List qualifierIndex = new ArrayList(); + List<String> qualifierIndex = new ArrayList<String>(); for (int i = 0; i < entryCount; i++) { contents.append("Key: "); contents.append(source.readUTF()); @@ -51,7 +51,7 @@ public class PropertiesIndexDumper extends AbstractDumper { int index = source.readInt(); if (index < 0 || index >= qualifierIndex.size()) throw new DumpException("Invalid qualifier index: " + index + ". Table size is " + qualifierIndex.size()); - qualifier = (String) qualifierIndex.get(index); + qualifier = qualifierIndex.get(index); break; default : { contents.append("Invalid qualifier tag: "); diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoDumper.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoDumper.java index 57cb8ea86..e63b11a72 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoDumper.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoDumper.java @@ -26,9 +26,7 @@ public class SyncInfoDumper extends MultiStrategyDumper { static final byte INDEX = 1; static final byte QNAME = 2; - /** - * @see org.eclipse.core.tools.metadata.MultiStrategyDumper#getStringDumpingStrategy(java.io.DataInputStream) - */ + @Override protected IStringDumpingStrategy getStringDumpingStrategy(DataInputStream dataInput) throws Exception { int versionId = dataInput.readInt(); IStringDumpingStrategy strategy; diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoDumpingStrategy_2.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoDumpingStrategy_2.java index 2df92e923..3bbfbbf0c 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoDumpingStrategy_2.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoDumpingStrategy_2.java @@ -33,13 +33,10 @@ import org.eclipse.core.tools.metadata.*; * </pre> */ class SyncInfoDumpingStrategy_2 implements IStringDumpingStrategy { - - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#dumpStringContents(DataInputStream) - */ + @Override public String dumpStringContents(DataInputStream dataInput) throws IOException, DumpException { - StringBuffer contents = new StringBuffer(); - List readPartners = new ArrayList(); + StringBuilder contents = new StringBuilder(); + List<String> readPartners = new ArrayList<String>(); String resourceName; while (dataInput.available() > 0) { resourceName = dataInput.readUTF(); @@ -53,7 +50,7 @@ class SyncInfoDumpingStrategy_2 implements IStringDumpingStrategy { return contents.toString(); } - private void dumpReadPartners(DataInputStream input, StringBuffer contents, List readPartners) throws DumpException, IOException { + private void dumpReadPartners(DataInputStream input, StringBuilder contents, List<String> readPartners) throws DumpException, IOException { int size = input.readInt(); for (int i = 0; i < size; i++) { String qualifiedName; @@ -69,7 +66,7 @@ class SyncInfoDumpingStrategy_2 implements IStringDumpingStrategy { readPartners.add(qualifiedName); break; case SyncInfoDumper.INDEX : - qualifiedName = (String) readPartners.get(input.readInt()); + qualifiedName = readPartners.get(input.readInt()); break; default : //if we get here then the sync info file is corrupt @@ -92,11 +89,8 @@ class SyncInfoDumpingStrategy_2 implements IStringDumpingStrategy { } } - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#getFormatDescription() - */ + @Override public String getFormatDescription() { return "Sync info file version 2"; //$NON-NLS-1$ } - } diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoDumpingStrategy_3.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoDumpingStrategy_3.java index 5d0cfe456..88fc06f59 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoDumpingStrategy_3.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoDumpingStrategy_3.java @@ -33,13 +33,10 @@ import org.eclipse.core.tools.metadata.*; * </pre> */ class SyncInfoDumpingStrategy_3 implements IStringDumpingStrategy { - - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#dumpStringContents(DataInputStream) - */ + @Override public String dumpStringContents(DataInputStream dataInput) throws IOException, DumpException { - StringBuffer contents = new StringBuffer(); - List readPartners = new ArrayList(); + StringBuilder contents = new StringBuilder(); + List<String> readPartners = new ArrayList<String>(); String resourceName; while (dataInput.available() > 0) { resourceName = dataInput.readUTF(); @@ -53,7 +50,7 @@ class SyncInfoDumpingStrategy_3 implements IStringDumpingStrategy { return contents.toString(); } - private void dumpReadPartners(DataInputStream input, StringBuffer contents, List readPartners) throws DumpException, IOException { + private void dumpReadPartners(DataInputStream input, StringBuilder contents, List<String> readPartners) throws DumpException, IOException { int size = input.readInt(); for (int i = 0; i < size; i++) { @@ -71,7 +68,7 @@ class SyncInfoDumpingStrategy_3 implements IStringDumpingStrategy { readPartners.add(qualifiedName); break; case SyncInfoDumper.INDEX : - qualifiedName = (String) readPartners.get(input.readInt()); + qualifiedName = readPartners.get(input.readInt()); break; default : //if we get here then the sync info file is corrupt @@ -91,15 +88,11 @@ class SyncInfoDumpingStrategy_3 implements IStringDumpingStrategy { contents.append("): "); //$NON-NLS-1$ contents.append(ByteUtil.byteArrayToString(bytes, 64)); contents.append('\n'); - } } - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#getFormatDescription() - */ + @Override public String getFormatDescription() { return "Sync info file version 3"; //$NON-NLS-1$ } - } diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoSnapshotDumper.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoSnapshotDumper.java index 0a6969a1e..8c64daf1e 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoSnapshotDumper.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoSnapshotDumper.java @@ -20,13 +20,10 @@ import org.eclipse.core.tools.metadata.*; * @see org.eclipse.core.tools.resources.metadata.SyncInfoSnapshotDumpingStrategy_3 */ public class SyncInfoSnapshotDumper extends MultiStrategyDumper { - static final byte INDEX = 1; static final byte QNAME = 2; - /** - * @see org.eclipse.core.tools.metadata.MultiStrategyDumper#getStringDumpingStrategy(DataInputStream) - */ + @Override protected IStringDumpingStrategy getStringDumpingStrategy(DataInputStream dataInput) throws Exception { int versionId = dataInput.readInt(); if (versionId != 3) @@ -34,9 +31,7 @@ public class SyncInfoSnapshotDumper extends MultiStrategyDumper { return new SyncInfoSnapshotDumpingStrategy_3(); } - /** - * @see org.eclipse.core.tools.metadata.AbstractDumper#openInputStream(File) - */ + @Override protected InputStream openInputStream(File file) throws IOException { return new SafeChunkyInputStream(file); } diff --git a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoSnapshotDumpingStrategy_3.java b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoSnapshotDumpingStrategy_3.java index 909e46a47..65721a4f1 100644 --- a/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoSnapshotDumpingStrategy_3.java +++ b/bundles/org.eclipse.core.tools.resources/src/org/eclipse/core/tools/resources/metadata/SyncInfoSnapshotDumpingStrategy_3.java @@ -29,11 +29,9 @@ import org.eclipse.core.tools.metadata.IStringDumpingStrategy; * </pre> */ class SyncInfoSnapshotDumpingStrategy_3 implements IStringDumpingStrategy { - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#dumpStringContents(DataInputStream) - */ + @Override public String dumpStringContents(DataInputStream dataInput) throws IOException { - StringBuffer contents = new StringBuffer(); + StringBuilder contents = new StringBuilder(); String resourceName = dataInput.readUTF(); contents.append("Resource: "); //$NON-NLS-1$ @@ -44,7 +42,7 @@ class SyncInfoSnapshotDumpingStrategy_3 implements IStringDumpingStrategy { return contents.toString(); } - private void dumpReadPartners(DataInputStream input, StringBuffer contents) throws IOException { + private void dumpReadPartners(DataInputStream input, StringBuilder contents) throws IOException { int size = input.readInt(); for (int i = 0; i < size; i++) { String qualifier = input.readUTF(); @@ -69,11 +67,8 @@ class SyncInfoSnapshotDumpingStrategy_3 implements IStringDumpingStrategy { } } - /** - * @see org.eclipse.core.tools.metadata.IStringDumpingStrategy#getFormatDescription() - */ + @Override public String getFormatDescription() { return "Sync info snapshot file version 3"; //$NON-NLS-1$ } - } diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant/.classpath b/tests/org.eclipse.core.tests.resources.saveparticipant/.classpath index 751c8f2e5..121e527a9 100644 --- a/tests/org.eclipse.core.tests.resources.saveparticipant/.classpath +++ b/tests/org.eclipse.core.tests.resources.saveparticipant/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.core.tests.resources.saveparticipant/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..ef8a789ca --- /dev/null +++ b/tests/org.eclipse.core.tests.resources.saveparticipant/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +eclipse.preferences.version=1 +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.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.resources.saveparticipant/META-INF/MANIFEST.MF index 191d945fe..dfa7937e3 100644 --- a/tests/org.eclipse.core.tests.resources.saveparticipant/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.core.tests.resources.saveparticipant/META-INF/MANIFEST.MF @@ -16,3 +16,4 @@ Require-Bundle: org.eclipse.core.resources, org.eclipse.core.tests.resources.saveparticipant3, org.eclipse.core.filesystem Eclipse-LazyStart: true +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant1/.classpath b/tests/org.eclipse.core.tests.resources.saveparticipant1/.classpath index 751c8f2e5..121e527a9 100644 --- a/tests/org.eclipse.core.tests.resources.saveparticipant1/.classpath +++ b/tests/org.eclipse.core.tests.resources.saveparticipant1/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant1/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.core.tests.resources.saveparticipant1/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..ef8a789ca --- /dev/null +++ b/tests/org.eclipse.core.tests.resources.saveparticipant1/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +eclipse.preferences.version=1 +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.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant1/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.resources.saveparticipant1/META-INF/MANIFEST.MF index ffc014313..85c3c8e5b 100644 --- a/tests/org.eclipse.core.tests.resources.saveparticipant1/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.core.tests.resources.saveparticipant1/META-INF/MANIFEST.MF @@ -12,4 +12,5 @@ Require-Bundle: org.eclipse.core.resources, org.junit, org.eclipse.core.runtime Eclipse-LazyStart: true +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant2/.classpath b/tests/org.eclipse.core.tests.resources.saveparticipant2/.classpath index 751c8f2e5..121e527a9 100644 --- a/tests/org.eclipse.core.tests.resources.saveparticipant2/.classpath +++ b/tests/org.eclipse.core.tests.resources.saveparticipant2/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant2/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.core.tests.resources.saveparticipant2/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..ef8a789ca --- /dev/null +++ b/tests/org.eclipse.core.tests.resources.saveparticipant2/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +eclipse.preferences.version=1 +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.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant2/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.resources.saveparticipant2/META-INF/MANIFEST.MF index cdcae64a1..91bacf7eb 100644 --- a/tests/org.eclipse.core.tests.resources.saveparticipant2/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.core.tests.resources.saveparticipant2/META-INF/MANIFEST.MF @@ -12,3 +12,4 @@ Require-Bundle: org.eclipse.core.resources, org.eclipse.core.runtime Eclipse-LazyStart: true Bundle-Activator: org.eclipse.core.tests.resources.saveparticipant2.SaveParticipant2Plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant3/.classpath b/tests/org.eclipse.core.tests.resources.saveparticipant3/.classpath index 751c8f2e5..121e527a9 100644 --- a/tests/org.eclipse.core.tests.resources.saveparticipant3/.classpath +++ b/tests/org.eclipse.core.tests.resources.saveparticipant3/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant3/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.core.tests.resources.saveparticipant3/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..ef8a789ca --- /dev/null +++ b/tests/org.eclipse.core.tests.resources.saveparticipant3/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +eclipse.preferences.version=1 +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.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/tests/org.eclipse.core.tests.resources.saveparticipant3/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.resources.saveparticipant3/META-INF/MANIFEST.MF index 67978359b..504f28bea 100644 --- a/tests/org.eclipse.core.tests.resources.saveparticipant3/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.core.tests.resources.saveparticipant3/META-INF/MANIFEST.MF @@ -12,3 +12,4 @@ Require-Bundle: org.eclipse.core.resources, org.eclipse.core.runtime Eclipse-LazyStart: true Bundle-Activator: org.eclipse.core.tests.resources.saveparticipant3.SaveParticipant3Plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/tests/org.eclipse.core.tests.resources/.classpath b/tests/org.eclipse.core.tests.resources/.classpath index 64c5e31b7..4c62a8048 100644 --- a/tests/org.eclipse.core.tests.resources/.classpath +++ b/tests/org.eclipse.core.tests.resources/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/tests/org.eclipse.core.tests.resources/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.core.tests.resources/.settings/org.eclipse.jdt.core.prefs index 850dd320c..aa3a8e553 100644 --- a/tests/org.eclipse.core.tests.resources/.settings/org.eclipse.jdt.core.prefs +++ b/tests/org.eclipse.core.tests.resources/.settings/org.eclipse.jdt.core.prefs @@ -8,9 +8,10 @@ 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.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -90,7 +91,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enab org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 diff --git a/tests/org.eclipse.core.tests.resources/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.resources/META-INF/MANIFEST.MF index 9d6d92e7f..e801cbe1d 100644 --- a/tests/org.eclipse.core.tests.resources/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.core.tests.resources/META-INF/MANIFEST.MF @@ -39,5 +39,5 @@ Require-Bundle: org.eclipse.osgi.services, org.eclipse.core.expressions Bundle-ActivationPolicy: lazy Bundle-Activator: org.eclipse.core.tests.internal.resources.TestActivator -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Eclipse-BundleShape: dir diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/BucketTreeTests.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/BucketTreeTests.java index 39b351fea..acd98925a 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/BucketTreeTests.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/BucketTreeTests.java @@ -103,10 +103,9 @@ public class BucketTreeTests extends ResourceTest { Map<String, String> value = (Map<String, String>) entryValue; int length = value.size(); destination.writeShort(length); - for (Iterator<Map.Entry<String, String>> i = value.entrySet().iterator(); i.hasNext();) { - Map.Entry<String, String> element = i.next(); - destination.writeUTF(element.getKey()); - destination.writeUTF(element.getValue()); + for (Map.Entry<String, String> entry : value.entrySet()) { + destination.writeUTF(entry.getKey()); + destination.writeUTF(entry.getValue()); } } } diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/HistoryStoreTest.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/HistoryStoreTest.java index 5d568f66c..28bddd57e 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/HistoryStoreTest.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/HistoryStoreTest.java @@ -41,11 +41,11 @@ public class HistoryStoreTest extends ResourceTest { String dump() { StringBuffer buffer = new StringBuffer(); buffer.append("Expected:\n"); - for (Iterator<Integer> i = expected.iterator(); i.hasNext();) - buffer.append("\t" + i.next() + "\n"); + for (Integer integer : expected) + buffer.append("\t" + integer + "\n"); buffer.append("Actual:\n"); - for (Iterator<Integer> i = actual.iterator(); i.hasNext();) - buffer.append("\t" + i.next() + "\n"); + for (Integer integer : actual) + buffer.append("\t" + integer + "\n"); return buffer.toString(); } @@ -68,8 +68,7 @@ public class HistoryStoreTest extends ResourceTest { message += dump(); throw new VerificationFailedException(message); } - for (Iterator<Integer> i = expected.iterator(); i.hasNext();) { - Integer status = i.next(); + for (Integer status : expected) { if (!actual.contains(status)) { message = "Expected and actual results differ.\n"; message += dump(); diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/ChangeDescription.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/ChangeDescription.java index 93de4239a..a0f1c84ca 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/ChangeDescription.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/ChangeDescription.java @@ -11,7 +11,8 @@ *******************************************************************************/ package org.eclipse.core.tests.internal.mapping; -import java.util.*; +import java.util.ArrayList; +import java.util.List; import org.eclipse.core.resources.*; import org.eclipse.core.resources.mapping.ModelStatus; import org.eclipse.core.runtime.*; @@ -90,8 +91,7 @@ public class ChangeDescription { private void ensureResourceCovered(IResource resource, List<IResource> list) { IPath path = resource.getFullPath(); - for (Iterator<IResource> iter = list.iterator(); iter.hasNext();) { - IResource root = iter.next(); + for (IResource root : list) { if (root.getFullPath().isPrefixOf(path)) { return; } diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/ChangeValidationTest.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/ChangeValidationTest.java index bded3e90c..18de52232 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/ChangeValidationTest.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/ChangeValidationTest.java @@ -11,7 +11,8 @@ *******************************************************************************/ package org.eclipse.core.tests.internal.mapping; -import java.util.*; +import java.util.ArrayList; +import java.util.List; import junit.framework.Test; import junit.framework.TestSuite; import org.eclipse.core.resources.*; @@ -46,8 +47,7 @@ public class ChangeValidationTest extends ResourceTest { actualMessages.add(message); } if (expectedMessages.length < actualMessages.size()) { - for (Iterator<String> iter = actualMessages.iterator(); iter.hasNext();) { - String actual = iter.next(); + for (String actual : actualMessages) { boolean found = false; for (int i = 0; i < expectedMessages.length; i++) { String expected = expectedMessages[i]; @@ -60,10 +60,9 @@ public class ChangeValidationTest extends ResourceTest { fail("Unexpected message returned: " + actual); } } else { - for (int i = 0; i < expectedMessages.length; i++) { - String string = expectedMessages[i]; - if (!actualMessages.contains(string)) { - fail("Expect message missing: " + string); + for (String expectedMessage : expectedMessages) { + if (!actualMessages.contains(expectedMessage)) { + fail("Expect message missing: " + expectedMessage); } } } diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/resources/ModelObjectReaderWriterTest.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/resources/ModelObjectReaderWriterTest.java index 1cdcb4acb..9906b3c18 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/resources/ModelObjectReaderWriterTest.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/resources/ModelObjectReaderWriterTest.java @@ -14,10 +14,12 @@ package org.eclipse.core.tests.internal.resources; import java.io.*; import java.net.URI; import java.net.URL; -import java.util.*; +import java.util.HashMap; +import java.util.Map; import junit.framework.Test; import junit.framework.TestSuite; -import org.eclipse.core.filesystem.*; +import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.filesystem.IFileStore; import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.internal.localstore.SafeFileOutputStream; import org.eclipse.core.internal.resources.*; @@ -166,16 +168,15 @@ public class ModelObjectReaderWriterTest extends ResourceTest { Map<String, String> args = commands[i].getArguments(); Map<String, String> args2 = commands2[i].getArguments(); assertEquals(errorTag + ".2." + (i + 1) + "0", args.size(), args2.size()); - Set<String> keys = args.keySet(); int x = 1; - for (Iterator<String> j = keys.iterator(); j.hasNext(); x++) { - Object key = j.next(); + for (String key : args.keySet()) { String value = args.get(key); String value2 = args2.get(key); if (value == null) assertNull(errorTag + ".2." + (i + 1) + x, value2); else assertTrue(errorTag + ".3." + (i + 1) + x, args.get(key).equals((args2.get(key)))); + x++; } } } @@ -186,15 +187,14 @@ public class ModelObjectReaderWriterTest extends ResourceTest { return; } assertEquals(errorTag + ".4.01", links.size(), links2.size()); - Set<IPath> keys = links.keySet(); int x = 1; - for (Iterator<IPath> i = keys.iterator(); i.hasNext(); x++) { - IPath key = i.next(); + for (IPath key : links.keySet()) { LinkDescription value = links.get(key); LinkDescription value2 = links2.get(key); assertTrue(errorTag + ".4." + x, value.getProjectRelativePath().equals(value2.getProjectRelativePath())); assertEquals(errorTag + ".5." + x, value.getType(), value2.getType()); assertEquals(errorTag + ".6." + x, value.getLocationURI(), value2.getLocationURI()); + x++; } } @@ -552,8 +552,7 @@ public class ModelObjectReaderWriterTest extends ResourceTest { createFileInFileSystem(location, stream); ProjectDescription projDesc = reader.read(location); ensureDoesNotExistInFileSystem(location.toFile()); - for (Iterator<LinkDescription> i = projDesc.getLinks().values().iterator(); i.hasNext();) { - LinkDescription link = i.next(); + for (LinkDescription link : projDesc.getLinks().values()) { assertEquals("1.0." + link.getProjectRelativePath(), LONG_LOCATION_URI, link.getLocationURI()); } } finally { @@ -575,8 +574,7 @@ public class ModelObjectReaderWriterTest extends ResourceTest { createFileInFileSystem(location, stream); ProjectDescription projDesc = reader.read(location); ensureDoesNotExistInFileSystem(location.toFile()); - for (Iterator<LinkDescription> i = projDesc.getLinks().values().iterator(); i.hasNext();) { - LinkDescription link = i.next(); + for (LinkDescription link : projDesc.getLinks().values()) { assertEquals("1.0." + link.getProjectRelativePath(), LONG_LOCATION_URI, link.getLocationURI()); } } finally { diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/resources/ResourceInfoTest.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/resources/ResourceInfoTest.java index cace1d097..77045f142 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/resources/ResourceInfoTest.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/resources/ResourceInfoTest.java @@ -12,8 +12,7 @@ package org.eclipse.core.tests.internal.resources; import java.io.*; -import java.util.Enumeration; -import java.util.Hashtable; +import java.util.Map; import junit.framework.Test; import junit.framework.TestSuite; import org.eclipse.core.internal.resources.ResourceInfo; @@ -54,16 +53,16 @@ public class ResourceInfoTest extends ResourceTest { assertEquals(message, expected[i], actual[i]); } - static public void assertEquals(String message, Hashtable<?, ?> expected, Hashtable<?, ?> actual) { + static public void assertEquals(String message, Map<?, ?> expected, Map<?, ?> actual) { if (expected == null && actual == null) return; if (expected == null || actual == null) assertTrue(message, false); assertEquals(message, expected.size(), actual.size()); - for (Enumeration<?> e = expected.keys(); e.hasMoreElements();) { - Object key = e.nextElement(); + for (Map.Entry<?, ?> entry : expected.entrySet()) { + Object key = entry.getKey(); assertTrue(message, actual.containsKey(key)); - Object expectedValue = expected.get(key); + Object expectedValue = entry.getValue(); Object actualValue = actual.get(key); if (expectedValue instanceof byte[] && actualValue instanceof byte[]) assertEquals(message, (byte[]) expectedValue, (byte[]) actualValue); diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/utils/ObjectMapTest.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/utils/ObjectMapTest.java index c6c55f0d3..7418bd889 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/utils/ObjectMapTest.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/utils/ObjectMapTest.java @@ -12,7 +12,6 @@ package org.eclipse.core.tests.internal.utils; import java.util.*; -import java.util.Map.Entry; import junit.framework.Test; import junit.framework.TestSuite; import org.eclipse.core.internal.utils.ObjectMap; @@ -131,7 +130,7 @@ public class ObjectMapTest extends ResourceTest { public void testEntrySet() { ObjectMap<Integer, Object> map = populateMap(MAXIMUM); - Set<Entry<Integer, Object>> entries = map.entrySet(); + Set<Map.Entry<Integer, Object>> entries = map.entrySet(); for (int i = 0; i < MAXIMUM; i++) assertTrue("1.0." + i, contains(entries, values[i])); } @@ -139,9 +138,8 @@ public class ObjectMapTest extends ResourceTest { /** * The given set is a set of Map.Entry objects. */ - private boolean contains(Set<Entry<Integer, Object>> set, Object value) { - for (Iterator<Entry<Integer, Object>> i = set.iterator(); i.hasNext();) { - Map.Entry<Integer, Object> entry = i.next(); + private boolean contains(Set<Map.Entry<Integer, Object>> set, Object value) { + for (Map.Entry<Integer, Object> entry : set) { if (entry.getValue().equals(value)) return true; } @@ -164,7 +162,7 @@ public class ObjectMapTest extends ResourceTest { * Bug 62231 - empty ObjectMap.toHashMap() causes NullPointerException */ public void testBug_62231() { - ObjectMap<?, ?> map = new ObjectMap<Object, Object>(); + ObjectMap<Object, Object> map = new ObjectMap<Object, Object>(); try { map.entrySet(); } catch (NullPointerException e) { diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IFileTest.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IFileTest.java index 7b0e859ac..1acf6065a 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IFileTest.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IFileTest.java @@ -13,7 +13,6 @@ package org.eclipse.core.tests.resources; import java.io.*; import java.util.ArrayList; -import java.util.Iterator; import junit.framework.Test; import junit.framework.TestSuite; import org.eclipse.core.resources.*; @@ -243,8 +242,8 @@ public class IFileTest extends ResourceTest { * Makes sure file requirements are met (out of sync, workspace only, etc). */ public void refreshFiles() { - for (Iterator<IFile> it = allFiles.iterator(); it.hasNext();) - refreshFile(it.next()); + for (IFile file : allFiles) + refreshFile(file); } protected void setUp() throws Exception { diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IPathVariableTest.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IPathVariableTest.java index 6a3c543c8..407f3f422 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IPathVariableTest.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IPathVariableTest.java @@ -116,9 +116,8 @@ public class IPathVariableTest extends ResourceTest { message += dump(); throw new VerificationFailedException(message); } - for (Iterator<Event> i = expected.iterator(); i.hasNext();) { - Event e = i.next(); - if (!actual.contains(e)) { + for (Event event : expected) { + if (!actual.contains(event)) { message = "Expected and actual results differ.\n"; message += dump(); throw new VerificationFailedException(message); @@ -138,11 +137,11 @@ public class IPathVariableTest extends ResourceTest { String dump() { StringBuffer buffer = new StringBuffer(); buffer.append("Expected:\n"); - for (Iterator<Event> i = expected.iterator(); i.hasNext();) - buffer.append("\t" + i.next() + "\n"); + for (Event event : expected) + buffer.append("\t" + event + "\n"); buffer.append("Actual:\n"); - for (Iterator<Event> i = actual.iterator(); i.hasNext();) - buffer.append("\t" + i.next() + "\n"); + for (Event event : actual) + buffer.append("\t" + event + "\n"); return buffer.toString(); } } diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IProjectTest.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IProjectTest.java index dd01cdb78..a95be0691 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IProjectTest.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IProjectTest.java @@ -12,7 +12,8 @@ package org.eclipse.core.tests.resources; import java.io.ByteArrayInputStream; -import java.util.*; +import java.util.HashSet; +import java.util.Set; import junit.framework.Test; import junit.framework.TestSuite; import org.eclipse.core.filesystem.IFileStore; @@ -2478,8 +2479,8 @@ public class IProjectTest extends ResourceTest { fail("2.2", e); } } finally { - for (Iterator<IPath> i = pathsToDelete.iterator(); i.hasNext();) { - Workspace.clear(i.next().toFile()); + for (IPath path : pathsToDelete) { + Workspace.clear(path.toFile()); } } } diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceTest.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceTest.java index 679028767..4690e78eb 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceTest.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceTest.java @@ -270,12 +270,13 @@ public class IResourceTest extends ResourceTest { } /** - * Returns an array of all projects in the given resource array. */ + * Returns an array of all projects in the given resource array. + */ protected IProject[] getProjects(IResource[] resources) { - ArrayList<IResource> list = new ArrayList<IResource>(); + ArrayList<IProject> list = new ArrayList<IProject>(); for (int i = 0; i < resources.length; i++) { if (resources[i].getType() == IResource.PROJECT) { - list.add(resources[i]); + list.add((IProject) resources[i]); } } return list.toArray(new IProject[list.size()]); diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerSetTest.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerSetTest.java index 8e6eee6b2..900ebd577 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerSetTest.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerSetTest.java @@ -44,9 +44,9 @@ public class MarkerSetTest extends ResourceTest { IMarkerSetElement[] m2 = new IMarkerSetElement[array2.length]; System.arraycopy(array2, 0, m2, 0, array2.length); java.util.Comparator<IMarkerSetElement> compare = new java.util.Comparator<IMarkerSetElement>() { - public int compare(IMarkerSetElement o1, IMarkerSetElement o2) { - long id1 = o1.getId(); - long id2 = o2.getId(); + public int compare(IMarkerSetElement e1, IMarkerSetElement e2) { + long id1 = e1.getId(); + long id2 = e2.getId(); if (id1 == id2) return 0; return id1 < id2 ? -1 : 1; diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceDeltaVerifier.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceDeltaVerifier.java index 37c7a9b1f..bfabed8c2 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceDeltaVerifier.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceDeltaVerifier.java @@ -11,8 +11,7 @@ *******************************************************************************/ package org.eclipse.core.tests.resources; -import java.util.Enumeration; -import java.util.Hashtable; +import java.util.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.junit.Assert; @@ -300,10 +299,9 @@ public class ResourceDeltaVerifier extends Assert implements IResourceChangeList } } - Enumeration<IResource> keys = h.keys(); - while (keys.hasMoreElements()) { - IResource childResource = keys.nextElement(); - IResourceDelta childDelta = h.get(childResource); + for (Map.Entry<IResource, IResourceDelta> entry : h.entrySet()) { + IResource childResource = entry.getKey(); + IResourceDelta childDelta = entry.getValue(); recordMissingChild(childResource.getFullPath(), childDelta.getKind(), true); } @@ -311,10 +309,7 @@ public class ResourceDeltaVerifier extends Assert implements IResourceChangeList internalVerifyDelta(affectedChildren[i]); } - keys = h.keys(); - while (keys.hasMoreElements()) { - IResource childResource = keys.nextElement(); - IResourceDelta childDelta = h.get(childResource); + for (IResourceDelta childDelta : h.values()) { internalVerifyDelta(childDelta); } } @@ -444,18 +439,9 @@ public class ResourceDeltaVerifier extends Assert implements IResourceChangeList * are met after iterating over a resource delta. */ private void finishVerification() { - Hashtable<IPath, IPath> resourcePaths = new Hashtable<IPath, IPath>(); - - Enumeration<IPath> keys = fExpectedChanges.keys(); - while (keys.hasMoreElements()) { - IPath key = keys.nextElement(); - resourcePaths.put(key, key); - } - - keys = resourcePaths.keys(); - while (keys.hasMoreElements()) { - IPath resourcePath = keys.nextElement(); + HashSet<IPath> resourcePaths = new HashSet<IPath>(fExpectedChanges.keySet()); + for (IPath resourcePath : resourcePaths) { fMessage.append("Checking expectations for "); fMessage.append(resourcePath); fMessage.append("\n"); diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceVisitorVerifier.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceVisitorVerifier.java index 3ccf4fc4d..b8e6db689 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceVisitorVerifier.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceVisitorVerifier.java @@ -11,7 +11,8 @@ *******************************************************************************/ package org.eclipse.core.tests.resources; -import java.util.*; +import java.util.HashSet; +import java.util.Set; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceVisitor; import org.junit.Assert; @@ -53,9 +54,9 @@ public class ResourceVisitorVerifier extends Assert implements IResourceVisitor if (verified) return; // Add messages for the resources which weren't visited but were expected. - for (Iterator<IResource> i = expected.iterator(); i.hasNext();) { + for (IResource resource : expected) { success = false; - log(i.next().getFullPath() + " was not visited."); + log(resource.getFullPath() + " was not visited."); } verified = true; } diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_265810.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_265810.java index c3461ae6a..7e7b843fc 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_265810.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_265810.java @@ -184,7 +184,7 @@ public class Bug_265810 extends ResourceTest { public boolean visit(IResourceDelta delta) { IResource resource = delta.getResource(); if (resource instanceof IFile && !resource.getName().equals(".project")) - resourceDeltas.add(delta); + addToResourceDelta(delta); if (delta.getAffectedChildren().length > 0) return true; return false; @@ -195,4 +195,8 @@ public class Bug_265810 extends ResourceTest { } } }; + + boolean addToResourceDelta(IResourceDelta delta) { + return resourceDeltas.add(delta); + } } diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/SimpleBuilder.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/SimpleBuilder.java index 8edbc7e2f..62f5f58ee 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/SimpleBuilder.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/SimpleBuilder.java @@ -20,18 +20,18 @@ import org.eclipse.core.runtime.IProgressMonitor; * A builder that does not do anything. */ public class SimpleBuilder extends IncrementalProjectBuilder { + /** contants */ + public static final String BUILDER_ID = "org.eclipse.core.tests.resources.simplebuilder"; protected int triggerForLastBuild; protected static SimpleBuilder instance; - /** contants */ - public static final String BUILDER_ID = "org.eclipse.core.tests.resources.simplebuilder"; - public SimpleBuilder() { super(); instance = this; } + @Override protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) { triggerForLastBuild = kind; return null; @@ -41,9 +41,6 @@ public class SimpleBuilder extends IncrementalProjectBuilder { return instance; } - /** - * - */ protected void startupOnInitialize() { } diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/SignaledBuilder.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/SignaledBuilder.java index ce2aa622c..bb7184fd1 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/SignaledBuilder.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/SignaledBuilder.java @@ -37,6 +37,7 @@ public class SignaledBuilder extends IncrementalProjectBuilder { reset(); } + @Override protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException { instances.put(getProject(), this); try { |
