Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Thoms2019-11-05 09:22:55 +0000
committerKarsten Thoms2019-11-05 09:22:55 +0000
commitccbc475b37291efe48da366a51c6ce4391cb8056 (patch)
tree0bf94c382b3c52a5d22a9fb74bb44124225304f5
parent1eeaa0a89be9a58365d84bb4815b432aa9d070f2 (diff)
downloadeclipse.platform.team-ccbc475b37291efe48da366a51c6ce4391cb8056.tar.gz
eclipse.platform.team-ccbc475b37291efe48da366a51c6ce4391cb8056.tar.xz
eclipse.platform.team-ccbc475b37291efe48da366a51c6ce4391cb8056.zip
Resolve raw type warnings
Added type information to generic collections. Removed unnecessary casts. Change-Id: I1092de2592dbc1d0895690431b9ebc3ae70e2ebb Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
-rw-r--r--bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/JSchUIPlugin.java2
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java4
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/PathTree.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java16
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java18
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRepositoryLocationMatcher.java48
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java8
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java18
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java7
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java16
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/AnnotateListener.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/EditorsListener.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java15
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ModuleDefinitionsListener.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ServerMessageLineMatcher.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/ChangeSetResourceMapping.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java16
22 files changed, 103 insertions, 109 deletions
diff --git a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/JSchUIPlugin.java b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/JSchUIPlugin.java
index b8eef4087..43d6d4908 100644
--- a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/JSchUIPlugin.java
+++ b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/JSchUIPlugin.java
@@ -103,7 +103,7 @@ public void start(BundleContext context) throws Exception {
store.setValue(IUIConstants.PREF_FIRST_STARTUP, false);
}
- tracker = new ServiceTracker(getBundle().getBundleContext(),IJSchService.class.getName(), null);
+ tracker = new ServiceTracker<>(getBundle().getBundleContext(), IJSchService.class.getName(), null);
tracker.open();
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java
index 3405624cd..c6c52fa01 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java
@@ -197,7 +197,7 @@ public class DiffTree implements IDiffTree {
* <code>endInput</code> should be done in a finally block as illustrated in the
* following code snippet.
* </p>
- *
+ *
* <pre>
* try {
* set.beginInput();
@@ -337,7 +337,7 @@ public class DiffTree implements IDiffTree {
* @return all the diffs contained in this diff tree
*/
public IDiff[] getDiffs() {
- return (IDiff[]) pathTree.values().toArray(new IDiff[pathTree.size()]);
+ return pathTree.values().toArray(new IDiff[pathTree.size()]);
}
@Override
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/PathTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/PathTree.java
index dc7e98007..fa13cd431 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/PathTree.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/PathTree.java
@@ -263,7 +263,7 @@ public class PathTree {
* Return all the values contained in this path tree.
* @return all the values in the tree
*/
- public synchronized Collection values() {
+ public synchronized Collection<Object> values() {
List<Object> result = new ArrayList<>();
for (Iterator iter = objects.keySet().iterator(); iter.hasNext();) {
IPath path = (IPath) iter.next();
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
index 00a84652b..5c3674b5e 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
@@ -60,12 +60,12 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ISubs
*/
public void resetRoots(IResource[] resources, CVSTag[] tags) {
if (this.resources != null) {
- List removed = new ArrayList();
+ List<ISubscriberChangeEvent> removed = new ArrayList<>();
for (IResource resource : this.resources) {
removed.add(new SubscriberChangeEvent(this, ISubscriberChangeEvent.ROOT_REMOVED, resource));
}
this.resources = new IResource[0];
- fireTeamResourceChange((ISubscriberChangeEvent[]) removed.toArray(new ISubscriberChangeEvent[removed.size()]));
+ fireTeamResourceChange(removed.toArray(new ISubscriberChangeEvent[removed.size()]));
if (tree != null) {
tree.dispose();
tree = null;
@@ -116,7 +116,7 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ISubs
@Override
public void subscriberResourceChanged(ISubscriberChangeEvent[] deltas) {
- List outgoingDeltas = new ArrayList(deltas.length);
+ List<ISubscriberChangeEvent> outgoingDeltas = new ArrayList<>(deltas.length);
for (ISubscriberChangeEvent delta : deltas) {
if ((delta.getFlags() & ISubscriberChangeEvent.ROOT_REMOVED) != 0) {
IResource resource = delta.getResource();
@@ -134,12 +134,12 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ISubs
}
}
- fireTeamResourceChange((SubscriberChangeEvent[]) outgoingDeltas.toArray(new SubscriberChangeEvent[outgoingDeltas.size()]));
+ fireTeamResourceChange(outgoingDeltas.toArray(new SubscriberChangeEvent[outgoingDeltas.size()]));
}
private SubscriberChangeEvent[] handleRemovedRoot(IResource removedRoot) {
// Determine if any of the roots of the compare are affected
- List removals = new ArrayList(resources.length);
+ List<IResource> removals = new ArrayList<>(resources.length);
for (IResource root : resources) {
if (removedRoot.getFullPath().isPrefixOf(root.getFullPath())) {
// The root is no longer managed by CVS
@@ -156,15 +156,15 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ISubs
}
// Adjust the roots of the subscriber
- List newRoots = new ArrayList(resources.length);
+ List<IResource> newRoots = new ArrayList<>(resources.length);
newRoots.addAll(Arrays.asList(resources));
newRoots.removeAll(removals);
- resources = (IResource[]) newRoots.toArray(new IResource[newRoots.size()]);
+ resources = newRoots.toArray(new IResource[newRoots.size()]);
// Create the deltas for the removals
SubscriberChangeEvent[] deltas = new SubscriberChangeEvent[removals.size()];
for (int i = 0; i < deltas.length; i++) {
- deltas[i] = new SubscriberChangeEvent(this, ISubscriberChangeEvent.ROOT_REMOVED, (IResource)removals.get(i));
+ deltas[i] = new SubscriberChangeEvent(this, ISubscriberChangeEvent.ROOT_REMOVED, removals.get(i));
}
return deltas;
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
index 7903dd799..f20bc522f 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
@@ -97,7 +97,7 @@ public class CVSProviderPlugin extends Plugin {
private static final String REPOSITORIES_STATE_FILE = ".cvsProviderState"; //$NON-NLS-1$
// version numbers for the state file (a positive number indicates version 1)
private static final int REPOSITORIES_STATE_FILE_VERSION_2 = -1;
- private static List decoratorEnablementListeners = new ArrayList();
+ private static List<ICVSDecoratorEnablementListener> decoratorEnablementListeners = new ArrayList<>();
private CVSWorkspaceSubscriber cvsWorkspaceSubscriber;
@@ -290,7 +290,7 @@ public class CVSProviderPlugin extends Plugin {
super.start(context);
// register debug options listener
- Hashtable properties = new Hashtable(2);
+ Hashtable<String,String> properties = new Hashtable<>(2);
properties.put(DebugOptions.LISTENER_SYMBOLICNAME, ID);
debugRegistration = context.registerService(DebugOptionsListener.class, Policy.DEBUG_OPTIONS_LISTENER, properties);
@@ -312,7 +312,7 @@ public class CVSProviderPlugin extends Plugin {
// Must load the change set manager on startup since it listens to deltas
getChangeSetManager();
- tracker = new ServiceTracker(getBundle().getBundleContext(), IJSchService.class.getName(), null);
+ tracker = new ServiceTracker<>(getBundle().getBundleContext(), IJSchService.class.getName(), null);
tracker.open();
}
@@ -427,7 +427,7 @@ public class CVSProviderPlugin extends Plugin {
public static void broadcastDecoratorEnablementChanged(final boolean enabled) {
ICVSDecoratorEnablementListener[] listeners;
synchronized(decoratorEnablementListeners) {
- listeners = (ICVSDecoratorEnablementListener[]) decoratorEnablementListeners.toArray(new ICVSDecoratorEnablementListener[decoratorEnablementListeners.size()]);
+ listeners = decoratorEnablementListeners.toArray(new ICVSDecoratorEnablementListener[decoratorEnablementListeners.size()]);
}
for (ICVSDecoratorEnablementListener listener : listeners) {
ISafeRunnable code = new ISafeRunnable() {
@@ -704,16 +704,16 @@ public class CVSProviderPlugin extends Plugin {
return pass==null ? "" : (String) pass; //$NON-NLS-1$
}
- private Map getAuthInfo() {
+ private Map<String,String> getAuthInfo() {
// Retrieve username and password from keyring.
- Map authInfo = Platform.getAuthorizationInfo(FAKE_URL, "proxy", ""); //$NON-NLS-1$ //$NON-NLS-2$
- return authInfo!=null ? authInfo : Collections.EMPTY_MAP;
+ Map<String,String> authInfo = Platform.getAuthorizationInfo(FAKE_URL, "proxy", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ return authInfo!=null ? authInfo : Collections.emptyMap();
}
public void setProxyAuth(String proxyUser, String proxyPass) {
- Map authInfo = getAuthInfo();
+ Map<String,String> authInfo = getAuthInfo();
if (authInfo.isEmpty()) {
- authInfo = new java.util.HashMap(4);
+ authInfo = new java.util.HashMap<>(4);
}
if (proxyUser != null) {
authInfo.put(INFO_PROXY_USER, proxyUser);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRepositoryLocationMatcher.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRepositoryLocationMatcher.java
index d46978bd0..3a5f41f86 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRepositoryLocationMatcher.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRepositoryLocationMatcher.java
@@ -25,31 +25,25 @@ public class CVSRepositoryLocationMatcher {
private static final String PSERVER = "pserver"; //$NON-NLS-1$
private static final String EXT = "ext"; //$NON-NLS-1$
- private static Comparator COMPATIBLE_LOCATIONS_COMPARATOR = (o1, o2) -> {
- if (o1 instanceof ICVSRepositoryLocation
- && o2 instanceof ICVSRepositoryLocation) {
- ICVSRepositoryLocation rl1 = (ICVSRepositoryLocation) o1;
- ICVSRepositoryLocation rl2 = (ICVSRepositoryLocation) o2;
- String name1 = rl1.getMethod().getName();
- String name2 = rl2.getMethod().getName();
-
- if (!name1.equals(name2) && isCompatible(rl1, rl2, false)) {
- if (name1.equals(EXTSSH))
- return -1;
- if (name2.equals(EXTSSH))
- return 1;
- if (name1.equals(PSERVER))
- return -1;
- if (name2.equals(PSERVER))
- return 1;
- if (name1.equals(EXT))
- return -1;
- if (name2.equals(EXT))
- return 1;
- }
- return name1.compareTo(name2);
+ private static Comparator<ICVSRepositoryLocation> COMPATIBLE_LOCATIONS_COMPARATOR = (rl1, rl2) -> {
+ String name1 = rl1.getMethod().getName();
+ String name2 = rl2.getMethod().getName();
+
+ if (!name1.equals(name2) && isCompatible(rl1, rl2, false)) {
+ if (name1.equals(EXTSSH))
+ return -1;
+ if (name2.equals(EXTSSH))
+ return 1;
+ if (name1.equals(PSERVER))
+ return -1;
+ if (name2.equals(PSERVER))
+ return 1;
+ if (name1.equals(EXT))
+ return -1;
+ if (name2.equals(EXT))
+ return 1;
}
- return 0;
+ return name1.compareTo(name2);
};
public static Map<IProject, List<ICVSRepositoryLocation>> prepareSuggestedRepositoryLocations(
@@ -98,9 +92,9 @@ public class CVSRepositoryLocationMatcher {
ICVSRepositoryLocation projectSetRepositoryLocation = (ICVSRepositoryLocation) i
.next();
- List matching = new ArrayList();
- List compatible = new ArrayList();
- List list = new ArrayList();
+ List<ICVSRepositoryLocation> matching = new ArrayList<>();
+ List<ICVSRepositoryLocation> compatible = new ArrayList<>();
+ List<ICVSRepositoryLocation> list = new ArrayList<>();
for (Iterator j = knownRepositories.iterator(); j.hasNext();) {
ICVSRepositoryLocation knownRepositoryLocation = (ICVSRepositoryLocation) j
.next();
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
index 417b222d9..aed5ad6f3 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
@@ -195,7 +195,7 @@ public class CVSTeamProvider extends RepositoryProvider {
* Get the arguments to be passed to a commit or update
*/
private String[] getValidArguments(IResource[] resources, LocalOption[] options) throws CVSException {
- List arguments = new ArrayList(resources.length);
+ List<String> arguments = new ArrayList<>(resources.length);
for (IResource resource : resources) {
checkIsChild(resource);
IPath cvsPath = resource.getFullPath().removeFirstSegments(1);
@@ -205,7 +205,7 @@ public class CVSTeamProvider extends RepositoryProvider {
arguments.add(cvsPath.toString());
}
}
- return (String[])arguments.toArray(new String[arguments.size()]);
+ return arguments.toArray(new String[arguments.size()]);
}
private ICVSResource[] getCVSArguments(IResource[] resources) {
@@ -299,7 +299,7 @@ public class CVSTeamProvider extends RepositoryProvider {
final IStatus[] result = new IStatus[] { ICommandOutputListener.OK };
workspaceRoot.getLocalRoot().run(monitor1 -> {
final Map /* from KSubstOption to List of String */ filesToAdmin = new HashMap();
- final Collection /* of ICVSFile */ filesToCommitAsText = new HashSet(); // need fast lookup
+ final Collection<ICVSFile> filesToCommitAsText = new HashSet<>(); // need fast lookup
final boolean useCRLF = IS_CRLF_PLATFORM && (CVSProviderPlugin.getPlugin().isUsePlatformLineend());
/*** determine the resources to be committed and/or admin'd ***/
@@ -369,7 +369,7 @@ public class CVSTeamProvider extends RepositoryProvider {
Command.NO_GLOBAL_OPTIONS,
new LocalOption[] { Command.DO_NOT_RECURSE, Commit.FORCE,
Command.makeArgumentOption(Command.MESSAGE_OPTION, keywordChangeComment) },
- (ICVSResource[]) filesToCommitAsText.toArray(new ICVSResource[filesToCommitAsText.size()]),
+ filesToCommitAsText.toArray(new ICVSResource[filesToCommitAsText.size()]),
filesToCommitAsText,
null,
Policy.subMonitorFor(monitor1, filesToCommitAsText.size()));
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
index dfbabc211..c0afe7c57 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
@@ -83,7 +83,7 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
* @see org.eclipse.team.core.sync.ISyncTreeSubscriber#roots()
*/
public IResource[] roots() {
- List result = new ArrayList();
+ List<IProject> result = new ArrayList<>();
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (IProject project : projects) {
if(project.isOpen()) {
@@ -93,7 +93,7 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
}
}
}
- return (IProject[]) result.toArray(new IProject[result.size()]);
+ return result.toArray(new IProject[result.size()]);
}
@Override
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java
index 9571b6cd8..0f098d3bb 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java
@@ -84,14 +84,14 @@ public class Checkout extends Command {
Assert.isTrue(session.getLocalRoot().isFolder());
// Send the information about the local workspace resources to the server
- List resourcesToSend = new ArrayList(resources.length);
+ List<ICVSResource> resourcesToSend = new ArrayList<>(resources.length);
for (ICVSResource resource : resources) {
if (resource.exists() && resource.isFolder() && ((ICVSFolder)resource).isCVSFolder()) {
resourcesToSend.add(resource);
}
}
if ( ! resourcesToSend.isEmpty()) {
- resources = (ICVSResource[]) resourcesToSend.toArray(new ICVSResource[resourcesToSend.size()]);
+ resources = resourcesToSend.toArray(new ICVSResource[resourcesToSend.size()]);
new FileStructureVisitor(session, localOptions, true, true).visit(session, resources, monitor);
} else {
monitor.beginTask(null, 100);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
index 36471692c..885ddd29e 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
@@ -88,7 +88,7 @@ public abstract class Command extends Request {
/*** Local options: keyword substitution mode ***/
// valid for: add admin checkout export import update
- private static final Map ksubstOptionMap = new HashMap();
+ private static final Map<String, KSubstOption> ksubstOptionMap = new HashMap<>();
public static final KSubstOption KSUBST_BINARY = new KSubstOption("-kb"); //$NON-NLS-1$
public static final KSubstOption KSUBST_TEXT = new KSubstOption("-ko"); //$NON-NLS-1$
public static final KSubstOption KSUBST_TEXT_EXPAND = new KSubstOption("-kkv"); //$NON-NLS-1$
@@ -573,13 +573,13 @@ public abstract class Command extends Request {
if (!this.isElementOf(options)) {
return options;
}
- List result = new ArrayList();
+ List<LocalOption> result = new ArrayList<>();
for (LocalOption option : options) {
if (!option.equals(this)) {
result.add(option);
}
}
- return (LocalOption[]) result.toArray(new LocalOption[result.size()]);
+ return result.toArray(new LocalOption[result.size()]);
}
}
/**
@@ -603,7 +603,7 @@ public abstract class Command extends Request {
*/
public static KSubstOption fromMode(String mode) {
if (mode.length() == 0) mode = "-kkv"; // use default //$NON-NLS-1$
- KSubstOption option = (KSubstOption) ksubstOptionMap.get(mode);
+ KSubstOption option = ksubstOptionMap.get(mode);
if (option == null) option = new KSubstOption(mode, true);
return option;
}
@@ -622,7 +622,7 @@ public abstract class Command extends Request {
* Returns an array of all valid modes.
*/
public static KSubstOption[] getAllKSubstOptions() {
- return (KSubstOption[]) ksubstOptionMap.values().toArray(new KSubstOption[ksubstOptionMap.size()]);
+ return ksubstOptionMap.values().toArray(new KSubstOption[ksubstOptionMap.size()]);
}
/**
* Returns the entry line mode string for this instance. Note that it might return blank strings
@@ -745,13 +745,13 @@ public abstract class Command extends Request {
* @return an array of all arguments of belonging to matching options
*/
protected static String[] collectOptionArguments(Option[] array, String option) {
- List /* of String */ list = new ArrayList();
+ List<String> list = new ArrayList<>();
for (int i = 0; i < array.length; ++i) {
if (array[i].getOption().equals(option)) {
list.add(array[i].argument);
}
}
- return (String[]) list.toArray(new String[list.size()]);
+ return list.toArray(new String[list.size()]);
}
/**
@@ -806,11 +806,11 @@ public abstract class Command extends Request {
protected String[] convertArgumentsForOpenSession(ICVSResource[] arguments, Session openSession) throws CVSException {
// Convert arguments
- List stringArguments = new ArrayList(arguments.length);
+ List<String> stringArguments = new ArrayList<>(arguments.length);
for (ICVSResource argument : arguments) {
stringArguments.add(argument.getRelativePath(openSession.getLocalRoot()));
}
- return (String[]) stringArguments.toArray(new String[stringArguments.size()]);
+ return stringArguments.toArray(new String[stringArguments.size()]);
}
/**
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java
index 8e68dff51..e756fc111 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java
@@ -69,7 +69,7 @@ public class RTag extends RemoteCommand {
}
// Add the source tag to the local options
- List modifiedLocalOptions = new ArrayList(localOptions.length + 1);
+ List<LocalOption> modifiedLocalOptions = new ArrayList<>(localOptions.length + 1);
if (sourceTag==null) sourceTag = CVSTag.DEFAULT;
modifiedLocalOptions.addAll(Arrays.asList(localOptions));
modifiedLocalOptions.add(makeTagOption(sourceTag));
@@ -87,7 +87,7 @@ public class RTag extends RemoteCommand {
System.arraycopy(arguments, 0, newArguments, 1, arguments.length);
return execute(session, globalOptions,
- (LocalOption[]) modifiedLocalOptions.toArray(new LocalOption[modifiedLocalOptions.size()]),
+ modifiedLocalOptions.toArray(new LocalOption[modifiedLocalOptions.size()]),
newArguments, null, monitor);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java
index 8ca5978dc..8bfe95c9e 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java
@@ -52,7 +52,7 @@ public abstract class RemoteCommand extends Command {
throws CVSException {
// Convert arguments
- List stringArguments = new ArrayList(arguments.length);
+ List<String> stringArguments = new ArrayList<>(arguments.length);
for (ICVSResource resource : arguments) {
String remotePath;
if (isDefinedModule(resource)) {
@@ -63,7 +63,7 @@ public abstract class RemoteCommand extends Command {
}
stringArguments.add(remotePath);
}
- return (String[]) stringArguments.toArray(new String[stringArguments.size()]);
+ return stringArguments.toArray(new String[stringArguments.size()]);
}
private boolean isDefinedModule(ICVSResource resource) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java
index b2eddd6fa..60f38737d 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java
@@ -30,7 +30,7 @@ public abstract class Request {
public static final ValidRequests VALID_REQUESTS = new ValidRequests();
/*** Response handler map ***/
- private static final Map responseHandlers = new HashMap();
+ private static final Map<String,ResponseHandler> responseHandlers = new HashMap<>();
private static void initializeHandlerCache() {
synchronized(responseHandlers) {
@@ -67,16 +67,15 @@ public abstract class Request {
*
* @return a map of response handlers
*/
- protected static Map getReponseHandlerMap() {
+ protected static Map<String,ResponseHandler> getReponseHandlerMap() {
synchronized(responseHandlers) {
if (responseHandlers.isEmpty()) {
initializeHandlerCache();
}
- Map copy = new HashMap();
+ Map<String,ResponseHandler> copy = new HashMap<>();
for (Iterator iter = responseHandlers.values().iterator(); iter.hasNext();) {
ResponseHandler handler = (ResponseHandler) iter.next();
copy.put(handler.getResponseID(), handler.getInstance());
-
}
return copy;
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
index 9840e92ce..c07dc5ef0 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
@@ -83,7 +83,7 @@ public class Session {
private boolean noLocalChanges = false;
private boolean createBackups = true;
private int compressionLevel = 0;
- private List expansions;
+ private List<String> expansions;
private Collection /* of ICVSFile */ textTransferOverrideSet = null;
// state need to indicate whether
@@ -91,10 +91,10 @@ public class Session {
// The resource bundle key that provides the file sending message
private String sendFileTitleMessage;
- private Map responseHandlers;
+ private Map<String,ResponseHandler> responseHandlers;
// List of errors accumulated while the command is executing
- private List errors = new ArrayList();
+ private List<IStatus> errors = new ArrayList<>();
private Command currentCommand;
@@ -136,7 +136,7 @@ public class Session {
*/
protected void resetModuleExpansion() {
if (expansions == null)
- expansions = new ArrayList();
+ expansions = new ArrayList<>();
else
expansions.clear();
}
@@ -268,7 +268,7 @@ public class Session {
*/
public String[] getModuleExpansions() {
if (expansions == null) return new String[0];
- return (String[]) expansions.toArray(new String[expansions.size()]);
+ return expansions.toArray(new String[expansions.size()]);
}
/**
@@ -960,7 +960,7 @@ public class Session {
* Get the response handler map to be used for this session. The map is created by making a copy of the global
* reponse handler map.
*/
- protected Map getReponseHandlers() {
+ protected Map<String,ResponseHandler> getReponseHandlers() {
if (responseHandlers == null) {
responseHandlers = Request.getReponseHandlerMap();
}
@@ -990,7 +990,7 @@ public class Session {
}
public ResponseHandler getResponseHandler(String responseID) {
- return (ResponseHandler)getReponseHandlers().get(responseID);
+ return getReponseHandlers().get(responseID);
}
/**
@@ -1008,7 +1008,7 @@ public class Session {
}
public IStatus[] getErrors() {
- return (IStatus[]) errors.toArray(new IStatus[errors.size()]);
+ return errors.toArray(new IStatus[errors.size()]);
}
public void clearErrors() {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/AnnotateListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/AnnotateListener.java
index b9408f4b7..5e6a1dc55 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/AnnotateListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/AnnotateListener.java
@@ -28,7 +28,7 @@ public class AnnotateListener extends CommandOutputListener {
* Handle output from the CVS Annotate command.
*/
ByteArrayOutputStream aStream = new ByteArrayOutputStream();
- List blocks = new ArrayList();
+ List<CVSAnnotateBlock> blocks = new ArrayList<>();
int lineNumber;
public IStatus messageLine(String line, ICVSRepositoryLocation location, ICVSFolder commandRoot, IProgressMonitor monitor) {
@@ -72,7 +72,7 @@ public class AnnotateListener extends CommandOutputListener {
if (size == 0) {
blocks.add(aBlock);
} else {
- CVSAnnotateBlock lastBlock = (CVSAnnotateBlock) blocks.get(size - 1);
+ CVSAnnotateBlock lastBlock = blocks.get(size - 1);
if (lastBlock.getRevision().equals(aBlock.getRevision())) {
lastBlock.setEndLine(aBlock.getStartLine());
} else {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/EditorsListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/EditorsListener.java
index 73a6ebaa0..f469198fc 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/EditorsListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/EditorsListener.java
@@ -38,7 +38,7 @@ public class EditorsListener extends CommandOutputListener {
/**
* List to store the EditorsInfos
*/
- private List infos = new LinkedList();
+ private List<EditorsInfo> infos = new LinkedList<>();
/**
* Name of the current file
@@ -99,7 +99,7 @@ public class EditorsListener extends CommandOutputListener {
* @return IEditorsInfo[]
*/
public EditorsInfo[] getEditorsInfos() {
- return (EditorsInfo[]) infos.toArray(new EditorsInfo[infos.size()]);
+ return infos.toArray(new EditorsInfo[infos.size()]);
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java
index f1fe64e41..810d9cc01 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java
@@ -22,6 +22,7 @@ import java.util.*;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.team.core.history.ITag;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.CommandOutputListener;
import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
@@ -67,8 +68,8 @@ public class LogListener extends CommandOutputListener {
private String revision;
private String author;
private Date creationDate;
- private List versions = new ArrayList();
- private Map internedStrings = new HashMap();
+ private List<VersionInfo> versions = new ArrayList<>();
+ private Map<String,String> internedStrings = new HashMap<>();
private final ILogEntryListener listener;
/**
@@ -195,10 +196,10 @@ public class LogListener extends CommandOutputListener {
}
if (state == DONE) {
// we are only interested in tag names for this revision, remove all others.
- List thisRevisionTags = versions.isEmpty() ? Collections.EMPTY_LIST : new ArrayList(3);
- List thisRevisionBranches = new ArrayList(1);
+ List<ITag> thisRevisionTags = versions.isEmpty() ? Collections.emptyList() : new ArrayList<>(3);
+ List<ITag> thisRevisionBranches = new ArrayList<>(1);
//a parallel lists for revision tags (used only for branches with no commits on them)
- List revisionVersions = versions.isEmpty() ? Collections.EMPTY_LIST : new ArrayList(3);
+ List<String> revisionVersions = versions.isEmpty() ? Collections.emptyList() : new ArrayList<>(3);
String branchRevision = this.getBranchRevision(revision);
for (Iterator i = versions.iterator(); i.hasNext();) {
VersionInfo version = (VersionInfo) i.next();
@@ -307,7 +308,7 @@ public class LogListener extends CommandOutputListener {
}
private String internAndCopyString(String string) {
- String internedString = (String) internedStrings.get(string);
+ String internedString = internedStrings.get(string);
if (internedString == null) {
internedString = new String(string);
internedStrings.put(internedString, internedString);
@@ -316,7 +317,7 @@ public class LogListener extends CommandOutputListener {
}
private String internString(String string) {
- String internedString = (String) internedStrings.get(string);
+ String internedString = internedStrings.get(string);
if (internedString == null) {
internedString = string;
internedStrings.put(internedString, internedString);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ModuleDefinitionsListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ModuleDefinitionsListener.java
index 1d7440a2a..023e24213 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ModuleDefinitionsListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ModuleDefinitionsListener.java
@@ -32,7 +32,7 @@ public class ModuleDefinitionsListener extends CommandOutputListener {
// the last line read from the context (used to accumulate multi-line definitions)
private String lastLine = ""; //$NON-NLS-1$
- private Map moduleMap;
+ private Map<String,String> moduleMap;
public ModuleDefinitionsListener() {
reset();
@@ -63,10 +63,10 @@ public class ModuleDefinitionsListener extends CommandOutputListener {
}
public String[] getModuleExpansions() {
- return (String[])moduleMap.values().toArray(new String[moduleMap.size()]);
+ return moduleMap.values().toArray(new String[moduleMap.size()]);
}
public void reset() {
- this.moduleMap = new HashMap();
+ this.moduleMap = new HashMap<>();
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ServerMessageLineMatcher.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ServerMessageLineMatcher.java
index 305a2c8e8..c7b12f939 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ServerMessageLineMatcher.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ServerMessageLineMatcher.java
@@ -41,7 +41,7 @@ public class ServerMessageLineMatcher {
public ServerMessageLineMatcher(String template, String[] expectedVariables) throws CVSException {
// Extract the variable names from the template
Matcher matcher = VARIABLE_MATCHING_PATTERN.matcher(template);
- List variables = new ArrayList();
+ List<String> variables = new ArrayList<>();
while (matcher.find()) {
if (matcher.groupCount() != 2) {
IStatus status = new CVSStatus(IStatus.ERROR,NLS.bind(CVSMessages.ServerMessageLineMatcher_5, new String[] { template }));
@@ -50,7 +50,7 @@ public class ServerMessageLineMatcher {
variables.add(matcher.group(2));
}
ensureMatches(template, variables, expectedVariables);
- this.variables = (String[]) variables.toArray(new String[variables.size()]);
+ this.variables = variables.toArray(new String[variables.size()]);
// Modify the template so it can be used to match message lines from the server
// (i.e. remove the variable markup)
@@ -91,7 +91,7 @@ public class ServerMessageLineMatcher {
Matcher matcher = pattern.matcher(line);
if (!matcher.find()) return null;
Assert.isTrue(matcher.groupCount() == variables.length);
- Map result = new HashMap();
+ Map<String,String> result = new HashMap<>();
for (int i = 1; i <= matcher.groupCount(); i++) {
result.put(variables[i - 1], matcher.group(i));
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/ChangeSetResourceMapping.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/ChangeSetResourceMapping.java
index aaf674188..748593022 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/ChangeSetResourceMapping.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/ChangeSetResourceMapping.java
@@ -40,12 +40,12 @@ public class ChangeSetResourceMapping extends ResourceMapping {
}
public IProject[] getProjects() {
- Set result = new HashSet();
+ Set<IProject> result = new HashSet<>();
IResource[] resources = changeSet.getResources();
for (IResource resource : resources) {
result.add(resource.getProject());
}
- return (IProject[]) result.toArray(new IProject[result.size()]);
+ return result.toArray(new IProject[result.size()]);
}
public ResourceTraversal[] getTraversals(ResourceMappingContext context,
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
index 147fb712c..cdd92b1ad 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
@@ -44,7 +44,7 @@ public class RemoteFolderTreeBuilder {
private static final int MAX_REVISION_FETCHES_PER_CONNECTION = 1024;
- private Map<String, Map> fileDeltas;
+ private Map<String, Map<String, DeltaNode>> fileDeltas;
private List<String> changedFiles;
private Map<String, RemoteFolderTree> remoteFolderTable;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
index c10bc7c44..898785ba0 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
@@ -67,7 +67,7 @@ public class RemoteModule extends RemoteFolder {
Map modules = new HashMap();
Map referencedModulesTable = new HashMap();
- Map moduleAliases = new HashMap();
+ Map<String,String[]> moduleAliases = new HashMap<>();
// First pass: Create the remote module instances based on remote mapping
for (String moduleDefinitionString : moduleDefinitionStrings) {
@@ -119,7 +119,7 @@ public class RemoteModule extends RemoteFolder {
}
// An alias expands to one or more modules or paths
- List expansions = new ArrayList(10);
+ List<String> expansions = new ArrayList<>(10);
expansions.add(next);
while (tokenizer.hasMoreTokens())
expansions.add(tokenizer.nextToken());
@@ -132,7 +132,7 @@ public class RemoteModule extends RemoteFolder {
// The module definition may have a leading directory which can be followed by some files
if (!(next.charAt(0) == '&')) {
String directory = next;
- List files = new ArrayList();
+ List<String> files = new ArrayList<>();
while (tokenizer.hasMoreTokens() && (next.charAt(0) != '&')) {
next = tokenizer.nextToken() ;
if ((next.charAt(0) != '&'))
@@ -168,7 +168,7 @@ public class RemoteModule extends RemoteFolder {
while (iter.hasNext()) {
String moduleName = (String)iter.next();
RemoteModule module = (RemoteModule)modules.get(moduleName);
- String[] expansion = (String[])moduleAliases.get(moduleName);
+ String[] expansion = moduleAliases.get(moduleName);
List referencedFolders = new ArrayList();
boolean expandable = true;
for (String e : expansion) {
@@ -310,20 +310,20 @@ public class RemoteModule extends RemoteFolder {
if (folderInfo.getIsStatic()) {
ICVSRemoteResource[] children = getChildren();
if (children != null) {
- List taggedChildren = new ArrayList(children.length);
+ List<ICVSRemoteResource> taggedChildren = new ArrayList<>(children.length);
for (ICVSRemoteResource resource : children) {
taggedChildren.add(((RemoteResource)resource).forTag(r, tagName));
}
- r.setChildren((ICVSRemoteResource[]) taggedChildren.toArray(new ICVSRemoteResource[taggedChildren.size()]));
+ r.setChildren(taggedChildren.toArray(new ICVSRemoteResource[taggedChildren.size()]));
}
}
if (referencedModules != null) {
- List taggedModules = new ArrayList(referencedModules.length);
+ List<ICVSRemoteResource> taggedModules = new ArrayList<>(referencedModules.length);
for (ICVSRemoteResource referencedModule : referencedModules) {
RemoteModule module = (RemoteModule) referencedModule;
taggedModules.add(module.forTag(r, tagName));
}
- r.setReferencedModules((ICVSRemoteResource[]) taggedModules.toArray(new ICVSRemoteResource[taggedModules.size()]));
+ r.setReferencedModules(taggedModules.toArray(new ICVSRemoteResource[taggedModules.size()]));
}
return r;
}

Back to the top