diff --git a/core/org.eclipse.cdt.core.tests/.cdtproject b/core/org.eclipse.cdt.core.tests/.cdtproject deleted file mode 100644 index 1b2ea839404..00000000000 --- a/core/org.eclipse.cdt.core.tests/.cdtproject +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/core/org.eclipse.cdt.core.tests/.cproject b/core/org.eclipse.cdt.core.tests/.cproject deleted file mode 100644 index 43105daf504..00000000000 --- a/core/org.eclipse.cdt.core.tests/.cproject +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/ASTRewrite.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/ASTRewrite.java index 047250ec6b5..0bc21187b61 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/ASTRewrite.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/ASTRewrite.java @@ -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; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/OperatorTokenDuple.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/OperatorTokenDuple.java index 8cc99768a66..2a8cc67037a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/OperatorTokenDuple.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/OperatorTokenDuple.java @@ -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[] getTemplateIdArgLists() { return token.getTemplateIdArgLists(); } @@ -96,7 +97,7 @@ public class OperatorTokenDuple implements ITokenDuple { return token.getSegmentCount(); } - public Iterator iterator() { + public Iterator iterator() { return token.iterator(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/TemplateTokenDuple.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/TemplateTokenDuple.java index 0b16a583eb6..a08349d7081 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/TemplateTokenDuple.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/TemplateTokenDuple.java @@ -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[] argLists; /** * @param first * @param last * @param templateArgLists */ - public TemplateTokenDuple(IToken first, IToken last, List templateArgLists) { + public TemplateTokenDuple(IToken first, IToken last, List> templateArgLists) { super(first, last); - argLists = (List[]) templateArgLists.toArray( new List [templateArgLists.size()] ); + argLists = toArray(templateArgLists); numSegments = calculateSegmentCount(); } - - - + + @SuppressWarnings("unchecked") + private List[] toArray(List> templateArgLists) { + return templateArgLists.toArray( new List[templateArgLists.size()] ); + } + @SuppressWarnings("unchecked") + private List[] 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[] args = getTemplateIdArgLists(); if( args != null && args[ args.length - 1 ] != null ){ - List newArgs = new ArrayList( 1 ); + List> newArgs = new ArrayList>( 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[] a1 = first.getTemplateIdArgLists(); + List[] 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[] getTemplateIdArgLists() { return argLists; } @Override public ITokenDuple[] getSegments() { - List r = new ArrayList(); + List r = new ArrayList(); 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> newArgs = null; if( argLists[count] != null ) { - newArgs = new ArrayList( 1 ); + newArgs = new ArrayList>(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> newArgs = null; //pointer to members could have a A::B:: if( count < argLists.length && argLists[count] != null ) { - newArgs = new ArrayList( 1 ); - newArgs.add( argLists[count]); + newArgs = new ArrayList>(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() ]); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/TokenFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/TokenFactory.java index d15a12ae092..339fa83e81f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/TokenFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/TokenFactory.java @@ -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[] getTemplateIdArgLists() { return null; } public IToken getToken(int index) { if( index == 0 ) return fToken; return null; } - public Iterator iterator() { - return new Iterator() { + public Iterator iterator() { + return new Iterator() { 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> 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[] f1 = firstDuple.getTemplateIdArgLists(); + List[] f2 = secondDuple.getTemplateIdArgLists(); if( f1 == null && f2 == null ) return new BasicTokenDuple( firstDuple, secondDuple ); return new TemplateTokenDuple( firstDuple, secondDuple ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/Checksums.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/Checksums.java index 0b83514a68a..2ffc1d1b915 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/Checksums.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/Checksums.java @@ -42,7 +42,7 @@ public class Checksums { * @throws NoSuchAlgorithmException * @since 4.0 */ - public static MessageDigest getAlgorithm(Map 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 null. * @since 4.0 */ - public static byte[] getChecksum(Map 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[]) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/TeamPDOMExportOperation.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/TeamPDOMExportOperation.java index 79a6a692e9a..a22a1cfc0f9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/TeamPDOMExportOperation.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/TeamPDOMExportOperation.java @@ -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 fullPaths= new HashSet(); 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 iterator = fullPaths.iterator(); iterator.hasNext();) { + String fullPath= iterator.next(); files[i++]= root.getFile(new Path(fullPath)); } - Map map= Checksums.createChecksumMap(files, fMessageDigest, monitor); + Map 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)); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/TeamPDOMImportOperation.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/TeamPDOMImportOperation.java index 3817774c0bc..5c6ee24e84f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/TeamPDOMImportOperation.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/TeamPDOMImportOperation.java @@ -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 filesToCheck= new ArrayList(); 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 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 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 filesToCheck, IProgressMonitor monitor) throws NoSuchAlgorithmException { MessageDigest md= Checksums.getAlgorithm(checksums); - for (Iterator i = filesToCheck.iterator(); i.hasNext();) { + for (Iterator 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(); diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java index 5a6ce424059..eb407faa26d 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java @@ -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; diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptorManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptorManager.java index 5646a6b2637..f629f84c94b 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptorManager.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptorManager.java @@ -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 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 fListeners = Collections.synchronizedList(new Vector()); // private ThreadLocal fApplyingDescriptorMap = new ThreadLocal(); - private ThreadLocal fThreadInfo = new ThreadLocal(); + private ThreadLocal fThreadInfo = new ThreadLocal(); private class ThreadInfo { - Map fApplyingDescriptorMap; - Map fOperatingDescriptorMap; + Map fApplyingDescriptorMap; + Map fOperatingDescriptorMap; - public Map getApplyingDescriptorMap(boolean create){ + public Map getApplyingDescriptorMap(boolean create){ if(fApplyingDescriptorMap == null && create){ - fApplyingDescriptorMap = new HashMap(1); + fApplyingDescriptorMap = new HashMap(1); } return fApplyingDescriptorMap; } - public Map getOperatingDescriptorMap(boolean create){ + public Map getOperatingDescriptorMap(boolean create){ if(fOperatingDescriptorMap == null && create){ - fOperatingDescriptorMap = new HashMap(1); + fOperatingDescriptorMap = new HashMap(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(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 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> iter = map.entrySet().iterator(); iter.hasNext();){ + Map.Entry 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 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 map = getApplyingDescriptorMap(true); map.put(project, dr); } } private CConfigBasedDescriptor clearApplyingDescriptor(IProject project){ - Map map = getApplyingDescriptorMap(false); + Map map = getApplyingDescriptorMap(false); if(map != null){ - return (CConfigBasedDescriptor)map.remove(project); + return map.remove(project); } return null; } - private Map getApplyingDescriptorMap(boolean create){ + private Map 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 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 map = getOperatingDescriptorMap(true); map.put(project, dr); } } private CConfigBasedDescriptor clearOperatingDescriptor(IProject project){ - Map map = getOperatingDescriptorMap(false); + Map map = getOperatingDescriptorMap(false); if(map != null){ - return (CConfigBasedDescriptor)map.remove(project); + return map.remove(project); } return null; } - private Map getOperatingDescriptorMap(boolean create){ + private Map 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); diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePreferenceInitializer.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePreferenceInitializer.java index e38a76d3cfa..ef453b64d09 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePreferenceInitializer.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePreferenceInitializer.java @@ -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 optionNames = CModelManager.OptionNames; // Formatter settings - Map defaultOptionsMap = DefaultCodeFormatterConstants.getDefaultSettings(); // code formatter defaults + Map 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 entry : defaultOptionsMap.entrySet()) { + String optionName = entry.getKey(); + defaultPreferences.put(optionName, entry.getValue()); optionNames.add(optionName); } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionInfo.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionInfo.java index 036422c8d54..ac4fbe33324 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionInfo.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionInfo.java @@ -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 attribMap = new HashMap(4); public CExtensionInfo(){ @@ -24,7 +24,7 @@ public class CExtensionInfo { attribMap.putAll(base.attribMap); } - public HashMap getAttributes() { + public HashMap getAttributes() { return attribMap; } @@ -37,7 +37,7 @@ public class CExtensionInfo { } public String getAttribute(String key) { - return (String) attribMap.get(key); + return attribMap.get(key); } } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CdtVarPathEntryVariableManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CdtVarPathEntryVariableManager.java index ce00c306497..6f30438be9e 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CdtVarPathEntryVariableManager.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CdtVarPathEntryVariableManager.java @@ -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 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 list = new ArrayList(); 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()); 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 list = new ArrayList(); 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) { diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerChain.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerChain.java index 193384e3bcd..654fcff0d43 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerChain.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerChain.java @@ -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 fTrackers= new LinkedList(); 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 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 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, null 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 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; diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerManager.java index 7adf0b156dd..18bb0745ab2 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerManager.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PositionTrackerManager.java @@ -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 fPositionTrackerMap; private PositionTrackerManager() { - fPositionTrackerMap= new HashMap(); + fPositionTrackerMap= new HashMap(); } 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> map= new TreeMap>(); + for (Iterator 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 list= map.remove(key); + for (Iterator 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> map, PositionTrackerChain chain) { long or= chain.getOldestRetirement(); if (or != Long.MAX_VALUE) { Long lor= new Long(or); - List list= (List) map.get(lor); + List list= map.get(lor); if (list == null) { - list= new LinkedList(); + list= new LinkedList(); 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); } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CoreVariableSubstitutor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CoreVariableSubstitutor.java index 8b8f2af48ef..bc647889e14 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CoreVariableSubstitutor.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CoreVariableSubstitutor.java @@ -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 diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EnvironmentVariableSupplier.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EnvironmentVariableSupplier.java index 63d79781bb6..c01ce8ae877 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EnvironmentVariableSupplier.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EnvironmentVariableSupplier.java @@ -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 list = EnvVarOperationProcessor.convertToList(value,delimiter); + fStringListValue = list.toArray(new String[list.size()]); } else { fStringListValue = null; } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/StorableCdtVariable.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/StorableCdtVariable.java index 75bd0f30694..98bdc841ed6 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/StorableCdtVariable.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/StorableCdtVariable.java @@ -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 values = new ArrayList(); 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()]); } } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EclipseEnvironmentSupplier.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EclipseEnvironmentSupplier.java index bc048e86521..357aa83e05c 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EclipseEnvironmentSupplier.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EclipseEnvironmentSupplier.java @@ -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); diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvVarCollector.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvVarCollector.java index c265e3f8877..9538ddbcdff 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvVarCollector.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvVarCollector.java @@ -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 fMap = null; public EnvVarCollector(){ } @@ -57,11 +57,11 @@ public class EnvVarCollector { if(fMap == null){ noCheck = true; - fMap = new HashMap(); + fMap = new HashMap(); } 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 values = fMap.values(); + List list = new ArrayList(); + Iterator 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); } /** diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/NM.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/NM.java index cc4a4ba5336..210959bec73 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/NM.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/NM.java @@ -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 undef_symbols; + private List text_symbols; + private List bss_symbols; + private List 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(); + text_symbols = new ArrayList(); + data_symbols = new ArrayList(); + bss_symbols = new ArrayList(); 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]); } } diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Objdump.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Objdump.java index 10a0698303d..df22d447fd5 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Objdump.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Objdump.java @@ -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 list = new ArrayList(); StringTokenizer st = new StringTokenizer(param); while (st.hasMoreTokens()) { list.add(st.nextToken()); diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/cdtvariables/SupplierBasedCdtVariableManager.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/cdtvariables/SupplierBasedCdtVariableManager.java index eb0bacc8357..3d099c50fb5 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/cdtvariables/SupplierBasedCdtVariableManager.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/cdtvariables/SupplierBasedCdtVariableManager.java @@ -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 map = new HashMap(); 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 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 list = new ArrayList(); 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()]); } /* diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/CodeViewReader.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/CodeViewReader.java index e495ae647f6..9c2ce9aad84 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/CodeViewReader.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/CodeViewReader.java @@ -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 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(); } 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); } } diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/Coff.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/Coff.java index 3c5df5fdf77..18e0e5dcb5a 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/Coff.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/Coff.java @@ -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 aList = new ArrayList(); 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 { diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/CygwinPEBinaryArchive.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/CygwinPEBinaryArchive.java index ff8785bd3b7..e2f06c1698d 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/CygwinPEBinaryArchive.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/CygwinPEBinaryArchive.java @@ -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 children2) { for (int i = 0; i < headers.length; i++) { IBinaryObject bin = new CygwinPEBinaryObject(getBinaryParser(), getPath(), headers[i]); children.add(bin); diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/CygwinPEBinaryObject.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/CygwinPEBinaryObject.java index 224b357678c..0b11e3c7a3f 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/CygwinPEBinaryObject.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/CygwinPEBinaryObject.java @@ -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 list = new ArrayList(); 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 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 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))) { diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/PEBinaryArchive.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/PEBinaryArchive.java index 5ce4eaae913..45ba995912e 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/PEBinaryArchive.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/PEBinaryArchive.java @@ -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 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(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 children2) { for (int i = 0; i < headers.length; i++) { IBinaryObject bin = new PEBinaryObject(getBinaryParser(), getPath(), headers[i]); children.add(bin); diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/PEBinaryObject.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/PEBinaryObject.java index 2f74c510dff..e6ab8743406 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/PEBinaryObject.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/PEBinaryObject.java @@ -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 list = new ArrayList(); 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 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 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); diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/DwarfReader.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/DwarfReader.java index ad4bcc5a7ae..b366855eaf4 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/DwarfReader.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/DwarfReader.java @@ -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; diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/tools/DebugDump.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/tools/DebugDump.java index 7f462f562ee..7eea4df5c6a 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/tools/DebugDump.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/tools/DebugDump.java @@ -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; diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/tools/DebugSym.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/tools/DebugSym.java index 27b32f377c6..71055866ed4 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/tools/DebugSym.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/tools/DebugSym.java @@ -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 { public long addr; public long size; diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/tools/DebugSymsRequestor.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/tools/DebugSymsRequestor.java index 2109bb1f932..d04e7fd11f9 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/tools/DebugSymsRequestor.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/tools/DebugSymsRequestor.java @@ -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 list = new ArrayList(); /** * diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/Elf.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/Elf.java index 470a5a4961b..6814cdea6b4 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/Elf.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/Elf.java @@ -394,7 +394,7 @@ public class Elf { return str.toString(); } - public class Symbol implements Comparable { + public class Symbol implements Comparable { /* 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 { 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 dynList = new ArrayList(); 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
slist = new ArrayList
(); 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 symList = new ArrayList(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; } diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/ElfHelper.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/ElfHelper.java index ff1d537cdfa..2f8ab90851d 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/ElfHelper.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/ElfHelper.java @@ -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; + /** * ElfHelper is a wrapper class for the Elf 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 v = new Vector(); 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 v = new Vector(); 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 v = new Vector(); 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 v = new Vector(); 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 v = new Vector(); 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 v = new Vector(); 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 v = new Vector(); 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 { diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/SymbolSortCompare.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/SymbolSortCompare.java index 673eba8198b..34caea8ffb0 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/SymbolSortCompare.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/SymbolSortCompare.java @@ -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 ) { diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/ElfBinaryArchive.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/ElfBinaryArchive.java index 4cc864eef00..b48c8e924c0 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/ElfBinaryArchive.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/ElfBinaryArchive.java @@ -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 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(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); diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/GNUElfBinaryObject.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/GNUElfBinaryObject.java index 53f9a3cc94e..1de2c68c279 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/GNUElfBinaryObject.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/GNUElfBinaryObject.java @@ -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 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) { diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/GNUElfParser.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/GNUElfParser.java index 280c295a021..9015e08571b 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/GNUElfParser.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/GNUElfParser.java @@ -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)) { diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/EnvironmentCollector.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/EnvironmentCollector.java index a59849803f8..ee2a6e07676 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/EnvironmentCollector.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/EnvironmentCollector.java @@ -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 fEnfironmentMap = new HashMap(); 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()]); } } diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/StorableEnvironment.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/StorableEnvironment.java index 055ef95df9e..c341e7c53c6 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/StorableEnvironment.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/StorableEnvironment.java @@ -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 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 getMap(){ if(fVariables == null) - fVariables = new HashMap(); + fVariables = new HashMap(); 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 clone = (HashMap)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 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 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 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 map = getMap(); if(map.size() > 0){ fIsDirty = true; fIsChanged = true; diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/macho/parser/MachOBinaryArchive.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/macho/parser/MachOBinaryArchive.java index e1b22db5828..51f08a7b0ae 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/macho/parser/MachOBinaryArchive.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/macho/parser/MachOBinaryArchive.java @@ -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 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(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]); } } diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/AR.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/AR.java index 6583b5f3073..3ead24f8e8a 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/AR.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/AR.java @@ -245,7 +245,7 @@ public class AR { if (memberHeaders != null) return; - Vector v = new Vector(); + Vector v = new Vector(); 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 names_used = new Vector(); 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) { diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/SOM.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/SOM.java index a13282b8c07..b6bfe1ea8e3 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/SOM.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/SOM.java @@ -474,12 +474,12 @@ public class SOM { getRandomAccessFile(); rfile.seek(offset); int numSymbols = getFileHeader().symbol_total; - ArrayList symList = new ArrayList(numSymbols); + ArrayList symList = new ArrayList(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; } diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/parser/SOMBinaryArchive.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/parser/SOMBinaryArchive.java index e5acf0161d7..e122d1b8185 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/parser/SOMBinaryArchive.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/parser/SOMBinaryArchive.java @@ -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 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(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]); } } diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/parser/SOMBinaryObject.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/parser/SOMBinaryObject.java index 1c56ac4d311..8ee91fd1810 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/parser/SOMBinaryObject.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/som/parser/SOMBinaryObject.java @@ -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 list = new ArrayList(); 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 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) { diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/spawner/EnvironmentReader.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/spawner/EnvironmentReader.java index 6e4718ae418..c231207c01a 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/spawner/EnvironmentReader.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/spawner/EnvironmentReader.java @@ -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 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(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]); } } diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/xcoff/XCoff32.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/xcoff/XCoff32.java index 2bc9074cc9a..75ff224421a 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/xcoff/XCoff32.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/xcoff/XCoff32.java @@ -647,13 +647,13 @@ public class XCoff32 { getRandomAccessFile(); rfile.seek(offset); int numSymbols = getFileHeader().f_nsyms; - ArrayList symList = new ArrayList(numSymbols); + ArrayList symList = new ArrayList(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; } diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/xcoff/parser/XCOFF32Parser.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/xcoff/parser/XCOFF32Parser.java index e53f415aee4..be13a0f9688 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/xcoff/parser/XCOFF32Parser.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/xcoff/parser/XCOFF32Parser.java @@ -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)) { diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/xcoff/parser/XCOFFBinaryArchive.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/xcoff/parser/XCOFFBinaryArchive.java index 13ae8b69dda..8d3fe7ade1f 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/xcoff/parser/XCOFFBinaryArchive.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/xcoff/parser/XCOFFBinaryArchive.java @@ -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 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(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]); } } diff --git a/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/LRCPPTests.java b/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/LRCPPTests.java index 450a0737f7b..ed439fbd562 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/LRCPPTests.java +++ b/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/LRCPPTests.java @@ -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 _) { }