1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 12:03:16 +02:00

Compiler warnings + Generics

This commit is contained in:
James Blackburn 2011-01-25 12:09:34 +00:00
parent 5c176c24e2
commit 513a9a614f
11 changed files with 116 additions and 134 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2008 IBM Corporation and others.
* Copyright (c) 2004, 2011 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,18 +10,25 @@
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.core.tests;
import java.io.*;
import java.lang.String;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StreamTokenizer;
import java.util.ArrayList;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedOutputNameProvider;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@ -39,7 +46,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
* Return a list of the names of all modules used by a file
*/
private String[] findUsedModuleNames(File file) {
ArrayList names = new ArrayList();
ArrayList<String> names = new ArrayList<String>();
InputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(file));
@ -72,14 +79,14 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
in.close();
} catch (IOException e) {/*don't care */}
}
return (String[]) names.toArray(new String[names.size()]);
return names.toArray(new String[names.size()]);
}
/*
* Return a list of the names of all modules defined in a file
*/
private String[] findModuleNames(File file) {
ArrayList names = new ArrayList();
ArrayList<String> names = new ArrayList<String>();
InputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(file));
@ -112,7 +119,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
in.close();
} catch (IOException e) {/*don't care */}
}
return (String[]) names.toArray(new String[names.size()]);
return names.toArray(new String[names.size()]);
}
/*
@ -135,7 +142,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
*/
private IResource[] FindModulesInResources(IProject project, ITool tool, IResource resource, IResource[] resourcesToSearch,
String topBuildDir, String[] usedNames) {
ArrayList modRes = new ArrayList();
ArrayList<IResource> modRes = new ArrayList<IResource>();
for (int ir = 0; ir < resourcesToSearch.length; ir++) {
if (resourcesToSearch[ir].equals(resource)) continue;
if (resourcesToSearch[ir].getType() == IResource.FILE) {
@ -173,14 +180,14 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
} catch(Exception e) {}
}
}
return (IResource[]) modRes.toArray(new IResource[modRes.size()]);
return modRes.toArray(new IResource[modRes.size()]);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#findDependencies(org.eclipse.core.resources.IResource)
*/
public IResource[] findDependencies(IResource resource, IProject project) {
ArrayList dependencies = new ArrayList();
ArrayList<IResource> dependencies = new ArrayList<IResource>();
// TODO: This method should be passed the ITool and the relative path of the top build directory
// For now we'll figure this out from the project.
@ -218,7 +225,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
return null;
}
return (IResource[]) dependencies.toArray(new IResource[dependencies.size()]);
return dependencies.toArray(new IResource[dependencies.size()]);
}
/* (non-Javadoc)
@ -245,7 +252,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
*/
public IPath[] getOutputNames(ITool tool, IPath[] primaryInputNames) {
// TODO: This method should be passed the relative path of the top build directory?
ArrayList outs = new ArrayList();
ArrayList<IPath> outs = new ArrayList<IPath>();
if (primaryInputNames.length > 0) {
// Get the names of modules created by this source file
String[] modules = findModuleNames(primaryInputNames[0].toFile());
@ -267,7 +274,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
}
}
}
return (IPath[]) outs.toArray(new IPath[outs.size()]);
return outs.toArray(new IPath[outs.size()]);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2010 Intel Corporation and others.
* Copyright (c) 2004, 2011 Intel 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
@ -33,7 +33,6 @@ import org.eclipse.core.runtime.IConfigurationElement;
public class ManagedBuildCoreTests extends TestCase {
private static final boolean boolVal = true;
private static IProjectType exeType;
private static IProjectType libType;
private static IProjectType dllType;
@ -53,7 +52,6 @@ public class ManagedBuildCoreTests extends TestCase {
* definitions are loaded correctly.
*/
public void testLoadManifest() throws Exception {
IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes();
exeType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu21.exe");
checkExeProjectType(exeType);
dllType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu21.so");
@ -141,7 +139,7 @@ public class ManagedBuildCoreTests extends TestCase {
//
ITargetPlatform platform = toolChain.getTargetPlatform();
List expectedOSListarr = new ArrayList();
List<String> expectedOSListarr = new ArrayList<String>();
String[] expectedOSListTokens = expectedOSList.split(","); //$NON-NLS-1$
for (i = 0; i < expectedOSListTokens.length; ++i) {
expectedOSListarr.add(expectedOSListTokens[i].trim());
@ -208,7 +206,7 @@ public class ManagedBuildCoreTests extends TestCase {
assertEquals(optionDefaultValue, (expectedOptionIdValue1[iconfig]));
String optionEnumCmd1 = option.getEnumCommand(optionDefaultValue);
assertEquals(optionEnumCmd1, (expectedOptionEnumCmd1arr[iconfig]));
List expectedEnumList1arr = new ArrayList();
List<String> expectedEnumList1arr = new ArrayList<String>();
String enumValues[] = option.getApplicableValues();
String[] expectedEnumList1Tokens = expectedEnumList1.split(","); //$NON-NLS-1$
for (i = 0; i < expectedEnumList1Tokens.length; ++i) {
@ -318,7 +316,7 @@ public class ManagedBuildCoreTests extends TestCase {
IToolChain toolChain = configs[iconfig].getToolChain();
assertEquals(toolChain.getName(), (expectedToolChainName[iconfig]));
List expectedOSListarr = new ArrayList();
List<String> expectedOSListarr = new ArrayList<String>();
String[] expectedOSListTokens = expectedOSList.split(","); //$NON-NLS-1$
for (i = 0; i < expectedOSListTokens.length; ++i) {
expectedOSListarr.add(expectedOSListTokens[i].trim());
@ -512,7 +510,7 @@ public class ManagedBuildCoreTests extends TestCase {
//
IToolChain toolChain = configs[iconfig].getToolChain();
List expectedOSListarr = new ArrayList();
List<String> expectedOSListarr = new ArrayList<String>();
String[] expectedOSListTokens = expectedOSList.split(","); //$NON-NLS-1$
for (i = 0; i < expectedOSListTokens.length; ++i) {
expectedOSListarr.add(expectedOSListTokens[i].trim());
@ -581,7 +579,7 @@ public class ManagedBuildCoreTests extends TestCase {
String optionEnumCmd1 = option.getEnumCommand(optionDefaultValue);
assertEquals(optionEnumCmd1, (expectedOptionEnumCmd1arr[iconfig]));
List expectedEnumList1arr = new ArrayList();
List<String> expectedEnumList1arr = new ArrayList<String>();
String enumValues[] = option.getApplicableValues();
String[] expectedEnumList1Tokens = expectedEnumList1.split(","); //$NON-NLS-1$
for (i = 0; i < expectedEnumList1Tokens.length; ++i) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2006 Symbian Ltd and others.
* Copyright (c) 2005, 2011 Symbian Ltd 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
@ -295,7 +295,6 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase {
fail("Test failed on project creation: " + e.getLocalizedMessage());
}
// Find the base project type definition
IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes();
IProjectType projType = ManagedBuildManager.getProjectType(projectID);
assertNotNull(projType);
// Create a managed project
@ -319,8 +318,8 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase {
// Test ID's
//
String configID = "test30_sto.dummy.config";
String configName = "Configuration for test30_sto";
// String configID = "test30_sto.dummy.config";
// String configName = "Configuration for test30_sto";
String toolChainID = "test30_sto.dummy.toolchain";
String toolChainName = "Toolchain for test30_sto";
// Toolchain Info
@ -328,7 +327,7 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase {
String toolIDs = "test30_sto.dummy.tool.";
int firstToolID = 1;
// Top level option categories and groups
int numTopCategories = 3;
// int numTopCategories = 3;
String topCategoryIDs = "test30_sto.dummy.category.";
int firstTopCategoryID = 5;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (C) 2006 Siemens AG.
* Copyright (C) 2006, 2011 Siemens AG.
* 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
@ -24,7 +24,6 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.IPath;
/**
@ -71,7 +70,7 @@ public class PathConverterTest extends TestCase {
* - An inherited converter overrides any toolchain converters <br>
* - A converter set directly on the toolchain overrides an inherited toolchain converter <br>
*/
protected Class getExpectedToolConverterClass(String configId) {
protected Class<? extends IOptionPathConverter> getExpectedToolConverterClass(String configId) {
// Conservative defaults
boolean hasToolConverter = false ;
boolean hasToolInheritedConverter = false ;
@ -81,7 +80,7 @@ public class PathConverterTest extends TestCase {
hasToolConverter = (toolinfo.charAt(0)=='y');
hasToolInheritedConverter = (toolinfo.charAt(1)=='y');
// Assume no converter
Class toolConverterClass = getExpectedToolchainConverterClass(configId) ;
Class<? extends IOptionPathConverter> toolConverterClass = getExpectedToolchainConverterClass(configId) ;
// Modify converter as appropriate
if (hasToolInheritedConverter) toolConverterClass = TestPathConverter2.class ;
if (hasToolConverter) toolConverterClass = TestPathConverter4.class ;
@ -90,9 +89,9 @@ public class PathConverterTest extends TestCase {
}
/**
* @see getExpectedToolConverterClass()
* @see #getExpectedToolConverterClass(String)
*/
protected Class getExpectedToolchainConverterClass(String configId) {
protected Class<? extends IOptionPathConverter> getExpectedToolchainConverterClass(String configId) {
// Conservative defaults
boolean hasToolchainConverter = false ;
boolean hasToolchainInheritedConverter = false ;
@ -102,7 +101,7 @@ public class PathConverterTest extends TestCase {
hasToolchainConverter = (toolchaininfo.charAt(0)=='y');
hasToolchainInheritedConverter = (toolchaininfo.charAt(1)=='y');
// Assume no converter
Class toolConverterClass = null ;
Class<? extends IOptionPathConverter> toolConverterClass = null ;
// Modify converter as appropriate
if (hasToolchainInheritedConverter) toolConverterClass = TestPathConverter1.class ;
if (hasToolchainConverter) toolConverterClass = TestPathConverter3.class ;
@ -127,7 +126,7 @@ public class PathConverterTest extends TestCase {
IConfiguration configuration = configurations[i];
IToolChain toolchain = configuration.getToolChain();
Class expectedToolchainConverterClass = getExpectedToolchainConverterClass(configuration.getId());
Class<? extends IOptionPathConverter> expectedToolchainConverterClass = getExpectedToolchainConverterClass(configuration.getId());
IOptionPathConverter toolchainPathConverter = toolchain.getOptionPathConverter();
if (null==expectedToolchainConverterClass) {
assertNull("null pathConverter expected for toolchain!", toolchainPathConverter);
@ -137,7 +136,7 @@ public class PathConverterTest extends TestCase {
ITool tool = toolchain.getTools()[0]; // We have only one tool in the test setup
Class expectedToolConverterClass = getExpectedToolConverterClass(configuration.getId());
Class<? extends IOptionPathConverter> expectedToolConverterClass = getExpectedToolConverterClass(configuration.getId());
IOptionPathConverter toolPathConverter = tool.getOptionPathConverter();
if (null==expectedToolConverterClass) {
assertNull("null pathConverter expected for tool!", toolPathConverter);
@ -152,7 +151,6 @@ public class PathConverterTest extends TestCase {
*/
public void testPathConversionInProject() throws Exception {
IProjectType type = ManagedBuildManager.getProjectType("pathconvertertest.projecttype");
IWorkspaceRoot root = null ;
IProject project = ManagedBuildTestHelper.createProject("pathconverter01", type.getId());
IManagedBuildInfo iinfo = ManagedBuildManager.getBuildInfo(project);
assertNotNull("build info could not be obtained", iinfo);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 TimeSys Corporation and others.
* Copyright (c) 2004, 2011 TimeSys 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
@ -21,14 +21,14 @@ import org.eclipse.core.runtime.IExtension;
public class TestConfigElement implements IManagedConfigElement {
private String name;
private Map attributeMap;
private Map<String, String> attributeMap;
private IManagedConfigElement[] children;
public TestConfigElement(String name, String[][] attributes,
IManagedConfigElement[] children) {
this.name = name;
this.children = children;
this.attributeMap = new TreeMap();
this.attributeMap = new TreeMap<String, String>();
for (int i = 0; i < attributes.length; i++) {
attributeMap.put(attributes[i][0], attributes[i][1]);
}
@ -45,7 +45,7 @@ public class TestConfigElement implements IManagedConfigElement {
* @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getAttribute(java.lang.String)
*/
public String getAttribute(String name) {
return (String)attributeMap.get(name);
return attributeMap.get(name);
}
/* (non-Javadoc)
@ -59,13 +59,13 @@ public class TestConfigElement implements IManagedConfigElement {
* @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getChildren(java.lang.String)
*/
public IManagedConfigElement[] getChildren(String elementName) {
List ret = new ArrayList(children.length);
List<IManagedConfigElement> ret = new ArrayList<IManagedConfigElement>(children.length);
for (int i = 0; i < children.length; i++) {
if (children[i].getName().equals(elementName)) {
ret.add(children[i]);
}
}
return (IManagedConfigElement[])ret.toArray(new IManagedConfigElement[ret.size()]);
return ret.toArray(new IManagedConfigElement[ret.size()]);
}
/* (non-Javadoc)

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 Intel Corporation and others.
* Copyright (c) 2005, 2011 Intel 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
@ -13,7 +13,6 @@ package org.eclipse.cdt.managedbuilder.core.tests;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IConfigurationNameProvider;
import org.eclipse.core.runtime.Platform;
public class TestConfigurationNameProvider implements
@ -35,10 +34,6 @@ public class TestConfigurationNameProvider implements
String configName = configuration.getName();
// Get the current OS & architecture
String os = Platform.getOS();
String arch = Platform.getOSArch();
if (isArrayContains(usedConfigurationNames, configName) == false)
return configName;
else {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 Symbian Ltd and others.
* Copyright (c) 2005, 2011 Symbian Ltd 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
@ -13,12 +13,10 @@ package org.eclipse.cdt.managedbuilder.core.tests;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.ManagedOptionValueHandler;
public class TestValueHandler extends ManagedOptionValueHandler implements
IManagedOptionValueHandler {
public class TestValueHandler extends ManagedOptionValueHandler {
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler#handleValue(IConfiguration,IToolChain,IOption,String,int)

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others.
* Copyright (c) 2007, 2011 Intel 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
@ -14,7 +14,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import junit.framework.Test;
@ -29,6 +28,7 @@ import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
@ -69,7 +69,7 @@ public class ToolChainModificationTests extends TestCase {
assertTrue(cfgM.isBuilderCompatible());
IToolChain[] ctcs = cfgM.getCompatibleToolChains();
HashSet set = new HashSet();
HashSet<IHoldsOptions> set = new HashSet<IHoldsOptions>();
FolderInfo foInfo = (FolderInfo)cfg.getRootFolderInfo();
ToolChain tc = (ToolChain)foInfo.getToolChain();
IToolChain[] allSys = ManagedBuildManager.getRealToolChains();
@ -80,12 +80,12 @@ public class ToolChainModificationTests extends TestCase {
set.remove(incompatibleTc);
compare(Arrays.asList(ctcs), set);
HashSet incomp = new HashSet(Arrays.asList(allSys));
HashSet<IToolChain> incomp = new HashSet<IToolChain>(Arrays.asList(allSys));
incomp.removeAll(Arrays.asList(ctcs));
assertTrue(incomp.contains(incompatibleTc));
IBuilder[] cbs = cfgM.getCompatibleBuilders();
Set bSet = new HashSet();
Set<IHoldsOptions> bSet = new HashSet<IHoldsOptions>();
IBuilder[] allSysB = ManagedBuildManager.getRealBuilders();
filterPropsSupported(cfg, allSysB, bSet);
IBuilder incompatibleB = ManagedBuildManager.getExtensionBuilder("tcm.tc4.b1");
@ -94,7 +94,7 @@ public class ToolChainModificationTests extends TestCase {
bSet.remove(incompatibleB);
compare(Arrays.asList(cbs), bSet);
HashSet incompB = new HashSet(Arrays.asList(allSysB));
HashSet<IBuilder> incompB = new HashSet<IBuilder>(Arrays.asList(allSysB));
incompB.removeAll(Arrays.asList(cbs));
assertTrue(incompB.contains(incompatibleB));
@ -111,12 +111,8 @@ public class ToolChainModificationTests extends TestCase {
project.delete(true, null);
}
private boolean contains(Object[] array, Object obj){
return new HashSet(Arrays.asList(array)).contains(obj);
}
private HashSet filterSupportedToolChains(IFolderInfo foInfo, IToolChain tc){
HashSet set = new HashSet();
private HashSet<IHoldsOptions> filterSupportedToolChains(IFolderInfo foInfo, IToolChain tc){
HashSet<IHoldsOptions> set = new HashSet<IHoldsOptions>();
IToolChain[] allSys = ManagedBuildManager.getRealToolChains();
filterPropsSupported((FolderInfo)foInfo, (ToolChain)tc, allSys, set);
set.remove(ManagedBuildManager.getRealToolChain(tc));
@ -152,7 +148,7 @@ public class ToolChainModificationTests extends TestCase {
assertTrue(cfgM.isToolChainCompatible());
assertTrue(cfgM.isBuilderCompatible());
HashSet set = filterSupportedToolChains(cfg.getRootFolderInfo(), cfg.getToolChain());
HashSet<IHoldsOptions> set = filterSupportedToolChains(cfg.getRootFolderInfo(), cfg.getToolChain());
IToolChain[] tcs = cfgM.getCompatibleToolChains();
compare(Arrays.asList(tcs), set);
@ -203,7 +199,7 @@ public class ToolChainModificationTests extends TestCase {
assertTrue(cfgM.isToolChainCompatible());
assertTrue(cfgM.isBuilderCompatible());
HashSet set = filterSupportedToolChains(cfg.getRootFolderInfo(), cfg.getToolChain());
HashSet<IHoldsOptions> set = filterSupportedToolChains(cfg.getRootFolderInfo(), cfg.getToolChain());
IToolChain[] tcs = cfgM.getCompatibleToolChains();
compare(Arrays.asList(tcs), set);
@ -231,7 +227,7 @@ public class ToolChainModificationTests extends TestCase {
project.delete(true, null);
}
private void rmToolChains(Set set, String[] ids){
private void rmToolChains(Set<IHoldsOptions> set, String[] ids){
for(int i = 0; i < ids.length; i++){
IToolChain incompatibleTc = ManagedBuildManager.getExtensionToolChain(ids[i]);
assertNotNull("no tool-chain of id " + ids[i], incompatibleTc);
@ -241,16 +237,11 @@ public class ToolChainModificationTests extends TestCase {
}
}
private IToolChain getRealToolChain(String id){
IToolChain tc = ManagedBuildManager.getExtensionToolChain(id);
return ManagedBuildManager.getRealToolChain(tc);
}
private void compare(Collection<? extends IHoldsOptions> c1, Collection<IHoldsOptions> c2){
HashSet<? extends IHoldsOptions> s1 = new HashSet<IHoldsOptions>(c1);
HashSet<? extends IHoldsOptions> s1c = new HashSet<IHoldsOptions>(s1);
private void compare(Collection c1, Collection c2){
HashSet s1 = new HashSet(c1);
HashSet s1c = (HashSet)s1.clone();
HashSet s2 = new HashSet(c2);
HashSet<IHoldsOptions> s2 = new HashSet<IHoldsOptions>(c2);
s1.removeAll(s2);
s2.removeAll(s1c);
@ -264,21 +255,20 @@ public class ToolChainModificationTests extends TestCase {
fail(buf.toString());
}
private boolean checkEmpty(Collection c, StringBuffer buf){
private boolean checkEmpty(Collection<? extends IBuildObject> c, StringBuffer buf){
if(c.size() != 0){
buf.append("non-empty dump:\n");
for(Iterator iter = c.iterator(); iter.hasNext(); ){
buf.append("\t ").append((((IBuildObject)iter.next()).getId())).append('\n');
}
for (IBuildObject bo : c)
buf.append("\t ").append(bo.getId()).append('\n');
buf.append("end\n");
return true;
}
return false;
}
private Collection filterPropsSupported(FolderInfo foInfo, ToolChain tc, IToolChain[] tcs, Collection c){
private Collection<IHoldsOptions> filterPropsSupported(FolderInfo foInfo, ToolChain tc, IToolChain[] tcs, Collection<IHoldsOptions> c){
if(c == null)
c = new ArrayList();
c = new ArrayList<IHoldsOptions>();
for(int i = 0; i < tcs.length; i++){
if(foInfo.isToolChainCompatible(tc, tcs[i]))
c.add(tcs[i]);
@ -287,9 +277,9 @@ public class ToolChainModificationTests extends TestCase {
return c;
}
private Collection filterPropsSupported(IConfiguration cfg, IBuilder[] bs, Collection c){
private Collection<IHoldsOptions> filterPropsSupported(IConfiguration cfg, IBuilder[] bs, Collection<IHoldsOptions> c){
if(c == null)
c = new ArrayList();
c = new ArrayList<IHoldsOptions>();
for(int i = 0; i < bs.length; i++){
if(cfg.isBuilderCompatible(bs[i]))
c.add(bs[i]);
@ -298,7 +288,7 @@ public class ToolChainModificationTests extends TestCase {
return c;
}
private boolean getReplacementToolInfo(IModificationOperation[] ops, Set set){
private boolean getReplacementToolInfo(IModificationOperation[] ops, Set<ITool> set){
boolean removable = false;
for(int i = 0; i < ops.length; i++){
ITool tool = ops[i].getReplacementTool();
@ -350,7 +340,7 @@ public class ToolChainModificationTests extends TestCase {
IModificationOperation[] ops = tm.getSupportedOperations();
ITool tool31 = ManagedBuildManager.getExtensionTool("tcm.tc3.t1");
Set replacement = new HashSet();
Set<ITool> replacement = new HashSet<ITool>();
boolean removable = getReplacementToolInfo(ops, replacement);
assertFalse(removable);
@ -360,14 +350,12 @@ public class ToolChainModificationTests extends TestCase {
assertTrue(tm.isProjectTool());
ops = tm.getSupportedOperations();
replacement = new HashSet();
replacement = new HashSet<ITool>();
removable = getReplacementToolInfo(ops, replacement);
assertFalse(removable);
assertFalse(replacement.contains(tool31));
int tmp = IToolChainModificationManager.OBJECT_CONFIGURATION;
project.delete(true, null);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2008 Symbian Software Limited and others.
* Copyright (c) 2007, 2011 Symbian Software Limited 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
@ -33,7 +33,6 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
public class TestProcesses extends TestCase {
private static final String workspaceLocation = ResourcesPlugin.getWorkspace().getRoot().getRawLocation().toOSString();
private static final String INCLUDE_FOLDER = "Include"; //$NON-NLS-1$
private static final String APPEND = "Append"; //$NON-NLS-1$
private static final String MBS_GNU_CPP_LINK_OPTION_ID = ".*gnu.cpp.link.option.*"; //$NON-NLS-1$
@ -68,7 +67,7 @@ public class TestProcesses extends TestCase {
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*CreateIncludeFolder"); //$NON-NLS-1$
template.getTemplateInfo().setConfigurations(getConfigurations());
Map valueStore = template.getValueStore();
Map<String, String> valueStore = template.getValueStore();
valueStore.put("projectName", projectName); //$NON-NLS-1$
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
@ -92,7 +91,7 @@ public class TestProcesses extends TestCase {
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*NewManagedProject"); //$NON-NLS-1$
template.getTemplateInfo().setConfigurations(getConfigurations());
Map valueStore = template.getValueStore();
Map<String, String> valueStore = template.getValueStore();
valueStore.put("projectName", projectName); //$NON-NLS-1$
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
@ -109,7 +108,7 @@ public class TestProcesses extends TestCase {
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*SetMBSBooleanOptionValue"); //$NON-NLS-1$
template.getTemplateInfo().setConfigurations(getConfigurations());
Map valueStore = template.getValueStore();
Map<String, String> valueStore = template.getValueStore();
valueStore.put("projectName", projectName); //$NON-NLS-1$
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
@ -134,7 +133,7 @@ public class TestProcesses extends TestCase {
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*SetMBSStringOptionValue"); //$NON-NLS-1$
template.getTemplateInfo().setConfigurations(getConfigurations());
Map valueStore = template.getValueStore();
Map<String, String> valueStore = template.getValueStore();
valueStore.put("projectName", projectName); //$NON-NLS-1$
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
@ -159,7 +158,7 @@ public class TestProcesses extends TestCase {
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*SetMBSStringListOptionValues"); //$NON-NLS-1$
template.getTemplateInfo().setConfigurations(getConfigurations());
Map valueStore = template.getValueStore();
Map<String, String> valueStore = template.getValueStore();
valueStore.put("projectName", projectName); //$NON-NLS-1$
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
@ -187,7 +186,7 @@ public class TestProcesses extends TestCase {
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*AppendToMBSStringOptionValue"); //$NON-NLS-1$
template.getTemplateInfo().setConfigurations(getConfigurations());
Map valueStore = template.getValueStore();
Map<String, String> valueStore = template.getValueStore();
valueStore.put("projectName", projectName); //$NON-NLS-1$
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
@ -213,7 +212,7 @@ public class TestProcesses extends TestCase {
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*AppendToMBSStringListOptionValues"); //$NON-NLS-1$
template.getTemplateInfo().setConfigurations(getConfigurations());
Map valueStore = template.getValueStore();
Map<String, String> valueStore = template.getValueStore();
valueStore.put("projectName", projectName); //$NON-NLS-1$
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
@ -246,7 +245,7 @@ public class TestProcesses extends TestCase {
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*ExcludeResources"); //$NON-NLS-1$
template.getTemplateInfo().setConfigurations(getConfigurations());
Map valueStore = template.getValueStore();
Map<String, String> valueStore = template.getValueStore();
valueStore.put("projectName", projectName); //$NON-NLS-1$
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
@ -325,8 +324,9 @@ public class TestProcesses extends TestCase {
break;
default:
if(option.getValue() instanceof List) {
List list= (List) option.getValue();
String[] optionValues= (String[]) list.toArray(new String[list.size()]);
@SuppressWarnings("unchecked")
List<String> list= (List<String>) option.getValue();
String[] optionValues= list.toArray(new String[list.size()]);
if (append) {
assertTrue(optionValues.length == 2 * MBS_STRING_LIST_OPTION_VALUES.length);
int j=0;
@ -355,7 +355,7 @@ public class TestProcesses extends TestCase {
/**
* @return the gnu mingw exe debug configuration
*/
private List/*<IConfiguration>*/ getConfigurations() {
private List<IConfiguration> getConfigurations() {
IConfiguration config= ManagedBuildManager.getExtensionConfiguration("cdt.managedbuild.config.gnu.mingw.exe.debug");
return Collections.singletonList(config);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 Intel Corporation and others.
* Copyright (c) 2007, 2011 Intel 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
@ -27,7 +27,7 @@ import org.eclipse.core.resources.IProject;
public class BackwardCompatiblityTests extends TestCase {
private static final String TEST_3X_STD_MAKE_PROJECTS = "test3xStdMakeProjects";
private List projList = new LinkedList();
private List<IProject> projList = new LinkedList<IProject>();
public static Test suite() {
return new TestSuite(BackwardCompatiblityTests.class);
@ -36,19 +36,19 @@ public class BackwardCompatiblityTests extends TestCase {
public void test3xStdMakeProject(){
String PROJ_NAME = "std_cpp_1";
String[] BIN_PARSERS = new String[]{
"org.eclipse.cdt.core.ELF",
"org.eclipse.cdt.core.PE",
"org.eclipse.cdt.core.GNU_ELF",
"org.eclipse.cdt.core.MachO"
};
String[] ERR_PARSERS = new String[]{
"org.eclipse.cdt.core.CWDLocator",
"org.eclipse.cdt.core.GASErrorParser",
"org.eclipse.cdt.core.VCErrorParser",
"org.eclipse.cdt.core.GmakeErrorParser",
};
// String[] BIN_PARSERS = new String[]{
// "org.eclipse.cdt.core.ELF",
// "org.eclipse.cdt.core.PE",
// "org.eclipse.cdt.core.GNU_ELF",
// "org.eclipse.cdt.core.MachO"
// };
//
// String[] ERR_PARSERS = new String[]{
// "org.eclipse.cdt.core.CWDLocator",
// "org.eclipse.cdt.core.GASErrorParser",
// "org.eclipse.cdt.core.VCErrorParser",
// "org.eclipse.cdt.core.GmakeErrorParser",
// };
IProject project = loadStdProject(PROJ_NAME);
projList.add(project);
@ -83,8 +83,8 @@ public class BackwardCompatiblityTests extends TestCase {
@Override
protected void tearDown() throws Exception {
for(Iterator iter = projList.iterator(); iter.hasNext();){
IProject proj = (IProject)iter.next();
for(Iterator<IProject> iter = projList.iterator(); iter.hasNext();){
IProject proj = iter.next();
try {
proj.delete(true, null);
} catch (Exception e){

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2007 Intel Corporation and others.
* Copyright (c) 2005, 2011 Intel 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
@ -74,7 +74,7 @@ public class OptionStringListValueTests extends TestCase {
IFolderInfo fInfo = cfg.getRootFolderInfo();
ICLanguageSetting ls = fDes.getLanguageSettingForFile("a.c");
List list = new ArrayList();
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>();
list.add(new CIncludePathEntry("a", 0));
list.add(new CIncludePathEntry("b", 0));
list.addAll(ls.getSettingEntriesList(ICSettingEntry.INCLUDE_PATH));
@ -119,10 +119,9 @@ public class OptionStringListValueTests extends TestCase {
IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgDes);
ICFolderDescription fDes = cfgDes.getRootFolderDescription();
IFolderInfo fInfo = cfg.getRootFolderInfo();
ICLanguageSetting ls = fDes.getLanguageSettingForFile("a.c");
List list = new ArrayList();
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>();
list.add(new CLibraryFileEntry("usr_a", 0, new Path("ap"), new Path("arp"), new Path("apx")));
list.add(new CLibraryFileEntry("usr_b", 0, new Path("bp"), null, null));
list.add(new CLibraryFileEntry("usr_c", 0, new Path("cp"), new Path("crp"), null));
@ -141,7 +140,7 @@ public class OptionStringListValueTests extends TestCase {
assertEquals(other.getSourceAttachmentPrefixMapping(), r.getSourceAttachmentPrefixMapping());
}
List returned = ls.getSettingEntriesList(ICSettingEntry.LIBRARY_FILE);
List<ICLanguageSettingEntry> returned = ls.getSettingEntriesList(ICSettingEntry.LIBRARY_FILE);
assertEquals(list.size(), returned.size());
assertTrue(Arrays.equals(list.toArray(), returned.toArray()));
@ -170,8 +169,8 @@ public class OptionStringListValueTests extends TestCase {
assertTrue(Arrays.equals(list.toArray(), returned.toArray()));
}
private Set[] diff(List list1, List list2){
Set set1 = new LinkedHashSet(list1);
private Set[] diff(List<ICLanguageSettingEntry> list1, List list2){
Set<ICLanguageSettingEntry> set1 = new LinkedHashSet<ICLanguageSettingEntry>(list1);
set1.removeAll(list2);
Set set2 = new LinkedHashSet(list2);
set2.removeAll(list1);
@ -180,7 +179,7 @@ public class OptionStringListValueTests extends TestCase {
return new Set[]{set1, set2};
}
private void checkEntriesMatch(List list1, List list2){
private void checkEntriesMatch(List<ICLanguageSettingEntry> list1, List list2){
Set[] diff = diff(list1, list2);
if(diff != null){
fail("entries diff");
@ -227,17 +226,17 @@ public class OptionStringListValueTests extends TestCase {
checkOptionValues(option);
List list = new ArrayList();
List<Object> list = new ArrayList<Object>();
list.add("usr_1");
list.add("usr_2");
list.addAll(Arrays.asList(option.getBasicStringListValue()));
String[] updated = (String[])list.toArray(new String[0]);
String[] updated = list.toArray(new String[0]);
option = ManagedBuildManager.setOption(fInfo, tool, option, updated);
assertTrue(Arrays.equals(updated, option.getBasicStringListValue()));
checkOptionValues(option);
list = new ArrayList();
list = new ArrayList<Object>();
list.add(new OptionStringValue("usr_3", false, "ap", "arp", "apx"));
list.add(new OptionStringValue("usr_4", false, null, null, null));
list.add(new OptionStringValue("usr_5", false, "cp", null, null));
@ -245,7 +244,7 @@ public class OptionStringListValueTests extends TestCase {
list.add(new OptionStringValue("usr_6", false, null, null, "epx"));
list.addAll(Arrays.asList(option.getBasicStringListValueElements()));
OptionStringValue updatedves[] = (OptionStringValue[])list.toArray(new OptionStringValue[0]);
OptionStringValue updatedves[] = list.toArray(new OptionStringValue[0]);
IOption updatedOption = ManagedBuildManager.setOption(fInfo, tool, option, updatedves);
assertTrue(option == updatedOption);
OptionStringValue[] ves = option.getBasicStringListValueElements();