1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-03 14:25:37 +02:00

Fix warnings.

This commit is contained in:
Markus Schorn 2008-07-15 15:00:31 +00:00
parent 30ddbb8708
commit 93fe4bbc48
52 changed files with 318 additions and 315 deletions

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse-cdt version="2.0"?>
<cdtproject/>

View file

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="converted.config.1532818698">
<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="converted.config.1532818698" moduleId="org.eclipse.cdt.core.settings" name="convertedConfig">
<externalSettings/>
<extensions/>
</storageModule>
</cconfiguration>
</storageModule>
</cproject>

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2008 Wind River Systems, Inc. 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
@ -55,6 +55,9 @@ public final class ASTRewrite {
private final ASTModificationStore fModificationStore;
private final ASTModification fParentMod;
/**
* @noreference This constructor is not intended to be referenced by clients.
*/
public ASTRewrite(IASTNode root, ASTModificationStore modStore, ASTModification parentMod) {
fRoot= root;
fModificationStore= modStore;

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.parser.token;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ITokenDuple;
@ -80,7 +81,7 @@ public class OperatorTokenDuple implements ITokenDuple {
return token.getLastToken();
}
public List[] getTemplateIdArgLists() {
public List<IASTNode>[] getTemplateIdArgLists() {
return token.getTemplateIdArgLists();
}
@ -96,7 +97,7 @@ public class OperatorTokenDuple implements ITokenDuple {
return token.getSegmentCount();
}
public Iterator iterator() {
public Iterator<IToken> iterator() {
return token.iterator();
}

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.parser.token;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ITokenDuple;
@ -22,21 +23,28 @@ import org.eclipse.cdt.core.parser.ITokenDuple;
*/
public class TemplateTokenDuple extends BasicTokenDuple {
protected final List [] argLists;
protected final List<IASTNode>[] argLists;
/**
* @param first
* @param last
* @param templateArgLists
*/
public TemplateTokenDuple(IToken first, IToken last, List templateArgLists) {
public TemplateTokenDuple(IToken first, IToken last, List<List<IASTNode>> templateArgLists) {
super(first, last);
argLists = (List[]) templateArgLists.toArray( new List [templateArgLists.size()] );
argLists = toArray(templateArgLists);
numSegments = calculateSegmentCount();
}
@SuppressWarnings("unchecked")
private <T> List<T>[] toArray(List<List<T>> templateArgLists) {
return templateArgLists.toArray( new List[templateArgLists.size()] );
}
@SuppressWarnings("unchecked")
private <T> List<T>[] newArrayOfLists(int size) {
return new List[size];
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ITokenDuple#getSegmentCount()
*/
@ -63,9 +71,9 @@ public class TemplateTokenDuple extends BasicTokenDuple {
last = token;
}
List [] args = getTemplateIdArgLists();
List<IASTNode>[] args = getTemplateIdArgLists();
if( args != null && args[ args.length - 1 ] != null ){
List newArgs = new ArrayList( 1 );
List<List<IASTNode>> newArgs = new ArrayList<List<IASTNode>>( 1 );
newArgs.add( args[ args.length - 1 ] );
return TokenFactory.createTokenDuple( first, last, newArgs );
}
@ -76,12 +84,12 @@ public class TemplateTokenDuple extends BasicTokenDuple {
public TemplateTokenDuple( ITokenDuple first, ITokenDuple last )
{
super( first, last );
List [] a1 = first.getTemplateIdArgLists();
List [] a2 = last.getTemplateIdArgLists();
List<IASTNode>[] a1 = first.getTemplateIdArgLists();
List<IASTNode>[] a2 = last.getTemplateIdArgLists();
int l1 = ( a1 != null ) ? a1.length : first.getSegmentCount();
int l2 = ( a2 != null ) ? a2.length : first.getSegmentCount();
argLists = new List[ l1 + l2 ];
argLists = newArrayOfLists(l1 + l2);
if( a1 != null )
System.arraycopy( a1, 0, argLists, 0, l1 );
if( a2 != null )
@ -89,18 +97,19 @@ public class TemplateTokenDuple extends BasicTokenDuple {
numSegments = calculateSegmentCount();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ITokenDuple#getTemplateIdArgLists()
*/
@Override
public List[] getTemplateIdArgLists() {
public List<IASTNode>[] getTemplateIdArgLists() {
return argLists;
}
@Override
public ITokenDuple[] getSegments()
{
List r = new ArrayList();
List<ITokenDuple> r = new ArrayList<ITokenDuple>();
IToken token = null;
IToken prev = null;
IToken last = getLastToken();
@ -114,10 +123,10 @@ public class TemplateTokenDuple extends BasicTokenDuple {
if( token.getType() == IToken.tLT )
token = TokenFactory.consumeTemplateIdArguments( token, last );
if( token.getType() == IToken.tCOLONCOLON ){
List newArgs = null;
List<List<IASTNode>> newArgs = null;
if( argLists[count] != null )
{
newArgs = new ArrayList( 1 );
newArgs = new ArrayList<List<IASTNode>>(1);
newArgs.add( argLists[count]);
}
ITokenDuple d = TokenFactory.createTokenDuple( startOfSegment, prev != null ? prev : startOfSegment, newArgs );
@ -127,16 +136,16 @@ public class TemplateTokenDuple extends BasicTokenDuple {
continue;
}
}
List newArgs = null;
List<List<IASTNode>> newArgs = null;
//pointer to members could have a A::B<int>::
if( count < argLists.length && argLists[count] != null )
{
newArgs = new ArrayList( 1 );
newArgs.add( argLists[count]);
newArgs = new ArrayList<List<IASTNode>>(1);
newArgs.add(argLists[count]);
}
ITokenDuple d = TokenFactory.createTokenDuple( startOfSegment, last, newArgs);
r.add( d );
return (ITokenDuple[]) r.toArray( new ITokenDuple[ r.size() ]);
return r.toArray( new ITokenDuple[ r.size() ]);
}

View file

@ -15,6 +15,7 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ITokenDuple;
@ -56,15 +57,15 @@ public class TokenFactory {
public int getStartOffset() {
return fToken.getOffset();
}
public List[] getTemplateIdArgLists() {
public List<IASTNode>[] getTemplateIdArgLists() {
return null;
}
public IToken getToken(int index) {
if( index == 0 ) return fToken;
return null;
}
public Iterator iterator() {
return new Iterator() {
public Iterator<IToken> iterator() {
return new Iterator<IToken>() {
private boolean hasNext = true;
public void remove() {
throw new UnsupportedOperationException();
@ -72,7 +73,7 @@ public class TokenFactory {
public boolean hasNext() {
return hasNext;
}
public Object next() {
public IToken next() {
hasNext = false;
return fToken;
}
@ -102,7 +103,7 @@ public class TokenFactory {
return new BasicTokenDuple( first, last );
}
public static ITokenDuple createTokenDuple(IToken first, IToken last, List templateArgLists) {
public static ITokenDuple createTokenDuple(IToken first, IToken last, List<List<IASTNode>> templateArgLists) {
if (templateArgLists == null || templateArgLists.isEmpty()) {
return createTokenDuple(first, last);
}
@ -112,8 +113,8 @@ public class TokenFactory {
public static ITokenDuple createTokenDuple( ITokenDuple firstDuple, ITokenDuple secondDuple ){
if( secondDuple == null ) return firstDuple;
if( firstDuple == null ) return secondDuple;
List [] f1 = firstDuple.getTemplateIdArgLists();
List [] f2 = secondDuple.getTemplateIdArgLists();
List<IASTNode>[] f1 = firstDuple.getTemplateIdArgLists();
List<IASTNode>[] f2 = secondDuple.getTemplateIdArgLists();
if( f1 == null && f2 == null )
return new BasicTokenDuple( firstDuple, secondDuple );
return new TemplateTokenDuple( firstDuple, secondDuple );

View file

@ -42,7 +42,7 @@ public class Checksums {
* @throws NoSuchAlgorithmException
* @since 4.0
*/
public static MessageDigest getAlgorithm(Map<String, Object> persistedMap) throws NoSuchAlgorithmException {
public static MessageDigest getAlgorithm(Map<?, ?> persistedMap) throws NoSuchAlgorithmException {
Object obj= persistedMap.get(KEY_ALGORITHM);
String alg= obj instanceof String ? (String) obj : DEFAULT_ALGORITHM;
return MessageDigest.getInstance(alg);
@ -80,7 +80,7 @@ public class Checksums {
* Retrieves a checksum for a file from the persisted map. May return <code>null</code>.
* @since 4.0
*/
public static byte[] getChecksum(Map<String, Object> persistedMap, IFile file) {
public static byte[] getChecksum(Map<?, ?> persistedMap, IFile file) {
IPath prjRel= file.getProjectRelativePath();
Object checksum= persistedMap.get(prjRel.toString());
if (checksum instanceof byte[])

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2008 Wind River Systems, Inc. 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
@ -8,7 +8,6 @@
* Contributors:
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom;
import java.io.File;
@ -144,7 +143,7 @@ public class TeamPDOMExportOperation implements IWorkspaceRunnable {
}
private void createChecksums(ICProject cproject, PDOM pdom, File target, IProgressMonitor monitor) throws CoreException {
HashSet fullPaths= new HashSet();
HashSet<String> fullPaths= new HashSet<String>();
try {
pdom.acquireReadLock();
} catch (InterruptedException e) {
@ -165,15 +164,15 @@ public class TeamPDOMExportOperation implements IWorkspaceRunnable {
int i=0;
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
IFile[] files= new IFile[fullPaths.size()];
for (Iterator iterator = fullPaths.iterator(); iterator.hasNext();) {
String fullPath= (String) iterator.next();
for (Iterator<String> iterator = fullPaths.iterator(); iterator.hasNext();) {
String fullPath= iterator.next();
files[i++]= root.getFile(new Path(fullPath));
}
Map map= Checksums.createChecksumMap(files, fMessageDigest, monitor);
Map<String, Object> map= Checksums.createChecksumMap(files, fMessageDigest, monitor);
writeChecksums(map, target);
}
private void writeChecksums(Map map, File target) throws CoreException {
private void writeChecksums(Map<?, ?> map, File target) throws CoreException {
ObjectOutputStream out= null;
try {
out= new ObjectOutputStream(new FileOutputStream(target));

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2008 Wind River Systems, Inc. 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
@ -8,7 +8,6 @@
* Contributors:
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom;
import java.io.File;
@ -146,7 +145,7 @@ public class TeamPDOMImportOperation implements IWorkspaceRunnable {
private void doImportIndex(File importFile, IProgressMonitor monitor) throws CoreException, InterruptedException, IOException {
ZipFile zip= new ZipFile(importFile);
Map checksums= null;
Map<?, ?> checksums= null;
try {
importIndex(zip, monitor);
checksums= getChecksums(zip);
@ -172,7 +171,7 @@ public class TeamPDOMImportOperation implements IWorkspaceRunnable {
CCoreInternals.getPDOMManager().importProjectPDOM(fProject, stream);
}
private Map getChecksums(ZipFile zip) {
private Map<?, ?> getChecksums(ZipFile zip) {
ZipEntry indexEntry= zip.getEntry(CHECKSUMS_NAME);
if (indexEntry != null) {
try {
@ -180,7 +179,7 @@ public class TeamPDOMImportOperation implements IWorkspaceRunnable {
try {
Object obj= input.readObject();
if (obj instanceof Map) {
return (Map) obj;
return (Map<?,?>) obj;
}
}
finally {
@ -194,7 +193,7 @@ public class TeamPDOMImportOperation implements IWorkspaceRunnable {
return Collections.EMPTY_MAP;
}
private void checkIndex(Map checksums, IProgressMonitor monitor) throws CoreException, InterruptedException {
private void checkIndex(Map<?, ?> checksums, IProgressMonitor monitor) throws CoreException, InterruptedException {
IPDOM obj= CCoreInternals.getPDOMManager().getPDOM(fProject);
if (!(obj instanceof WritablePDOM)) {
return;
@ -203,7 +202,7 @@ public class TeamPDOMImportOperation implements IWorkspaceRunnable {
WritablePDOM pdom= (WritablePDOM) obj;
pdom.acquireReadLock();
try {
List filesToCheck= new ArrayList();
List<FileAndChecksum> filesToCheck= new ArrayList<FileAndChecksum>();
if (!pdom.isSupportedVersion()) {
throw new CoreException(CCorePlugin.createStatus(
NLS.bind(Messages.PDOMImportTask_errorInvalidPDOMVersion, fProject.getElementName())));
@ -264,7 +263,7 @@ public class TeamPDOMImportOperation implements IWorkspaceRunnable {
}
private void deleteFiles(WritablePDOM pdom, final int giveupReadlocks, IIndexFragmentFile[] filesToDelete,
List updateTimestamps, IProgressMonitor monitor) throws InterruptedException, CoreException {
List<FileAndChecksum> updateTimestamps, IProgressMonitor monitor) throws InterruptedException, CoreException {
pdom.acquireWriteLock(giveupReadlocks);
try {
for (int i = 0; i < filesToDelete.length; i++) {
@ -274,10 +273,10 @@ public class TeamPDOMImportOperation implements IWorkspaceRunnable {
pdom.clearFile(ifile, null);
}
}
for (Iterator i = updateTimestamps.iterator(); i.hasNext();) {
for (Iterator<FileAndChecksum> i = updateTimestamps.iterator(); i.hasNext();) {
checkMonitor(monitor);
FileAndChecksum fc = (FileAndChecksum) i.next();
FileAndChecksum fc = i.next();
IIndexFragmentFile file= fc.fIFile;
if (file != null) {
IResource r= fc.fFile.getResource();
@ -293,12 +292,12 @@ public class TeamPDOMImportOperation implements IWorkspaceRunnable {
}
}
private void removeOutdatedFiles(Map checksums, List filesToCheck, IProgressMonitor monitor) throws NoSuchAlgorithmException {
private void removeOutdatedFiles(Map<?, ?> checksums, List<FileAndChecksum> filesToCheck, IProgressMonitor monitor) throws NoSuchAlgorithmException {
MessageDigest md= Checksums.getAlgorithm(checksums);
for (Iterator i = filesToCheck.iterator(); i.hasNext();) {
for (Iterator<FileAndChecksum> i = filesToCheck.iterator(); i.hasNext();) {
checkMonitor(monitor);
FileAndChecksum cs= (FileAndChecksum) i.next();
FileAndChecksum cs= i.next();
ITranslationUnit tu= cs.fFile;
if (tu != null) {
IPath location= tu.getLocation();

View file

@ -11,7 +11,6 @@
* Andrew Ferguson (Symbian)
* Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.core;
import java.io.IOException;
@ -176,11 +175,15 @@ public class CCorePlugin extends Plugin {
*/
public static final String SPACE = "space"; //$NON-NLS-1$
public CDTLogWriter cdtLog = null;
private static CCorePlugin fgCPlugin;
private static ResourceBundle fgResourceBundle;
/**
* @noreference This field is not intended to be referenced by clients.
*/
public CDTLogWriter cdtLog = null;
private CProjectDescriptionManager fNewCProjectDescriptionManager;
private CoreModel fCoreModel;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others.
* Copyright (c) 2007, 2008 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
@ -59,29 +59,29 @@ import org.w3c.dom.Element;
public class CConfigBasedDescriptorManager implements ICDescriptorManager {
private static CConfigBasedDescriptorManager fInstance;
public static final String NULL_OWNER_ID = ""; //$NON-NLS-1$
private Map fOwnerConfigMap = null;
private Map<String, COwnerConfiguration> fOwnerConfigMap = null;
private ICProjectDescriptionListener fDescriptionListener;
private static final QualifiedName DESCRIPTOR_PROPERTY = new QualifiedName(CCorePlugin.PLUGIN_ID, "CDescriptor"); //$NON-NLS-1$
private List fListeners = Collections.synchronizedList(new Vector());
private List<ICDescriptorListener> fListeners = Collections.synchronizedList(new Vector<ICDescriptorListener>());
// private ThreadLocal fApplyingDescriptorMap = new ThreadLocal();
private ThreadLocal fThreadInfo = new ThreadLocal();
private ThreadLocal<ThreadInfo> fThreadInfo = new ThreadLocal<ThreadInfo>();
private class ThreadInfo {
Map fApplyingDescriptorMap;
Map fOperatingDescriptorMap;
Map<IProject, CConfigBasedDescriptor> fApplyingDescriptorMap;
Map<IProject, CConfigBasedDescriptor> fOperatingDescriptorMap;
public Map getApplyingDescriptorMap(boolean create){
public Map<IProject, CConfigBasedDescriptor> getApplyingDescriptorMap(boolean create){
if(fApplyingDescriptorMap == null && create){
fApplyingDescriptorMap = new HashMap(1);
fApplyingDescriptorMap = new HashMap<IProject, CConfigBasedDescriptor>(1);
}
return fApplyingDescriptorMap;
}
public Map getOperatingDescriptorMap(boolean create){
public Map<IProject, CConfigBasedDescriptor> getOperatingDescriptorMap(boolean create){
if(fOperatingDescriptorMap == null && create){
fOperatingDescriptorMap = new HashMap(1);
fOperatingDescriptorMap = new HashMap<IProject, CConfigBasedDescriptor>(1);
}
return fOperatingDescriptorMap;
}
@ -386,7 +386,7 @@ public class CConfigBasedDescriptorManager implements ICDescriptorManager {
if (fOwnerConfigMap == null) {
initializeOwnerConfiguration();
}
COwnerConfiguration config = (COwnerConfiguration)fOwnerConfigMap.get(id);
COwnerConfiguration config = fOwnerConfigMap.get(id);
if (config == null) { // no install owner, lets create place holder config for it.
config = new COwnerConfiguration(id, CCorePlugin.getResourceString("CDescriptorManager.owner_not_Installed")); //$NON-NLS-1$
fOwnerConfigMap.put(id, config);
@ -397,7 +397,7 @@ public class CConfigBasedDescriptorManager implements ICDescriptorManager {
private void initializeOwnerConfiguration() {
IExtensionPoint extpoint = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, "CProject"); //$NON-NLS-1$
IExtension extension[] = extpoint.getExtensions();
fOwnerConfigMap = new HashMap(extension.length);
fOwnerConfigMap = new HashMap<String, COwnerConfiguration>(extension.length);
for (int i = 0; i < extension.length; i++) {
IConfigurationElement element[] = extension[i].getConfigurationElements();
for (int j = 0; j < element.length; j++) {
@ -552,7 +552,7 @@ public class CConfigBasedDescriptorManager implements ICDescriptorManager {
protected void notifyListeners(final CDescriptorEvent event) {
final ICDescriptorListener[] listeners;
synchronized (fListeners) {
listeners = (ICDescriptorListener[])fListeners.toArray(new ICDescriptorListener[fListeners.size()]);
listeners = fListeners.toArray(new ICDescriptorListener[fListeners.size()]);
}
for (int i = 0; i < listeners.length; i++) {
final int index = i;
@ -572,13 +572,13 @@ public class CConfigBasedDescriptorManager implements ICDescriptorManager {
}
public boolean reconsile(CConfigBasedDescriptor descriptor, ICProjectDescription des){
Map map = descriptor.getStorageDataElMap();
Map<String, Element> map = descriptor.getStorageDataElMap();
boolean reconsiled = false;
if(map.size() != 0){
for(Iterator iter = map.entrySet().iterator(); iter.hasNext();){
Map.Entry entry = (Map.Entry)iter.next();
String id = (String)entry.getKey();
Element el = (Element)entry.getValue();
for(Iterator<Map.Entry<String, Element>> iter = map.entrySet().iterator(); iter.hasNext();){
Map.Entry<String, Element> entry = iter.next();
String id = entry.getKey();
Element el = entry.getValue();
if(reconsile(id, el.getParentNode() != null ? el : null, des))
reconsiled = true;
}
@ -629,9 +629,9 @@ public class CConfigBasedDescriptorManager implements ICDescriptorManager {
}
private CConfigBasedDescriptor getApplyingDescriptor(IProject project){
Map map = getApplyingDescriptorMap(false);
Map<IProject, CConfigBasedDescriptor> map = getApplyingDescriptorMap(false);
if(map != null){
return (CConfigBasedDescriptor)map.get(project);
return map.get(project);
}
return null;
}
@ -640,20 +640,20 @@ public class CConfigBasedDescriptorManager implements ICDescriptorManager {
if(dr == null)
clearApplyingDescriptor(project);
else {
Map map = getApplyingDescriptorMap(true);
Map<IProject, CConfigBasedDescriptor> map = getApplyingDescriptorMap(true);
map.put(project, dr);
}
}
private CConfigBasedDescriptor clearApplyingDescriptor(IProject project){
Map map = getApplyingDescriptorMap(false);
Map<IProject, CConfigBasedDescriptor> map = getApplyingDescriptorMap(false);
if(map != null){
return (CConfigBasedDescriptor)map.remove(project);
return map.remove(project);
}
return null;
}
private Map getApplyingDescriptorMap(boolean create){
private Map<IProject, CConfigBasedDescriptor> getApplyingDescriptorMap(boolean create){
ThreadInfo info = getThreadInfo(create);
if(info == null)
return null;
@ -668,9 +668,9 @@ public class CConfigBasedDescriptorManager implements ICDescriptorManager {
}
private CConfigBasedDescriptor getOperatingDescriptor(IProject project){
Map map = getOperatingDescriptorMap(false);
Map<IProject, CConfigBasedDescriptor> map = getOperatingDescriptorMap(false);
if(map != null){
return (CConfigBasedDescriptor)map.get(project);
return map.get(project);
}
return null;
}
@ -679,20 +679,20 @@ public class CConfigBasedDescriptorManager implements ICDescriptorManager {
if(dr == null)
clearOperatingDescriptor(project);
else {
Map map = getOperatingDescriptorMap(true);
Map<IProject, CConfigBasedDescriptor> map = getOperatingDescriptorMap(true);
map.put(project, dr);
}
}
private CConfigBasedDescriptor clearOperatingDescriptor(IProject project){
Map map = getOperatingDescriptorMap(false);
Map<IProject, CConfigBasedDescriptor> map = getOperatingDescriptorMap(false);
if(map != null){
return (CConfigBasedDescriptor)map.remove(project);
return map.remove(project);
}
return null;
}
private Map getOperatingDescriptorMap(boolean create){
private Map<IProject, CConfigBasedDescriptor> getOperatingDescriptorMap(boolean create){
ThreadInfo info = getThreadInfo(create);
if(info == null)
return null;
@ -701,7 +701,7 @@ public class CConfigBasedDescriptorManager implements ICDescriptorManager {
}
private ThreadInfo getThreadInfo(boolean create){
ThreadInfo info = (ThreadInfo)fThreadInfo.get();
ThreadInfo info = fThreadInfo.get();
if(info == null && create){
info = new ThreadInfo();
fThreadInfo.set(info);

View file

@ -13,7 +13,6 @@
package org.eclipse.cdt.internal.core;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
@ -35,10 +34,10 @@ public class CCorePreferenceInitializer extends AbstractPreferenceInitializer {
*/
@Override
public void initializeDefaultPreferences() {
HashSet optionNames = CModelManager.OptionNames;
HashSet<String> optionNames = CModelManager.OptionNames;
// Formatter settings
Map defaultOptionsMap = DefaultCodeFormatterConstants.getDefaultSettings(); // code formatter defaults
Map<String, String> defaultOptionsMap = DefaultCodeFormatterConstants.getDefaultSettings(); // code formatter defaults
// Compiler settings
defaultOptionsMap.put(CCorePreferenceConstants.TODO_TASK_TAGS, CCorePreferenceConstants.DEFAULT_TASK_TAG);
@ -52,10 +51,9 @@ public class CCorePreferenceInitializer extends AbstractPreferenceInitializer {
// Store default values to default preferences
IEclipsePreferences defaultPreferences = ((IScopeContext) new DefaultScope()).getNode(CCorePlugin.PLUGIN_ID);
for (Iterator iter = defaultOptionsMap.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Map.Entry) iter.next();
String optionName = (String) entry.getKey();
defaultPreferences.put(optionName, (String)entry.getValue());
for (Map.Entry<String,String> entry : defaultOptionsMap.entrySet()) {
String optionName = entry.getKey();
defaultPreferences.put(optionName, entry.getValue());
optionNames.add(optionName);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2007 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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,7 @@ import java.util.HashMap;
public class CExtensionInfo {
protected HashMap attribMap = new HashMap(4);
protected HashMap<String, String> attribMap = new HashMap<String, String>(4);
public CExtensionInfo(){
@ -24,7 +24,7 @@ public class CExtensionInfo {
attribMap.putAll(base.attribMap);
}
public HashMap getAttributes() {
public HashMap<String, String> getAttributes() {
return attribMap;
}
@ -37,7 +37,7 @@ public class CExtensionInfo {
}
public String getAttribute(String key) {
return (String) attribMap.get(key);
return attribMap.get(key);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others.
* Copyright (c) 2007, 2008 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
@ -48,7 +48,7 @@ public class CdtVarPathEntryVariableManager implements
private UserDefinedVariableSupplier fUserVarSupplier = UserDefinedVariableSupplier.getInstance();
private VarSubstitutor fSubstitutor = new VarSubstitutor();
private VarSupplier fVarSupplier = new VarSupplier();
private Set fListeners;
private Set<IPathEntryVariableChangeListener> fListeners;
private class VarSubstitutor extends SupplierBasedCdtVariableSubstitutor {
public VarSubstitutor() {
@ -91,12 +91,12 @@ public class CdtVarPathEntryVariableManager implements
public ICdtVariable[] getVariables(IVariableContextInfo context) {
ICdtVariable vars[] = fUserVarSupplier.getMacros(ICoreVariableContextInfo.CONTEXT_WORKSPACE, null);
List list = new ArrayList();
List<ICdtVariable> list = new ArrayList<ICdtVariable>();
for (ICdtVariable var : vars) {
if(getVariablePath(var) != null)
list.add(var);
}
return (ICdtVariable[])list.toArray(new ICdtVariable[list.size()]);
return list.toArray(new ICdtVariable[list.size()]);
}
}
@ -104,7 +104,7 @@ public class CdtVarPathEntryVariableManager implements
public CdtVarPathEntryVariableManager(){
fListeners = Collections.synchronizedSet(new HashSet());
fListeners = Collections.synchronizedSet(new HashSet<IPathEntryVariableChangeListener>());
fUserVarSupplier.addListener(this);
}
@ -151,12 +151,12 @@ public class CdtVarPathEntryVariableManager implements
public String[] getVariableNames() {
ICdtVariable[] vars = fUserVarSupplier.getMacros(ICoreVariableContextInfo.CONTEXT_WORKSPACE, null);
ArrayList list = new ArrayList();
ArrayList<String> list = new ArrayList<String>();
for(int i = 0; i > vars.length; i++){
if(getVariablePath(vars[i]) != null)
list.add(vars[i].getName());
}
return (String[])list.toArray(new String[list.size()]);
return list.toArray(new String[list.size()]);
}
public boolean isDefined(String name) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006 Wind River Systems, Inc. and others.
* Copyright (c) 2006, 2008 Wind River Systems, Inc. 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
@ -8,7 +8,6 @@
* Contributors:
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core;
import java.util.Iterator;
@ -27,7 +26,7 @@ class PositionTrackerChain implements IDocumentListener {
private static final int MAX_DEPTH = 100; // 100 saves
private static final long MAX_AGE = 24 * 60 * 60 * 1000; // one day
private LinkedList fTrackers= new LinkedList();
private LinkedList<PositionTracker> fTrackers= new LinkedList<PositionTracker>();
private PositionTracker fActiveTracker;
private IDocument fDocument;
@ -43,7 +42,7 @@ class PositionTrackerChain implements IDocumentListener {
fActiveTracker= null;
}
else {
fActiveTracker= (PositionTracker) fTrackers.getLast();
fActiveTracker= fTrackers.getLast();
fActiveTracker.revive();
}
}
@ -67,8 +66,8 @@ class PositionTrackerChain implements IDocumentListener {
fTrackers.removeFirst();
}
long minTimeStamp= fActiveTracker.getTimeStamp() - MAX_AGE;
for (Iterator iter = fTrackers.iterator(); iter.hasNext();) {
PositionTracker tracker= (PositionTracker) iter.next();
for (Iterator<PositionTracker> iter = fTrackers.iterator(); iter.hasNext();) {
PositionTracker tracker= iter.next();
if (tracker.getRetiredTimeStamp() >= minTimeStamp) {
break;
}
@ -100,8 +99,8 @@ class PositionTrackerChain implements IDocumentListener {
*/
public PositionTracker findTrackerAtOrAfter(long timestamp) {
PositionTracker candidate= null;
for (ListIterator iter = fTrackers.listIterator(fTrackers.size()); iter.hasPrevious();) {
PositionTracker tracker = (PositionTracker) iter.previous();
for (ListIterator<PositionTracker> iter = fTrackers.listIterator(fTrackers.size()); iter.hasPrevious();) {
PositionTracker tracker = iter.previous();
long trackerTimestamp= tracker.getTimeStamp();
if (trackerTimestamp >= timestamp) {
candidate= tracker;
@ -119,8 +118,8 @@ class PositionTrackerChain implements IDocumentListener {
* @return the tracker at the timestamp, <code>null</code> if none created at the given time.
*/
public PositionTracker findTrackerAt(long timestamp) {
for (ListIterator iter = fTrackers.listIterator(fTrackers.size()); iter.hasPrevious();) {
PositionTracker tracker = (PositionTracker) iter.previous();
for (ListIterator<PositionTracker> iter = fTrackers.listIterator(fTrackers.size()); iter.hasPrevious();) {
PositionTracker tracker = iter.previous();
long trackerTimestamp= tracker.getTimeStamp();
if (trackerTimestamp == timestamp) {
return tracker;
@ -178,8 +177,7 @@ class PositionTrackerChain implements IDocumentListener {
public int getMemorySize() {
int size= MEMORY_SIZE;
for (Iterator iter = fTrackers.iterator(); iter.hasNext();) {
PositionTracker tracker = (PositionTracker) iter.next();
for (PositionTracker tracker : fTrackers) {
size+= LINKED_LIST_ENTRY_SIZE;
size+= tracker.getMemorySize();
}
@ -189,7 +187,7 @@ class PositionTrackerChain implements IDocumentListener {
public int removeOldest() {
int memdiff= 0;
if (fTrackers.size() > 1) {
PositionTracker tracker= (PositionTracker) fTrackers.removeFirst();
PositionTracker tracker= fTrackers.removeFirst();
memdiff= tracker.getMemorySize() + LINKED_LIST_ENTRY_SIZE;
tracker.clear();
}
@ -198,7 +196,7 @@ class PositionTrackerChain implements IDocumentListener {
public long getOldestRetirement() {
if (fTrackers.size() > 1) {
PositionTracker tracker= (PositionTracker) fTrackers.getFirst();
PositionTracker tracker= fTrackers.getFirst();
return tracker.getRetiredTimeStamp();
}
return Long.MAX_VALUE;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006 Wind River Systems, Inc. and others.
* Copyright (c) 2006, 2008 Wind River Systems, Inc. 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
@ -8,7 +8,6 @@
* Contributors:
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core;
import java.util.HashMap;
@ -41,10 +40,10 @@ public class PositionTrackerManager implements IPositionTrackerManager, IFileBuf
private int fMemoryCounter= 0;
private int fInstalled= 0;
private HashMap fPositionTrackerMap;
private HashMap<IPath, PositionTrackerChain> fPositionTrackerMap;
private PositionTrackerManager() {
fPositionTrackerMap= new HashMap();
fPositionTrackerMap= new HashMap<IPath, PositionTrackerChain>();
}
public synchronized void install() {
@ -112,7 +111,7 @@ public class PositionTrackerManager implements IPositionTrackerManager, IFileBuf
}
private synchronized PositionTrackerChain getChain(ITextFileBuffer buffer) {
return (PositionTrackerChain) fPositionTrackerMap.get(buffer.getLocation());
return fPositionTrackerMap.get(buffer.getLocation());
}
private synchronized void resetToLastCheckpoint(ITextFileBuffer buffer) {
@ -130,22 +129,21 @@ public class PositionTrackerManager implements IPositionTrackerManager, IFileBuf
private synchronized void runCleanup() {
fMemoryCounter= 0;
for (Iterator iter = fPositionTrackerMap.values().iterator(); iter.hasNext();) {
PositionTrackerChain chain= (PositionTrackerChain) iter.next();
for (PositionTrackerChain chain : fPositionTrackerMap.values()) {
fMemoryCounter+= HASHMAP_ENTRY_SIZE;
fMemoryCounter+= chain.getMemorySize();
}
if (fMemoryCounter > MAX_MEMORY_AFTER_CLEANUP) {
SortedMap map= new TreeMap();
for (Iterator iter = fPositionTrackerMap.values().iterator(); iter.hasNext();) {
PositionTrackerChain chain = (PositionTrackerChain) iter.next();
SortedMap<Long, List<PositionTrackerChain>> map= new TreeMap<Long, List<PositionTrackerChain>>();
for (Iterator<PositionTrackerChain> iter = fPositionTrackerMap.values().iterator(); iter.hasNext();) {
PositionTrackerChain chain = iter.next();
addChain(map, chain);
}
while (!map.isEmpty()) {
Long key= (Long) map.firstKey();
List list= (List) map.remove(key);
for (Iterator iter = list.iterator(); iter.hasNext();) {
PositionTrackerChain chain = (PositionTrackerChain) iter.next();
Long key= map.firstKey();
List<PositionTrackerChain> list= map.remove(key);
for (Iterator<PositionTrackerChain> iter = list.iterator(); iter.hasNext();) {
PositionTrackerChain chain = iter.next();
fMemoryCounter+= chain.removeOldest();
addChain(map, chain);
}
@ -156,13 +154,13 @@ public class PositionTrackerManager implements IPositionTrackerManager, IFileBuf
}
}
private synchronized void addChain(SortedMap map, PositionTrackerChain chain) {
private synchronized void addChain(SortedMap<Long, List<PositionTrackerChain>> map, PositionTrackerChain chain) {
long or= chain.getOldestRetirement();
if (or != Long.MAX_VALUE) {
Long lor= new Long(or);
List list= (List) map.get(lor);
List<PositionTrackerChain> list= map.get(lor);
if (list == null) {
list= new LinkedList();
list= new LinkedList<PositionTrackerChain>();
map.put(lor, list);
}
list.add(chain);
@ -173,7 +171,7 @@ public class PositionTrackerManager implements IPositionTrackerManager, IFileBuf
* {@inheritDoc}
*/
public synchronized IPositionConverter findPositionConverter(IFile file, long timestamp) {
PositionTrackerChain chain= (PositionTrackerChain) fPositionTrackerMap.get(file.getFullPath());
PositionTrackerChain chain= fPositionTrackerMap.get(file.getFullPath());
if (chain != null) {
return chain.findTrackerAt(timestamp);
}
@ -184,7 +182,7 @@ public class PositionTrackerManager implements IPositionTrackerManager, IFileBuf
* {@inheritDoc}
*/
public synchronized IPositionConverter findPositionConverter(IPath externalLocation, long timestamp) {
PositionTrackerChain chain= (PositionTrackerChain) fPositionTrackerMap.get(externalLocation);
PositionTrackerChain chain= fPositionTrackerMap.get(externalLocation);
if (chain != null) {
return chain.findTrackerAt(timestamp);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2007 Intel Corporation and others.
* Copyright (c) 2005, 2008 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
@ -17,7 +17,7 @@ import org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo;
import org.eclipse.cdt.utils.cdtvariables.SupplierBasedCdtVariableSubstitutor;
/**
* This substitutor resolves all macro references
* This substituter resolves all macro references
*
* @see org.eclipse.cdt.utils.cdtvariables.IVariableSubstitutor
* @since 3.0
@ -27,7 +27,7 @@ public class CoreVariableSubstitutor extends SupplierBasedCdtVariableSubstitutor
public CoreVariableSubstitutor(IVariableContextInfo contextInfo,
String inexistentMacroValue, String listDelimiter,
Map delimiterMap, String incorrectlyReferencedMacroValue) {
Map<?, ?> delimiterMap, String incorrectlyReferencedMacroValue) {
super(contextInfo, inexistentMacroValue, listDelimiter, delimiterMap,
incorrectlyReferencedMacroValue);
// TODO Auto-generated constructor stub

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2007 Intel Corporation and others.
* Copyright (c) 2005, 2008 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
@ -45,8 +45,8 @@ public class EnvironmentVariableSupplier extends CoreMacroSupplierBase {
if(delimiter != null && !"".equals(delimiter)){ //$NON-NLS-1$
fType = VALUE_TEXT_LIST;
if(value != null){
List list = EnvVarOperationProcessor.convertToList(value,delimiter);
fStringListValue = (String[])list.toArray(new String[list.size()]);
List<String> list = EnvVarOperationProcessor.convertToList(value,delimiter);
fStringListValue = list.toArray(new String[list.size()]);
} else {
fStringListValue = null;
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2007 Intel Corporation and others.
* Copyright (c) 2005, 2008 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
@ -64,14 +64,14 @@ public class StorableCdtVariable extends CdtVariable {
fStringValue = element.getAttribute(VALUE);
else {
ICStorageElement nodeList[] = element.getChildren();
List values = new ArrayList();
List<String> values = new ArrayList<String>();
for (int i = 0; i < nodeList.length; ++i) {
ICStorageElement node = nodeList[i];
if (node.getName().equals(VALUE_ELEMENT_NAME)) {
values.add(node.getAttribute(VALUE_ELEMENT_VALUE));
}
}
fStringListValue = (String[])values.toArray(new String[values.size()]);
fStringListValue = values.toArray(new String[values.size()]);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2007 Intel Corporation and others.
* Copyright (c) 2005, 2008 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
@ -48,7 +48,7 @@ public class EclipseEnvironmentSupplier implements ICoreEnvironmentVariableSuppl
return null;
IEnvironmentVariable variables[] = new IEnvironmentVariable[values.size()];
Enumeration en = values.propertyNames();
Enumeration<?> en = values.propertyNames();
for( int i = 0; i < variables.length ; i++){
String name = (String)en.nextElement();
String value = values.getProperty(name);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2007 Intel Corporation and others.
* Copyright (c) 2005, 2008 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
@ -29,7 +29,7 @@ import org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor;
*
*/
public class EnvVarCollector {
private Map fMap = null;
private Map<String, EnvVarDescriptor> fMap = null;
public EnvVarCollector(){
}
@ -57,11 +57,11 @@ public class EnvVarCollector {
if(fMap == null){
noCheck = true;
fMap = new HashMap();
fMap = new HashMap<String, EnvVarDescriptor>();
}
EnvVarDescriptor des = null;
if(noCheck || (des = (EnvVarDescriptor)fMap.get(name)) == null){
if(noCheck || (des = fMap.get(name)) == null){
des = new EnvVarDescriptor(var,info,num, supplier);
fMap.put(name,des);
}
@ -82,16 +82,16 @@ public class EnvVarCollector {
public EnvVarDescriptor[] toArray(boolean includeRemoved){
if(fMap == null)
return new EnvVarDescriptor[0];
Collection values = fMap.values();
List list = new ArrayList();
Iterator iter = values.iterator();
Collection<EnvVarDescriptor> values = fMap.values();
List<EnvVarDescriptor> list = new ArrayList<EnvVarDescriptor>();
Iterator<EnvVarDescriptor> iter = values.iterator();
while(iter.hasNext()){
EnvVarDescriptor des = (EnvVarDescriptor)iter.next();
EnvVarDescriptor des = iter.next();
if(des != null &&
(includeRemoved || des.getOperation() != IEnvironmentVariable.ENVVAR_REMOVE))
list.add(des);
}
return (EnvVarDescriptor[])list.toArray(new EnvVarDescriptor[list.size()]);
return list.toArray(new EnvVarDescriptor[list.size()]);
}
/**
@ -107,7 +107,7 @@ public class EnvVarCollector {
if(!EnvironmentVariableManager.getDefault().isVariableCaseSensitive())
name = name.toUpperCase();
return (EnvVarDescriptor)fMap.get(name);
return fMap.get(name);
}
/**

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2005 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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
@ -46,10 +46,10 @@ public class NM {
private static Pattern undef_pattern = null;
private static Pattern normal_pattern = null;
private List undef_symbols;
private List text_symbols;
private List bss_symbols;
private List data_symbols;
private List<String> undef_symbols;
private List<AddressNamePair> text_symbols;
private List<AddressNamePair> bss_symbols;
private List<AddressNamePair> data_symbols;
private void parseOutput(InputStream stream) throws IOException {
@ -135,29 +135,29 @@ public class NM {
System.arraycopy(params, 0, args, 1, params.length);
}
undef_symbols = new ArrayList();
text_symbols = new ArrayList();
data_symbols = new ArrayList();
bss_symbols = new ArrayList();
undef_symbols = new ArrayList<String>();
text_symbols = new ArrayList<AddressNamePair>();
data_symbols = new ArrayList<AddressNamePair>();
bss_symbols = new ArrayList<AddressNamePair>();
Process process = ProcessFactory.getFactory().exec(args);
parseOutput(process.getInputStream());
process.destroy();
}
public String[] getUndefSymbols() {
return (String[]) undef_symbols.toArray(new String[0]);
return undef_symbols.toArray(new String[0]);
}
public AddressNamePair[] getTextSymbols() {
return (AddressNamePair[]) text_symbols.toArray(new AddressNamePair[0]);
return text_symbols.toArray(new AddressNamePair[0]);
}
public AddressNamePair[] getDataSymbols() {
return (AddressNamePair[]) data_symbols.toArray(new AddressNamePair[0]);
return data_symbols.toArray(new AddressNamePair[0]);
}
public AddressNamePair[] getBSSSymbols() {
return (AddressNamePair[]) bss_symbols.toArray(new AddressNamePair[0]);
return bss_symbols.toArray(new AddressNamePair[0]);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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 Objdump {
params = new String[0];
} else {
// FIXME: This is wrong we have to check for quoted strings.
List list = new ArrayList();
List<String> list = new ArrayList<String>();
StringTokenizer st = new StringTokenizer(param);
while (st.hasMoreTokens()) {
list.add(st.nextToken());

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others.
* Copyright (c) 2007, 2008 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
@ -43,7 +43,7 @@ public class SupplierBasedCdtVariableManager {
if(contextInfo == null)
return new ICdtVariable[0];
Map map = new HashMap();
Map<String, ICdtVariable> map = new HashMap<String, ICdtVariable>();
IVariableContextInfo infos[] = includeParentContexts ?
getAllVariableContextInfos(contextInfo) :
new IVariableContextInfo[]{contextInfo};
@ -63,8 +63,8 @@ public class SupplierBasedCdtVariableManager {
}
}
Collection values = map.values();
return (ICdtVariable[])values.toArray(new ICdtVariable[values.size()]);
Collection<ICdtVariable> values = map.values();
return values.toArray(new ICdtVariable[values.size()]);
}
/*
@ -75,14 +75,14 @@ public class SupplierBasedCdtVariableManager {
if(contextInfo == null)
return null;
List list = new ArrayList();
List<IVariableContextInfo> list = new ArrayList<IVariableContextInfo>();
list.add(contextInfo);
while((contextInfo = contextInfo.getNext()) != null)
list.add(contextInfo);
return (IVariableContextInfo[])list.toArray(new IVariableContextInfo[list.size()]);
return list.toArray(new IVariableContextInfo[list.size()]);
}
/*

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006 Nokia and others.
* Copyright (c) 2006, 2008 Nokia 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
@ -19,19 +19,19 @@ import org.eclipse.cdt.core.ISymbolReader;
public class CodeViewReader implements ISymbolReader {
RandomAccessFile file;
int cvData;
boolean isLe;
List fileList;
String[] files = null;
boolean parsed = false;
private RandomAccessFile file;
private int cvData;
private boolean isLe;
private List<String> fileList;
private String[] files = null;
private boolean parsed = false;
public CodeViewReader(RandomAccessFile accessFile, int dataOffset, boolean littleEndian) {
file = accessFile;
cvData = dataOffset;
isLe = littleEndian;
fileList = new ArrayList();
fileList = new ArrayList<String>();
}
public String[] getSourceFiles() {
@ -45,7 +45,7 @@ public class CodeViewReader implements ISymbolReader {
files = new String[fileList.size()];
for (int i = 0; i < fileList.size(); i++) {
files[i] = (String)fileList.get(i);
files[i] = fileList.get(i);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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
@ -565,7 +565,7 @@ public class Coff {
}
public static String[] getStringTable(byte[] bytes) {
List aList = new ArrayList();
List<String> aList = new ArrayList<String>();
int offset = 0;
for (int i = 0; i < bytes.length; i++) {
if (bytes[i] == 0) {
@ -573,7 +573,7 @@ public class Coff {
offset = i + 1;
}
}
return (String[])aList.toArray(new String[0]);
return aList.toArray(new String[0]);
}
public Coff(String filename) throws IOException {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2006 QNX Software Systems and others.
* Copyright (c) 2004, 2008 QNX Software Systems 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
@ -35,7 +35,7 @@ public class CygwinPEBinaryArchive extends PEBinaryArchive {
* java.util.ArrayList)
*/
@Override
protected void addArchiveMembers(ARHeader[] headers, ArrayList children2) {
protected void addArchiveMembers(ARHeader[] headers, ArrayList<IBinaryObject> children2) {
for (int i = 0; i < headers.length; i++) {
IBinaryObject bin = new CygwinPEBinaryObject(getBinaryParser(), getPath(), headers[i]);
children.add(bin);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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,10 +28,10 @@ import org.eclipse.cdt.utils.CygPath;
import org.eclipse.cdt.utils.ICygwinToolsFactroy;
import org.eclipse.cdt.utils.NM;
import org.eclipse.cdt.utils.Objdump;
import org.eclipse.cdt.utils.Symbol;
import org.eclipse.cdt.utils.AR.ARHeader;
import org.eclipse.cdt.utils.coff.Coff;
import org.eclipse.cdt.utils.coff.PE;
import org.eclipse.cdt.utils.coff.Coff.Symbol;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@ -179,7 +179,7 @@ public class CygwinPEBinaryObject extends PEBinaryObject {
symbolLoadingCygPath = getCygPath();
ArrayList list = new ArrayList();
ArrayList<Symbol> list = new ArrayList<Symbol>();
super.loadSymbols(pe, list);
// Add any global symbols
@ -198,7 +198,7 @@ public class CygwinPEBinaryObject extends PEBinaryObject {
// for (int i = 0; i < pairs.length; ++i) {
// addSymbol(pairs[i], list, ISymbol.FUNCTION);
// }
symbols = (ISymbol[]) list.toArray(NO_SYMBOLS);
symbols = list.toArray(NO_SYMBOLS);
Arrays.sort(symbols);
list.clear();
@ -216,7 +216,7 @@ public class CygwinPEBinaryObject extends PEBinaryObject {
}
}
private void addSymbol(NM.AddressNamePair p, List list, int type) {
private void addSymbol(NM.AddressNamePair p, List<Symbol> list, int type) {
String name = p.name;
if (name != null && name.length() > 0 && CConventions.isValidIdentifier(name)) {
IAddress addr = new Addr32(p.address);
@ -266,8 +266,8 @@ public class CygwinPEBinaryObject extends PEBinaryObject {
* byte[], java.util.List)
*/
@Override
protected void addSymbols(Coff.Symbol[] peSyms, byte[] table, List list) {
for (Symbol peSym : peSyms) {
protected void addSymbols(Coff.Symbol[] peSyms, byte[] table, List<Symbol> list) {
for (Coff.Symbol peSym : peSyms) {
if (peSym.isFunction() || peSym.isPointer() || peSym.isArray()) {
String name = peSym.getName(table);
if (name == null || name.trim().length() == 0 || !Character.isJavaIdentifierStart(name.charAt(0))) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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,12 +26,12 @@ import org.eclipse.core.runtime.IPath;
*/
public class PEBinaryArchive extends BinaryFile implements IBinaryArchive {
ArrayList children;
ArrayList<IBinaryObject> children;
public PEBinaryArchive(PEParser parser, IPath path) throws IOException {
super(parser, path, IBinaryFile.ARCHIVE);
new AR(path.toOSString()).dispose(); // check file type
children = new ArrayList(5);
children = new ArrayList<IBinaryObject>(5);
}
/**
@ -53,14 +53,14 @@ public class PEBinaryArchive extends BinaryFile implements IBinaryArchive {
}
children.trimToSize();
}
return (IBinaryObject[]) children.toArray(new IBinaryObject[0]);
return children.toArray(new IBinaryObject[0]);
}
/**
* @param headers
* @param children2
*/
protected void addArchiveMembers(ARHeader[] headers, ArrayList children2) {
protected void addArchiveMembers(ARHeader[] headers, ArrayList<IBinaryObject> children2) {
for (int i = 0; i < headers.length; i++) {
IBinaryObject bin = new PEBinaryObject(getBinaryParser(), getPath(), headers[i]);
children.add(bin);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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
@ -102,6 +102,7 @@ public class PEBinaryObject extends BinaryObjectAdapter {
return info;
}
@SuppressWarnings("unchecked")
@Override
public Object getAdapter(Class adapter) {
if (adapter.equals(PE.class)) {
@ -163,19 +164,19 @@ public class PEBinaryObject extends BinaryObjectAdapter {
}
protected void loadSymbols(PE pe) throws IOException {
ArrayList list = new ArrayList();
ArrayList<Symbol> list = new ArrayList<Symbol>();
loadSymbols(pe, list);
symbols = (ISymbol[]) list.toArray(NO_SYMBOLS);
symbols = list.toArray(NO_SYMBOLS);
Arrays.sort(symbols);
list.clear();
}
protected void loadSymbols(PE pe, List list) throws IOException {
protected void loadSymbols(PE pe, List<Symbol> list) throws IOException {
Coff.Symbol[] peSyms = pe.getSymbols();
byte[] table = pe.getStringTable();
addSymbols(peSyms, table, list);
}
protected void addSymbols(Coff.Symbol[] peSyms, byte[] table, List list) {
protected void addSymbols(Coff.Symbol[] peSyms, byte[] table, List<Symbol> list) {
for (int i = 0; i < peSyms.length; i++) {
if (peSyms[i].isFunction() || peSyms[i].isPointer() || peSyms[i].isArray()) {
String name = peSyms[i].getName(table);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Nokia and others.
* Copyright (c) 2007, 2008 Nokia 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
@ -18,7 +18,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ISymbolReader;
import org.eclipse.cdt.utils.debug.IDebugEntryRequestor;
import org.eclipse.cdt.utils.elf.Elf;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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,8 +15,6 @@ import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.utils.debug.DebugBaseType;
@ -34,7 +32,6 @@ import org.eclipse.cdt.utils.elf.Elf;
*/
public class DebugDump implements IDebugEntryRequestor {
List list = new ArrayList();
BufferedWriter bwriter;
int bracket;
int paramCount = -1;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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
@ -12,7 +12,7 @@
package org.eclipse.cdt.utils.debug.tools;
public class DebugSym implements Comparable {
public class DebugSym implements Comparable<Object> {
public long addr;
public long size;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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
@ -30,7 +30,7 @@ public class DebugSymsRequestor implements IDebugEntryRequestor {
DebugSym currentCU;
DebugSym currentFunction;
List list = new ArrayList();
List<DebugSym> list = new ArrayList<DebugSym>();
/**
*

View file

@ -394,7 +394,7 @@ public class Elf {
return str.toString();
}
public class Symbol implements Comparable {
public class Symbol implements Comparable<Object> {
/* Symbol bindings */
public final static int STB_LOCAL = 0;
@ -477,7 +477,7 @@ public class Elf {
* Long it is ok, but not if we do Long vs Symbol.
*/
class SymbolComparator implements Comparator {
class SymbolComparator implements Comparator<Object> {
IAddress val1, val2;
public int compare(Object o1, Object o2) {
@ -630,7 +630,7 @@ public class Elf {
if (section.sh_type != Section.SHT_DYNAMIC) {
return new Dynamic[0];
}
ArrayList dynList = new ArrayList();
ArrayList<Dynamic> dynList = new ArrayList<Dynamic>();
efile.seek(section.sh_offset);
int off = 0;
// We must assume the section is a table ignoring the sh_entsize as it
@ -659,7 +659,7 @@ public class Elf {
if (dynEnt.d_tag != Dynamic.DT_NULL)
dynList.add(dynEnt);
}
return (Dynamic[])dynList.toArray(new Dynamic[0]);
return dynList.toArray(new Dynamic[0]);
}
private void commonSetup(String file, long offset) throws IOException {
@ -974,12 +974,12 @@ public class Elf {
public Section[] getSections(int type) throws IOException {
if (sections == null)
getSections();
ArrayList slist = new ArrayList();
ArrayList<Section> slist = new ArrayList<Section>();
for (int i = 0; i < sections.length; i++) {
if (sections[i].sh_type == type)
slist.add(sections[i]);
}
return (Section[])slist.toArray(new Section[0]);
return slist.toArray(new Section[0]);
}
public Section[] getSections() throws IOException {
@ -1050,7 +1050,7 @@ public class Elf {
if (section.sh_entsize != 0) {
numSyms = (int)section.sh_size / (int)section.sh_entsize;
}
ArrayList symList = new ArrayList(numSyms);
ArrayList<Symbol> symList = new ArrayList<Symbol>(numSyms);
long offset = section.sh_offset;
for (int c = 0; c < numSyms; offset += section.sh_entsize, c++) {
efile.seek(offset);
@ -1088,7 +1088,7 @@ public class Elf {
continue;
symList.add(symbol);
}
Symbol[] results = (Symbol[])symList.toArray(new Symbol[0]);
Symbol[] results = symList.toArray(new Symbol[0]);
Arrays.sort(results);
return results;
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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,6 +14,9 @@ import java.io.File;
import java.io.IOException;
import java.util.Vector;
import org.eclipse.cdt.utils.elf.Elf.Dynamic;
import org.eclipse.cdt.utils.elf.Elf.Symbol;
/**
* <code>ElfHelper</code> is a wrapper class for the <code>Elf</code> class
* to provide higher level API for sorting/searching the ELF data.
@ -124,7 +127,7 @@ public class ElfHelper {
}
public Elf.Symbol[] getExternalFunctions() throws IOException {
Vector v = new Vector();
Vector<Symbol> v = new Vector<Symbol>();
loadSymbols();
loadSections();
@ -142,12 +145,12 @@ public class ElfHelper {
}
}
Elf.Symbol[] ret = (Elf.Symbol[])v.toArray(new Elf.Symbol[v.size()]);
Elf.Symbol[] ret = v.toArray(new Elf.Symbol[v.size()]);
return ret;
}
public Elf.Symbol[] getExternalObjects() throws IOException {
Vector v = new Vector();
Vector<Symbol> v = new Vector<Symbol>();
loadSymbols();
loadSections();
@ -165,12 +168,12 @@ public class ElfHelper {
}
}
Elf.Symbol[] ret = (Elf.Symbol[])v.toArray(new Elf.Symbol[v.size()]);
Elf.Symbol[] ret = v.toArray(new Elf.Symbol[v.size()]);
return ret;
}
public Elf.Symbol[] getUndefined() throws IOException {
Vector v = new Vector();
Vector<Symbol> v = new Vector<Symbol>();
loadSymbols();
@ -179,12 +182,12 @@ public class ElfHelper {
v.add(dynsyms[i]);
}
Elf.Symbol[] ret = (Elf.Symbol[])v.toArray(new Elf.Symbol[v.size()]);
Elf.Symbol[] ret = v.toArray(new Elf.Symbol[v.size()]);
return ret;
}
public Elf.Symbol[] getLocalFunctions() throws IOException {
Vector v = new Vector();
Vector<Symbol> v = new Vector<Symbol>();
loadSymbols();
loadSections();
@ -202,12 +205,12 @@ public class ElfHelper {
}
}
Elf.Symbol[] ret = (Elf.Symbol[])v.toArray(new Elf.Symbol[v.size()]);
Elf.Symbol[] ret = v.toArray(new Elf.Symbol[v.size()]);
return ret;
}
public Elf.Symbol[] getLocalObjects() throws IOException {
Vector v = new Vector();
Vector<Symbol> v = new Vector<Symbol>();
loadSymbols();
loadSections();
@ -225,12 +228,12 @@ public class ElfHelper {
}
}
Elf.Symbol[] ret = (Elf.Symbol[])v.toArray(new Elf.Symbol[v.size()]);
Elf.Symbol[] ret = v.toArray(new Elf.Symbol[v.size()]);
return ret;
}
public Elf.Symbol[] getCommonObjects() throws IOException {
Vector v = new Vector();
Vector<Symbol> v = new Vector<Symbol>();
loadSymbols();
loadSections();
@ -244,12 +247,12 @@ public class ElfHelper {
}
}
Elf.Symbol[] ret = (Elf.Symbol[])v.toArray(new Elf.Symbol[v.size()]);
Elf.Symbol[] ret = v.toArray(new Elf.Symbol[v.size()]);
return ret;
}
public Elf.Dynamic[] getNeeded() throws IOException {
Vector v = new Vector();
Vector<Dynamic> v = new Vector<Dynamic>();
loadDynamics();
@ -257,7 +260,7 @@ public class ElfHelper {
if (dynamics[i].d_tag == Elf.Dynamic.DT_NEEDED)
v.add(dynamics[i]);
}
return (Elf.Dynamic[])v.toArray(new Elf.Dynamic[v.size()]);
return v.toArray(new Elf.Dynamic[v.size()]);
}
public String getSoname() throws IOException {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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
@ -16,6 +16,7 @@ import java.util.Comparator;
/**
* @deprecated This class is slated for removal, it is not used by the CDT classes
*/
@SuppressWarnings("unchecked")
@Deprecated
public class SymbolSortCompare implements Comparator {
public int compare( Object o1, Object o2 ) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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,12 +27,12 @@ import org.eclipse.core.runtime.IPath;
*/
public class ElfBinaryArchive extends BinaryFile implements IBinaryArchive {
private ArrayList children;
private ArrayList<IBinaryObject> children;
public ElfBinaryArchive(IBinaryParser parser, IPath p) throws IOException {
super(parser, p, IBinaryFile.ARCHIVE);
new AR(p.toOSString()).dispose(); // check file type
children = new ArrayList(5);
children = new ArrayList<IBinaryObject>(5);
}
/**
@ -55,7 +55,7 @@ public class ElfBinaryArchive extends BinaryFile implements IBinaryArchive {
}
children.trimToSize();
}
return (IBinaryObject[]) children.toArray(new IBinaryObject[0]);
return children.toArray(new IBinaryObject[0]);
}
protected IBinaryObject[] createArchiveMembers(ARHeader[] headers) {
@ -69,6 +69,7 @@ public class ElfBinaryArchive extends BinaryFile implements IBinaryArchive {
/**
* @deprecated use {@link ElfBinaryArchive#createArchiveMembers(ARHeader[])}
*/
@SuppressWarnings("unchecked")
@Deprecated
protected void addArchiveMembers(ARHeader[] headers, ArrayList children) {
IBinaryObject[] bobjs= createArchiveMembers(headers);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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,6 +21,7 @@ import org.eclipse.cdt.utils.Addr2line;
import org.eclipse.cdt.utils.CPPFilt;
import org.eclipse.cdt.utils.IGnuToolFactory;
import org.eclipse.cdt.utils.Objdump;
import org.eclipse.cdt.utils.Symbol;
import org.eclipse.cdt.utils.AR.ARHeader;
import org.eclipse.cdt.utils.elf.Elf;
import org.eclipse.cdt.utils.elf.ElfHelper;
@ -167,7 +168,7 @@ public class GNUElfBinaryObject extends ElfBinaryObject {
* int, java.util.List)
*/
@Override
protected void addSymbols(Elf.Symbol[] array, int type, List list) {
protected void addSymbols(Elf.Symbol[] array, int type, List<Symbol> list) {
for (int i = 0; i < array.length; i++) {
String name = array[i].toString();
if (symbolLoadingCPPFilt != null) {
@ -206,6 +207,7 @@ public class GNUElfBinaryObject extends ElfBinaryObject {
*
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
*/
@SuppressWarnings("unchecked")
@Override
public Object getAdapter(Class adapter) {
if (adapter == Addr2line.class) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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
@ -78,6 +78,7 @@ public class GNUElfParser extends ElfParser {
/* (non-Javadoc)
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
*/
@SuppressWarnings("unchecked")
@Override
public Object getAdapter(Class adapter) {
if (adapter.equals(IGnuToolFactory.class)) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others.
* Copyright (c) 2007, 2008 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
@ -16,7 +16,7 @@ import java.util.Map;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
public class EnvironmentCollector {
private Map fEnfironmentMap = new HashMap();
private Map<String, IEnvironmentVariable> fEnfironmentMap = new HashMap<String, IEnvironmentVariable>();
public IEnvironmentVariable addVariable(IEnvironmentVariable var){
if(var == null)
@ -27,7 +27,7 @@ public class EnvironmentCollector {
name = EnvVarOperationProcessor.normalizeName(name);
if(name != null){
IEnvironmentVariable old = (IEnvironmentVariable)fEnfironmentMap.get(name);
IEnvironmentVariable old = fEnfironmentMap.get(name);
if(old != null){
var = EnvVarOperationProcessor.performOperation(old, var);
}
@ -48,11 +48,11 @@ public class EnvironmentCollector {
public IEnvironmentVariable getVariable(String name){
name = EnvVarOperationProcessor.normalizeName(name);
if(name != null)
return (IEnvironmentVariable)fEnfironmentMap.get(name);
return fEnfironmentMap.get(name);
return null;
}
public IEnvironmentVariable[] getVariables(){
return (IEnvironmentVariable[])fEnfironmentMap.values().toArray(new IEnvironmentVariable[fEnfironmentMap.size()]);
return fEnfironmentMap.values().toArray(new IEnvironmentVariable[fEnfironmentMap.size()]);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2007 Intel Corporation and others.
* Copyright (c) 2005, 2008 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,16 +33,16 @@ public class StorableEnvironment /*implements Cloneable*/{
private static final String ATTRIBUTE_APPEND = "append"; //$NON-NLS-1$
private static final String ATTRIBUTE_APPEND_CONTRIBUTED = "appendContributed"; //$NON-NLS-1$
private static final boolean DEFAULT_APPEND = true;
private HashMap fVariables;
private HashMap<String, IEnvironmentVariable> fVariables;
private boolean fIsDirty = false;
private boolean fIsChanged = false;
private boolean fIsReadOnly;
private boolean fAppend = DEFAULT_APPEND;
private boolean fAppendContributedEnv = DEFAULT_APPEND;
private Map getMap(){
private Map<String, IEnvironmentVariable> getMap(){
if(fVariables == null)
fVariables = new HashMap();
fVariables = new HashMap<String, IEnvironmentVariable>();
return fVariables;
}
@ -56,8 +56,11 @@ public class StorableEnvironment /*implements Cloneable*/{
}
public StorableEnvironment(StorableEnvironment env, boolean isReadOnly) {
if(env.fVariables != null)
fVariables = (HashMap)env.fVariables.clone();
if(env.fVariables != null) {
@SuppressWarnings("unchecked")
final HashMap<String, IEnvironmentVariable> clone = (HashMap<String, IEnvironmentVariable>)env.fVariables.clone();
fVariables = clone;
}
fAppend = env.fAppend;
fAppendContributedEnv = env.fAppendContributedEnv;
fIsReadOnly = isReadOnly;
@ -94,7 +97,7 @@ public class StorableEnvironment /*implements Cloneable*/{
element.setAttribute(ATTRIBUTE_APPEND, Boolean.valueOf(fAppend).toString());
element.setAttribute(ATTRIBUTE_APPEND_CONTRIBUTED, Boolean.valueOf(fAppendContributedEnv).toString());
if(fVariables != null){
Iterator iter = fVariables.values().iterator();
Iterator<IEnvironmentVariable> iter = fVariables.values().iterator();
while(iter.hasNext()){
StorableEnvVar var = (StorableEnvVar)iter.next();
ICStorageElement varEl = element.createChild(StorableEnvVar.VARIABLE_ELEMENT_NAME);
@ -214,7 +217,7 @@ public class StorableEnvironment /*implements Cloneable*/{
if(!provider.isVariableCaseSensitive())
name = name.toUpperCase();
return (IEnvironmentVariable)getMap().get(name);
return getMap().get(name);
}
public void setVariales(IEnvironmentVariable vars[]){
@ -224,9 +227,9 @@ public class StorableEnvironment /*implements Cloneable*/{
deleteAll();
else{
if (getMap().size() != 0) {
Iterator iter = getMap().values().iterator();
Iterator<IEnvironmentVariable> iter = getMap().values().iterator();
while(iter.hasNext()){
IEnvironmentVariable v = (IEnvironmentVariable)iter.next();
IEnvironmentVariable v = iter.next();
int i;
for(i = 0 ; i < vars.length; i++){
if(v.getName().equals(vars[i].getName()))
@ -251,9 +254,9 @@ public class StorableEnvironment /*implements Cloneable*/{
}
public IEnvironmentVariable[] getVariables(){
Collection vars = getMap().values();
Collection<IEnvironmentVariable> vars = getMap().values();
return (IEnvironmentVariable[])vars.toArray(new IEnvironmentVariable[vars.size()]);
return vars.toArray(new IEnvironmentVariable[vars.size()]);
}
public IEnvironmentVariable deleteVariable(String name){
@ -265,7 +268,7 @@ public class StorableEnvironment /*implements Cloneable*/{
if(!provider.isVariableCaseSensitive())
name = name.toUpperCase();
IEnvironmentVariable var = (IEnvironmentVariable)getMap().remove(name);
IEnvironmentVariable var = getMap().remove(name);
if(var != null){
fIsDirty = true;
fIsChanged = true;
@ -277,7 +280,7 @@ public class StorableEnvironment /*implements Cloneable*/{
public boolean deleteAll(){
if(fIsReadOnly)
throw ExceptionFactory.createIsReadOnlyException();
Map map = getMap();
Map<String, IEnvironmentVariable> map = getMap();
if(map.size() > 0){
fIsDirty = true;
fIsChanged = true;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2006 QNX Software Systems and others.
* Copyright (c) 2002, 2008 QNX Software Systems 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
@ -25,12 +25,12 @@ import org.eclipse.core.runtime.IPath;
*/
public class MachOBinaryArchive extends BinaryFile implements IBinaryArchive {
ArrayList children;
ArrayList<IBinaryObject> children;
public MachOBinaryArchive(IBinaryParser parser, IPath p) throws IOException {
super(parser, p, IBinaryFile.ARCHIVE);
new AR(p.toOSString()).dispose(); // check file type
children = new ArrayList(5);
children = new ArrayList<IBinaryObject>(5);
}
/**
@ -55,6 +55,6 @@ public class MachOBinaryArchive extends BinaryFile implements IBinaryArchive {
}
children.trimToSize();
}
return (IBinaryObject[]) children.toArray(new IBinaryObject[0]);
return children.toArray(new IBinaryObject[0]);
}
}

View file

@ -245,7 +245,7 @@ public class AR {
if (memberHeaders != null)
return;
Vector v = new Vector();
Vector<ARHeader> v = new Vector<ARHeader>();
try {
//
// Check for EOF condition
@ -269,7 +269,7 @@ public class AR {
}
} catch (IOException e) {
}
memberHeaders = (ARHeader[]) v.toArray(new ARHeader[v.size()]);
memberHeaders = v.toArray(new ARHeader[v.size()]);
}
public String[] extractFiles(String outdir) throws IOException {
@ -277,7 +277,7 @@ public class AR {
}
private String[] extractFiles(String outdir, String[] names) throws IOException {
Vector names_used = new Vector();
Vector<String> names_used = new Vector<String>();
String object_name;
int count;
@ -301,7 +301,7 @@ public class AR {
rfile.close();
}
return (String[]) names_used.toArray(new String[0]);
return names_used.toArray(new String[0]);
}
private boolean stringInStrings(String str, String[] set) {

View file

@ -474,12 +474,12 @@ public class SOM {
getRandomAccessFile();
rfile.seek(offset);
int numSymbols = getFileHeader().symbol_total;
ArrayList symList = new ArrayList(numSymbols);
ArrayList<Symbol> symList = new ArrayList<Symbol>(numSymbols);
for (int i = 0; i < numSymbols; ++i) {
Symbol v = new Symbol(rfile);
symList.add(v);
}
symbols = (Symbol[]) symList.toArray(new Symbol[symList.size()]);
symbols = symList.toArray(new Symbol[symList.size()]);
}
return symbols;
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others.
* Copyright (c) 2004, 2008 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
@ -27,7 +27,7 @@ import org.eclipse.core.runtime.IPath;
* @author vhirsl
*/
public class SOMBinaryArchive extends BinaryFile implements IBinaryArchive {
private ArrayList children;
private ArrayList<IBinaryObject> children;
/**
* @param parser
@ -37,7 +37,7 @@ public class SOMBinaryArchive extends BinaryFile implements IBinaryArchive {
public SOMBinaryArchive(IBinaryParser parser, IPath path) throws IOException {
super(parser, path, IBinaryFile.ARCHIVE);
new AR(path.toOSString()).dispose(); // check file type
children = new ArrayList(5);
children = new ArrayList<IBinaryObject>(5);
}
/* (non-Javadoc)
@ -62,6 +62,6 @@ public class SOMBinaryArchive extends BinaryFile implements IBinaryArchive {
}
children.trimToSize();
}
return (IBinaryObject[]) children.toArray(new IBinaryObject[0]);
return children.toArray(new IBinaryObject[0]);
}
}

View file

@ -29,6 +29,7 @@ import org.eclipse.cdt.utils.BinaryObjectAdapter;
import org.eclipse.cdt.utils.CPPFilt;
import org.eclipse.cdt.utils.IGnuToolFactory;
import org.eclipse.cdt.utils.Objdump;
import org.eclipse.cdt.utils.Symbol;
import org.eclipse.cdt.utils.som.AR;
import org.eclipse.cdt.utils.som.SOM;
import org.eclipse.cdt.utils.som.AR.ARHeader;
@ -182,18 +183,18 @@ public class SOMBinaryObject extends BinaryObjectAdapter {
}
protected void loadSymbols(SOM som) throws IOException {
ArrayList list = new ArrayList();
ArrayList<Symbol> list = new ArrayList<Symbol>();
SOM.Symbol[] peSyms = som.getSymbols();
byte[] table = som.getStringTable();
addSymbols(peSyms, table, list);
symbols = (ISymbol[])list.toArray(NO_SYMBOLS);
symbols = list.toArray(NO_SYMBOLS);
Arrays.sort(symbols);
list.clear();
}
protected void addSymbols(SOM.Symbol[] peSyms, byte[] table, List list) {
protected void addSymbols(SOM.Symbol[] peSyms, byte[] table, List<Symbol> list) {
CPPFilt cppfilt = getCPPFilt();
Addr2line addr2line = getAddr2line(false);
for (int i = 0; i < peSyms.length; i++) {
@ -313,6 +314,7 @@ public class SOMBinaryObject extends BinaryObjectAdapter {
*
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
@SuppressWarnings("unchecked")
@Override
public Object getAdapter(Class adapter) {
if (adapter == Addr2line.class) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2007 QNX Software Systems and others.
* Copyright (c) 2000, 2008 QNX Software Systems 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,7 +21,7 @@ import java.util.Vector;
public class EnvironmentReader {
private static Properties envVars = null;
private static Vector rawVars = null;
private static Vector<String> rawVars = null;
public static Properties getEnvVars() {
@ -32,7 +32,7 @@ public class EnvironmentReader {
String OS = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$
Process p = null;
envVars = new Properties();
rawVars = new Vector(32);
rawVars = new Vector<String>(32);
String command = "env"; //$NON-NLS-1$
InputStream in = null;
boolean check_ready = false;
@ -123,6 +123,6 @@ public class EnvironmentReader {
public static String[] getRawEnvVars() {
getEnvVars();
return (String[]) rawVars.toArray(new String[0]);
return rawVars.toArray(new String[0]);
}
}

View file

@ -647,13 +647,13 @@ public class XCoff32 {
getRandomAccessFile();
rfile.seek(offset);
int numSymbols = getFileHeader().f_nsyms;
ArrayList symList = new ArrayList(numSymbols);
ArrayList<Symbol> symList = new ArrayList<Symbol>(numSymbols);
for (int i = 0; i < numSymbols; ++i) {
Symbol v = new Symbol(rfile);
symList.add(v);
i += v.n_numaux; // account for auxiliary entries
}
symbols = (Symbol[]) symList.toArray(new Symbol[symList.size()]);
symbols = symList.toArray(new Symbol[symList.size()]);
}
return symbols;
}

View file

@ -173,6 +173,7 @@ public class XCOFF32Parser extends AbstractCExtension implements IBinaryParser {
*
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
@SuppressWarnings("unchecked")
@Override
public Object getAdapter(Class adapter) {
if (adapter.equals(IGnuToolFactory.class)) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others.
* Copyright (c) 2004, 2008 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
@ -27,7 +27,7 @@ import org.eclipse.core.runtime.IPath;
* @author vhirsl
*/
public class XCOFFBinaryArchive extends BinaryFile implements IBinaryArchive {
private ArrayList children;
private ArrayList<IBinaryObject> children;
/**
* @param parser
@ -37,7 +37,7 @@ public class XCOFFBinaryArchive extends BinaryFile implements IBinaryArchive {
public XCOFFBinaryArchive(IBinaryParser parser, IPath path) throws IOException {
super(parser, path, IBinaryFile.ARCHIVE);
new AR(path.toOSString()).dispose(); // check file type
children = new ArrayList(5);
children = new ArrayList<IBinaryObject>(5);
}
@ -63,6 +63,6 @@ public class XCOFFBinaryArchive extends BinaryFile implements IBinaryArchive {
}
children.trimToSize();
}
return (IBinaryObject[]) children.toArray(new IBinaryObject[0]);
return children.toArray(new IBinaryObject[0]);
}
}

View file

@ -107,9 +107,9 @@ public class LRCPPTests extends AST2CPPTests {
}
@Override
public void testBug99262B() throws Exception { // gcc
public void testBug240567() throws Exception { // gcc
try {
super.testBug99262B();
super.testBug240567();
fail();
} catch(AssertionFailedError _) {
}