From 007c431c1f36a68654d238fc68f7912c9530b228 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Sun, 7 Aug 2016 20:50:09 -0700 Subject: Fixed compiler warnings. Change-Id: Ie22173941de1768217692d0cc087999333bee764 --- .../team/tests/ccvs/core/CVSTestLogListener.java | 24 ++++++++++------------ .../eclipse/team/tests/ccvs/core/CVSTestSetup.java | 9 +++----- .../team/tests/ccvs/core/CVSUITestSetup.java | 4 +--- .../team/tests/ccvs/core/CommandLineCVSClient.java | 3 ++- .../team/tests/ccvs/core/EclipseCVSClient.java | 15 +++++++------- 5 files changed, 25 insertions(+), 30 deletions(-) diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestLogListener.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestLogListener.java index ee90c4d93..6bd523796 100644 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestLogListener.java +++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestLogListener.java @@ -19,39 +19,37 @@ import org.eclipse.team.internal.ccvs.core.CVSException; * Listener that accumulates test errors */ public class CVSTestLogListener implements ILogListener { - - Map errors = new HashMap(); + Map> errors = new HashMap<>(); - /* (non-Javadoc) - * @see org.eclipse.core.runtime.ILogListener#logging(org.eclipse.core.runtime.IStatus, java.lang.String) - */ + @Override public void logging(IStatus status, String plugin) { - List pluginErrors = (List)errors.get(plugin); + List pluginErrors = errors.get(plugin); if (pluginErrors == null) { - pluginErrors = new ArrayList(); + pluginErrors = new ArrayList<>(); errors.put(plugin, pluginErrors); } pluginErrors.add(status); } public void checkErrors() throws CoreException { - if (errors.isEmpty()) return; - List allErrors = new ArrayList(); - for (Iterator iter = errors.values().iterator(); iter.hasNext();) { - allErrors.addAll((List)iter.next()); + if (errors.isEmpty()) + return; + List allErrors = new ArrayList<>(); + for (List pluginErrors : errors.values()) { + allErrors.addAll(pluginErrors); } errors.clear(); if (allErrors.isEmpty()) return; IStatus status = null; if (allErrors.size() == 1) { - status = (IStatus)allErrors.get(0); + status = allErrors.get(0); if (!status.isMultiStatus()) { throw new CVSException(status); } } if (status == null) { status = new MultiStatus("org.eclipse.team.tests.cvs.core", 0, - (IStatus[]) allErrors.toArray(new IStatus[allErrors.size()]), + allErrors.toArray(new IStatus[allErrors.size()]), "Errors were logged during this test. Check the log file for details", null); } throw new CoreException(status); diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java index d8cc96d06..e0811ff21 100644 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java +++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java @@ -9,6 +9,7 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.team.tests.ccvs.core; + import java.io.*; import junit.extensions.TestSetup; @@ -132,6 +133,7 @@ public class CVSTestSetup extends TestSetup { private static void startBackgroundPipeThread(final InputStream is, final PrintStream os, final String prefix) { new Thread() { + @Override public void run() { BufferedReader reader = null; try { @@ -166,6 +168,7 @@ public class CVSTestSetup extends TestSetup { executeRemoteCommand(repository, "cvs -d " + repoRoot + " init"); } + @Override public void setUp() throws CoreException { if (repository == null) { repository = setupRepository(REPOSITORY_LOCATION); @@ -180,7 +183,6 @@ public class CVSTestSetup extends TestSetup { } protected CVSRepositoryLocation setupRepository(String location) throws CVSException { - // Validate that we can connect, also creates and caches the repository location. This // is important for the UI tests. CVSRepositoryLocation repository = (CVSRepositoryLocation)KnownRepositories.getInstance().getRepository(location); @@ -213,10 +215,5 @@ public class CVSTestSetup extends TestSetup { return repository; } - - public void tearDown() throws CVSException { - // Nothing to do here - } - } diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSUITestSetup.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSUITestSetup.java index a91052c05..9bdba38be 100644 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSUITestSetup.java +++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSUITestSetup.java @@ -22,9 +22,7 @@ public class CVSUITestSetup extends CVSTestSetup implements Test { super(test); } - /* (non-Javadoc) - * @see junit.extensions.TestSetup#setUp() - */ + @Override public void setUp() throws CoreException { super.setUp(); PlatformUI.getWorkbench().getDecoratorManager().setEnabled(CVSUIPlugin.DECORATOR_ID, true); diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CommandLineCVSClient.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CommandLineCVSClient.java index 3088fc4d9..5a32dd3c6 100644 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CommandLineCVSClient.java +++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CommandLineCVSClient.java @@ -12,18 +12,19 @@ package org.eclipse.team.tests.ccvs.core; import java.io.File; -import junit.framework.Assert; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.team.internal.ccvs.core.CVSException; import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation; +import org.junit.Assert; public class CommandLineCVSClient implements ICVSClient { public static final ICVSClient INSTANCE = new CommandLineCVSClient(); private static final String cvsExecutable = System.getProperty("eclipse.cvs.command"); + @Override public void executeCommand(ICVSRepositoryLocation repositoryLocation, IContainer localRoot, String command, String[] globalOptions, String[] localOptions, String[] arguments) throws CVSException { diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseCVSClient.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseCVSClient.java index 6c071c895..bc4d6fbfd 100644 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseCVSClient.java +++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseCVSClient.java @@ -14,7 +14,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import junit.framework.Assert; import org.eclipse.core.resources.IContainer; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; @@ -28,10 +27,11 @@ import org.eclipse.team.internal.ccvs.core.client.Session; import org.eclipse.team.internal.ccvs.core.client.Command.GlobalOption; import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption; import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; +import org.junit.Assert; public class EclipseCVSClient implements ICVSClient { public static final ICVSClient INSTANCE = new EclipseCVSClient(); - private static final HashMap commandPool = new HashMap(); + private static final HashMap commandPool = new HashMap<>(); static { commandPool.put("update", Command.UPDATE); commandPool.put("co", Command.CHECKOUT); @@ -47,6 +47,7 @@ public class EclipseCVSClient implements ICVSClient { commandPool.put("diff", Command.DIFF); } + @Override public void executeCommand(ICVSRepositoryLocation repositoryLocation, IContainer localRoot, String command, String[] globalOptions, String[] localOptions, String[] arguments) throws CVSException { @@ -68,17 +69,17 @@ public class EclipseCVSClient implements ICVSClient { Assert.assertTrue(cvsLocalRoot.exists()); // get command instance - Command cvsCommand = (Command) commandPool.get(command); + Command cvsCommand = commandPool.get(command); // get global options - List globals = new ArrayList(); + List globals = new ArrayList<>(); for (int i = 0; i < globalOptions.length; i++) { globals.add(new CustomGlobalOption(globalOptions[i])); } - GlobalOption[] cvsGlobalOptions = (GlobalOption[]) globals.toArray(new GlobalOption[globals.size()]); + GlobalOption[] cvsGlobalOptions = globals.toArray(new GlobalOption[globals.size()]); // get local options - List locals = new ArrayList(); + List locals = new ArrayList(); for (int i = 0; i < localOptions.length; i++) { String option = localOptions[i]; String argument = null; @@ -87,7 +88,7 @@ public class EclipseCVSClient implements ICVSClient { } locals.add(new CustomLocalOption(option, argument)); } - LocalOption[] cvsLocalOptions = (LocalOption[]) locals.toArray(new LocalOption[locals.size()]); + LocalOption[] cvsLocalOptions = locals.toArray(new LocalOption[locals.size()]); // execute command IProgressMonitor monitor = new NullProgressMonitor(); -- cgit v1.2.3