diff --git a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF index e7c50208488..2174c160a99 100644 --- a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF +++ b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF @@ -41,7 +41,6 @@ Export-Package: org.eclipse.cdt.core, org.eclipse.cdt.core.templateengine.process.processes, org.eclipse.cdt.internal.core;x-friends:="org.eclipse.cdt.ui,org.eclipse.cdt.debug.core", org.eclipse.cdt.internal.core.browser;x-friends:="org.eclipse.cdt.ui", - org.eclipse.cdt.internal.core.browser.util;x-friends:="org.eclipse.cdt.ui", org.eclipse.cdt.internal.core.cdtvariables;x-internal:=true, org.eclipse.cdt.internal.core.dom;x-friends:="org.eclipse.cdt.ui", org.eclipse.cdt.internal.core.dom.parser;x-friends:="org.eclipse.cdt.ui", diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/AllTypesCache.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/AllTypesCache.java index d8adbd220f1..6222f1922f6 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/AllTypesCache.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/AllTypesCache.java @@ -22,7 +22,7 @@ import org.eclipse.cdt.core.index.IndexFilter; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.internal.core.browser.util.IndexModelUtil; +import org.eclipse.cdt.internal.core.browser.IndexModelUtil; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IQualifiedTypeName.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IQualifiedTypeName.java index acd29c35cc1..87bb7bf6a5c 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IQualifiedTypeName.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IQualifiedTypeName.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.cdt.core.browser; -public interface IQualifiedTypeName extends Comparable { +public interface IQualifiedTypeName extends Comparable { public final static String QUALIFIER = "::"; //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfo.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfo.java index 314eb758983..9ef714ed04f 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfo.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfo.java @@ -17,7 +17,7 @@ import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; /** * Type information. */ -public interface ITypeInfo extends Comparable { +public interface ITypeInfo { public static final int KNOWN_TYPES[] = { ICElement.C_NAMESPACE, diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeSearchScope.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeSearchScope.java index d9db2936468..340ec167480 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeSearchScope.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeSearchScope.java @@ -40,8 +40,8 @@ public interface ITypeSearchScope { public void clear(); public ICProject[] getEnclosingProjects(); - public Collection pathSet(); - public Collection containerSet(); - public Collection projectSet(); - public Collection enclosingProjectSet(); + public Collection pathSet(); + public Collection containerSet(); + public Collection projectSet(); + public Collection enclosingProjectSet(); } diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IndexTypeInfo.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IndexTypeInfo.java index f10a8e02dda..2f05d66540a 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IndexTypeInfo.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IndexTypeInfo.java @@ -36,8 +36,8 @@ import org.eclipse.cdt.core.index.IndexFilter; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; +import org.eclipse.cdt.internal.core.browser.IndexModelUtil; import org.eclipse.cdt.internal.core.browser.IndexTypeReference; -import org.eclipse.cdt.internal.core.browser.util.IndexModelUtil; import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError; import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.resources.IFile; @@ -59,8 +59,8 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo { if (array == null) return 0; int result = 1; - for (int index = 0; index < array.length; index++) { - result = prime * result + (array[index] == null ? 0 : array[index].hashCode()); + for (String element : array) { + result = prime * result + (element == null ? 0 : element.hashCode()); } return result; } @@ -248,8 +248,8 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo { if (names.length == 0) { names= index.findNames(ibs[0], IIndex.FIND_DECLARATIONS); } - for (int i = 0; i < names.length; i++) { - reference= createReference(ibs[0], names[i]); + for (IIndexName name : names) { + reference= createReference(ibs[0], name); if (reference != null) { break; } @@ -312,8 +312,8 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo { IIndexMacro[] macros = index.findMacros(fqn[0].toCharArray(), IndexFilter.ALL_DECLARED, new NullProgressMonitor()); if(macros.length>0) { - for (int i = 0; i < macros.length; i++) { - reference= createReference(macros[i]); + for (IIndexMacro macro : macros) { + reference= createReference(macro); if (reference != null) { break; } @@ -368,15 +368,13 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo { index.acquireReadLock(); IIndexBinding[] ibs= findBindings(); HashMap iflMap= new HashMap(); - for (int i = 0; i < ibs.length; i++) { - IIndexBinding binding = ibs[i]; + for (IIndexBinding binding : ibs) { IIndexName[] names; names= index.findNames(binding, IIndex.FIND_DEFINITIONS); if (names.length == 0) { names= index.findNames(binding, IIndex.FIND_DECLARATIONS); } - for (int j= 0; j < names.length; j++) { - IIndexName indexName = names[j]; + for (IIndexName indexName : names) { if (checkFile(iflMap, indexName.getFile())) { IndexTypeReference ref= createReference(binding, indexName); if (ref != null) { @@ -406,8 +404,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo { // in case a file is represented multiple times in the index then we take references from // one of those, only. HashMap iflMap= new HashMap(); - for (int i = 0; i < ibs.length; i++) { - IIndexMacro macro= ibs[i]; + for (IIndexMacro macro : ibs) { if (checkParameters(macro.getParameterList())) { if (checkFile(iflMap, macro.getFile())) { IndexTypeReference ref= createReference(macro); @@ -515,10 +512,6 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo { throw new PDOMNotImplementedError(); } - public int compareTo(Object arg0) { - throw new PDOMNotImplementedError(); - } - /* * @see org.eclipse.cdt.internal.core.browser.IFunctionInfo#getParameters() */ diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/QualifiedTypeName.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/QualifiedTypeName.java index b4e42044e18..aeec20793dc 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/QualifiedTypeName.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/QualifiedTypeName.java @@ -299,16 +299,6 @@ public class QualifiedTypeName implements IQualifiedTypeName { return getFullyQualifiedName(); } - public int compareTo(Object obj) { - if (obj == this) { - return 0; - } - if (!(obj instanceof IQualifiedTypeName)) { - throw new ClassCastException(); - } - return compareTo((IQualifiedTypeName)obj); - } - public int compareTo(IQualifiedTypeName typeName) { if (typeName == this) return 0; diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeInfo.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeInfo.java index c308dcc7ba9..d0c89f9f05c 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeInfo.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeInfo.java @@ -13,7 +13,6 @@ package org.eclipse.cdt.core.browser; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; -import org.eclipse.cdt.internal.core.browser.util.ArrayUtil; public class TypeInfo implements ITypeInfo { @@ -260,7 +259,11 @@ public class TypeInfo implements ITypeInfo } public static boolean isValidType(int type) { - return ArrayUtil.contains(KNOWN_TYPES, type); + for (int i= 0; i < KNOWN_TYPES.length; ++i) { + if (KNOWN_TYPES[i] == type) + return true; + } + return false; } public void addDerivedReference(ITypeReference location) { diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeSearchScope.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeSearchScope.java index a74ef37cdbc..c6373418e7b 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeSearchScope.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeSearchScope.java @@ -28,10 +28,10 @@ import org.eclipse.core.runtime.Path; public class TypeSearchScope implements ITypeSearchScope { - private Set fPathSet = new HashSet(); - private Set fContainerSet = new HashSet(); - private Set fProjectSet = new HashSet(); - private Set fEnclosingProjectSet = new HashSet(); + private Set fPathSet = new HashSet(); + private Set fContainerSet = new HashSet(); + private Set fProjectSet = new HashSet(); + private Set fEnclosingProjectSet = new HashSet(); private boolean fWorkspaceScope = false; // cached arrays @@ -54,16 +54,16 @@ public class TypeSearchScope implements ITypeSearchScope { add(project); } - public Collection pathSet() { + public Collection pathSet() { return fPathSet; } - public Collection containerSet() { + public Collection containerSet() { return fContainerSet; } - public Collection projectSet() { + public Collection projectSet() { return fProjectSet; } - public Collection enclosingProjectSet() { + public Collection enclosingProjectSet() { return fEnclosingProjectSet; } @@ -73,8 +73,8 @@ public class TypeSearchScope implements ITypeSearchScope { if (!scope.pathSet().isEmpty()) { // check if this scope encloses the other scope's paths - for (Iterator i = scope.pathSet().iterator(); i.hasNext(); ) { - IPath path = (IPath) i.next(); + for (Iterator i = scope.pathSet().iterator(); i.hasNext(); ) { + IPath path = i.next(); if (!encloses(path)) return false; } @@ -82,8 +82,8 @@ public class TypeSearchScope implements ITypeSearchScope { if (!scope.containerSet().isEmpty()) { // check if this scope encloses the other scope's containers - for (Iterator i = scope.containerSet().iterator(); i.hasNext(); ) { - IPath path = (IPath) i.next(); + for (Iterator i = scope.containerSet().iterator(); i.hasNext(); ) { + IPath path = i.next(); if (!encloses(path)) return false; } @@ -91,8 +91,8 @@ public class TypeSearchScope implements ITypeSearchScope { if (!scope.projectSet().isEmpty()) { // check if this scope encloses the other scope's projects - for (Iterator i = scope.projectSet().iterator(); i.hasNext(); ) { - ICProject project = (ICProject) i.next(); + for (Iterator i = scope.projectSet().iterator(); i.hasNext(); ) { + ICProject project = i.next(); if (!encloses(project)) return false; } @@ -125,7 +125,7 @@ public class TypeSearchScope implements ITypeSearchScope { if (fContainerSet.contains(path)) return true; if (fContainerPaths == null) { - fContainerPaths = (IPath[]) fContainerSet.toArray(new IPath[fContainerSet.size()]); + fContainerPaths = fContainerSet.toArray(new IPath[fContainerSet.size()]); // java.util.Arrays.sort(fContainerPaths); } for (int i = 0; i < fContainerPaths.length; ++i) { @@ -140,7 +140,7 @@ public class TypeSearchScope implements ITypeSearchScope { // check projects that were explicity added to scope if (fProjects == null) { - fProjects = (ICProject[]) fProjectSet.toArray(new ICProject[fProjectSet.size()]); + fProjects = fProjectSet.toArray(new ICProject[fProjectSet.size()]); } // check if one of the projects contains path for (int i = 0; i < fProjects.length; ++i) { @@ -168,7 +168,7 @@ public class TypeSearchScope implements ITypeSearchScope { if (isWorkspaceScope()) { return getAllProjects(); } - return (ICProject[]) fEnclosingProjectSet.toArray(new ICProject[fEnclosingProjectSet.size()]); + return fEnclosingProjectSet.toArray(new ICProject[fEnclosingProjectSet.size()]); } private static boolean projectContainsPath(ICProject project, IPath path, boolean checkIncludePaths) { diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeUtil.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeUtil.java index a1286b946bc..4e2b4fa996c 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeUtil.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeUtil.java @@ -134,16 +134,16 @@ public class TypeUtil { ICElement[] types = getTypes(tu); ArrayList allTypes = new ArrayList(types.length); ArrayList typesToTraverse = new ArrayList(types.length); - for (int i = 0; i < types.length; i++) { - typesToTraverse.add(types[i]); + for (ICElement type : types) { + typesToTraverse.add(type); } while (!typesToTraverse.isEmpty()) { ICElement type = typesToTraverse.get(0); typesToTraverse.remove(type); allTypes.add(type); types = getTypes(type); - for (int i = 0; i < types.length; i++) { - typesToTraverse.add(types[i]); + for (ICElement type2 : types) { + typesToTraverse.add(type2); } } return allTypes.toArray(new ICElement[allTypes.size()]); @@ -195,9 +195,9 @@ public class TypeUtil { public static IMethodDeclaration[] getMethods(ICElement elem) { if (elem instanceof IStructure) { try { - List list = ((IParent)elem).getChildrenOfType(ICElement.C_METHOD_DECLARATION); + List list = ((IParent)elem).getChildrenOfType(ICElement.C_METHOD_DECLARATION); if (list != null && !list.isEmpty()) { - return (IMethodDeclaration[]) list.toArray(new IMethodDeclaration[list.size()]); + return list.toArray(new IMethodDeclaration[list.size()]); } } catch (CModelException e) { } @@ -208,9 +208,9 @@ public class TypeUtil { public static ICElement[] getFields(ICElement elem) { if (elem instanceof IStructure) { try { - List list = ((IParent)elem).getChildrenOfType(ICElement.C_FIELD); + List list = ((IParent)elem).getChildrenOfType(ICElement.C_FIELD); if (list != null && !list.isEmpty()) { - return (ICElement[]) list.toArray(new ICElement[list.size()]); + return list.toArray(new ICElement[list.size()]); } } catch (CModelException e) { } diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/ASTTypeInfo.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/ASTTypeInfo.java index ae3133e1829..d7a5bd8b9ab 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/ASTTypeInfo.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/ASTTypeInfo.java @@ -31,7 +31,6 @@ import org.eclipse.cdt.core.index.IIndexFileLocation; import org.eclipse.cdt.core.index.IndexLocationFactory; import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; -import org.eclipse.cdt.internal.core.browser.util.IndexModelUtil; import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError; import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.resources.IFile; @@ -268,10 +267,6 @@ public class ASTTypeInfo implements ITypeInfo, IFunctionInfo { throw new PDOMNotImplementedError(); } - public int compareTo(Object arg0) { - throw new PDOMNotImplementedError(); - } - /* * @see org.eclipse.cdt.internal.core.browser.IFunctionInfo#getParameters() */ diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/util/IndexModelUtil.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/IndexModelUtil.java similarity index 99% rename from core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/util/IndexModelUtil.java rename to core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/IndexModelUtil.java index 74e8b8f9583..f321dd577e0 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/util/IndexModelUtil.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/IndexModelUtil.java @@ -12,7 +12,7 @@ * Anton Leherbauer (Wind River Systems) * Markus Schorn (Wind River Systems) *******************************************************************************/ -package org.eclipse.cdt.internal.core.browser.util; +package org.eclipse.cdt.internal.core.browser; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/util/ArrayUtil.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/util/ArrayUtil.java deleted file mode 100644 index 861631f653c..00000000000 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/util/ArrayUtil.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.core.browser.util; - -/** - * A helper class which allows you to perform some - * simple set operations on int arrays. - */ -public class ArrayUtil { - private ArrayUtil() { - } - - // returns true if set contains elem - public static boolean contains(int[] set, int elem) { - if (set == null) - return false; - for (int i= 0; i < set.length; ++i) { - if (set[i] == elem) - return true; - } - return false; - } - - // returns true if set contains all of subset - public static boolean containsAll(int[] set, int[] subset) { - if (set == null || subset == null) - return false; - for (int i= 0; i < subset.length; ++i) { - if (!contains(set, subset[i])) - return false; - } - return true; - } - - // return a copy of fromSet - public static int[] clone(int[] fromSet) { - if (fromSet == null) - return null; - int[] newSet= new int[fromSet.length]; - for (int i= 0; i < fromSet.length; ++i) { - newSet[i]= fromSet[i]; - } - return newSet; - } -} diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/util/DelegatedProgressMonitor.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/util/DelegatedProgressMonitor.java deleted file mode 100644 index 4879f76c64c..00000000000 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/util/DelegatedProgressMonitor.java +++ /dev/null @@ -1,249 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.core.browser.util; - -import java.util.ArrayList; -import java.util.Iterator; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IProgressMonitorWithBlocking; -import org.eclipse.core.runtime.IStatus; - -/** - * A wrapper around one or more progress monitors. Forwards - * IProgressMonitor and IProgressMonitorWithBlocking - * methods to the delegate monitors. - */ -public class DelegatedProgressMonitor implements IProgressMonitor, IProgressMonitorWithBlocking { - - private static int INITIAL_DELEGATE_COUNT = 2; - private final ArrayList fDelegateList = new ArrayList(INITIAL_DELEGATE_COUNT); - String fTaskName; - String fSubTask; - int fTotalWork; - private double fWorked; - private boolean fIsBlocked; - boolean fIsCanceled; - - /** - * Creates a new delegated monitor. - */ - public DelegatedProgressMonitor() { - init(); - } - - /** - * Creates a new delegated monitor, and adds a delegate. - */ - public DelegatedProgressMonitor(IProgressMonitor delegate) { - init(); - addDelegate(delegate); - } - - /** - * Resets delegated monitor to initial state. - */ - public synchronized void init() { - fTaskName= null; - fSubTask= null; - fTotalWork= IProgressMonitor.UNKNOWN; - fWorked= 0.0f; - fIsBlocked= false; - fIsCanceled= false; - } - - /* - * @see IProgressMonitor#beginTask - */ - public synchronized void beginTask(String name, int totalWork) { - fTaskName = name; - fTotalWork = totalWork; - visitDelegates(new IDelegateVisitor() { - public void visit(IProgressMonitor delegate) { - delegate.beginTask(fTaskName, fTotalWork); - } - }); - } - - /* - * @see IProgressMonitor#done - */ - public synchronized void done() { - visitDelegates(new IDelegateVisitor() { - public void visit(IProgressMonitor delegate) { - delegate.done(); - } - }); - } - - /* - * @see IProgressMonitor#setTaskName - */ - public synchronized void setTaskName(String name) { - fTaskName = name; - visitDelegates(new IDelegateVisitor() { - public void visit(IProgressMonitor delegate) { - delegate.setTaskName(fTaskName); - } - }); - } - - /* - * @see IProgressMonitor#subTask - */ - public synchronized void subTask(String name) { - fSubTask = name; - visitDelegates(new IDelegateVisitor() { - public void visit(IProgressMonitor delegate) { - delegate.subTask(fSubTask); - } - }); - } - - /* - * @see IProgressMonitor#worked - */ - public void worked(int work) { - internalWorked(work); - } - - /* - * @see IProgressMonitor#internalWorked - */ - public synchronized void internalWorked(double internalWork) { - fWorked += internalWork; - final double fInternalWork = internalWork; - visitDelegates(new IDelegateVisitor() { - public void visit(IProgressMonitor delegate) { - delegate.internalWorked(fInternalWork); - } - }); - } - - /* - * @see IProgressMonitor#isCanceled - */ - public synchronized boolean isCanceled() { - visitDelegates(new IDelegateVisitor() { - public void visit(IProgressMonitor delegate) { - fIsCanceled |= delegate.isCanceled(); - } - }); - return fIsCanceled; - } - - /* - * @see IProgressMonitor#setCanceled - */ - public synchronized void setCanceled(boolean canceled) { - fIsCanceled = canceled; - visitDelegates(new IDelegateVisitor() { - public void visit(IProgressMonitor delegate) { - delegate.setCanceled(fIsCanceled); - } - }); - } - - /* - * @see IProgressMonitor#setBlocked - */ - public synchronized void setBlocked(IStatus reason) { - fIsBlocked = true; - final IStatus fReason = reason; - visitDelegates(new IDelegateVisitor() { - public void visit(IProgressMonitor delegate) { - if (delegate instanceof IProgressMonitorWithBlocking) - ((IProgressMonitorWithBlocking) delegate).setBlocked(fReason); - } - }); - } - - /* - * @see IProgressMonitor#clearBlocked - */ - public synchronized void clearBlocked() { - fIsBlocked = false; - visitDelegates(new IDelegateVisitor() { - public void visit(IProgressMonitor delegate) { - if (delegate instanceof IProgressMonitorWithBlocking) - ((IProgressMonitorWithBlocking) delegate).clearBlocked(); - } - }); - } - - /** - * Adds a delegate. - */ - public synchronized void addDelegate(IProgressMonitor delegate) { - if (fDelegateList.indexOf(delegate) == -1) { - if (fTaskName != null) - syncUp(delegate); - fDelegateList.add(delegate); - } - } - - /** - * Brings delegate in sync with current progress. - */ - private void syncUp(IProgressMonitor delegate) { - delegate.beginTask(fTaskName, fTotalWork); - delegate.internalWorked(fWorked); - if (fSubTask != null && fSubTask.length() > 0) - delegate.subTask(fSubTask); - if (fIsBlocked && delegate instanceof IProgressMonitorWithBlocking) - ((IProgressMonitorWithBlocking) delegate).setBlocked(null); - } - - /** - * Removes a delegate. - */ - public synchronized void removeDelegate(IProgressMonitor delegate) { - int index = fDelegateList.indexOf(delegate); - if (index != -1) { - fDelegateList.remove(index); - } - } - - /** - * Removes all delegates. - */ - public synchronized void removeAllDelegates() { - fDelegateList.clear(); - } - - /** - * Returns the delegate list. - * - * @return An array of progress monitors added using addDelegate(). - */ - public synchronized IProgressMonitor[] getDelegates() { - return (IProgressMonitor[]) fDelegateList.toArray(); - } - - /** - * Defines a delegate visitor. - */ - private static interface IDelegateVisitor { - public void visit(IProgressMonitor delegate); - } - - /** - * Visits each delegate in the delegates list. - */ - private void visitDelegates(IDelegateVisitor visitor) { - // Clone the delegates since they could remove themselves when called - ArrayList delegatesList = (ArrayList) fDelegateList.clone(); - for (Iterator i = delegatesList.iterator(); i.hasNext(); ) { - IProgressMonitor delegate = (IProgressMonitor) i.next(); - visitor.visit(delegate); - } - } -} diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/util/SimpleStack.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/util/SimpleStack.java deleted file mode 100644 index 9b70a2d7d16..00000000000 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/util/SimpleStack.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.core.browser.util; - -import java.util.ArrayList; - -/** - * A helper class which allows you to perform some simple - * stack operations. Avoids the extra overhead of - * synchronization in Java.Util.Stack. - */ -public class SimpleStack { - - private static int INITIAL_STACK_SIZE = 10; - private ArrayList items; - private static boolean VERBOSE = false; - - public SimpleStack() { - items = new ArrayList(INITIAL_STACK_SIZE); - } - - public SimpleStack(int initialSize) { - items = new ArrayList(initialSize); - } - - public void clear() { - items.clear(); - } - - public Object push(Object item) { - items.add(item); - if (VERBOSE) - trace("push on stack: " + item); //$NON-NLS-1$ - return item; - } - - public Object pop() { - int top = items.size()-1; - if (top < 0) - return null; - Object item = items.get(top); - items.remove(top); - if (VERBOSE) - trace("pop from stack: " + item); //$NON-NLS-1$ - return item; - } - - public Object top() { - int top = items.size()-1; - if (top < 0) - return null; - return items.get(top); - } - - public Object bottom() { - if (items.size() == 0) - return null; - return items.get(0); - } - - public boolean isEmpty() { - return (items.size() == 0); - } - - public Object[] toArray() { - return items.toArray(); - } - - public Object[] toArray(Object a[]) { - return items.toArray(a); - } - - private static void trace(String msg) { - System.out.println("(" + Thread.currentThread() + ") " + msg); //$NON-NLS-1$ //$NON-NLS-2$ - } -} diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/CElementHandle.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/CElementHandle.java index 3d5ad0e5473..bcacedf9661 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/CElementHandle.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/CElementHandle.java @@ -80,6 +80,7 @@ abstract class CElementHandle implements ICElementHandle, ISourceReference { } + @SuppressWarnings("unchecked") public Object getAdapter(Class adapter) { return null; } @@ -197,8 +198,8 @@ abstract class CElementHandle implements ICElementHandle, ISourceReference { return NO_CHILDREN; } - public List getChildrenOfType(int type) throws CModelException { - return Collections.EMPTY_LIST; + public List getChildrenOfType(int type) throws CModelException { + return Collections.emptyList(); } public boolean hasChildren() { diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/CElementHandleFactory.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/CElementHandleFactory.java index 7536f6f33bc..0a10e840773 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/CElementHandleFactory.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/CElementHandleFactory.java @@ -59,7 +59,7 @@ public class CElementHandleFactory { public static ICElementHandle create(ITranslationUnit tu, IIndexMacro macro, IRegion region, long timestamp) throws CoreException { CElementHandle element= new MacroHandle(tu, macro); - if (element != null && region != null) { + if (region != null) { element.setRangeOfID(region, timestamp); } return element; diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/EnumerationHandle.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/EnumerationHandle.java index 6ed3c3329cb..6ae1d5214f6 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/EnumerationHandle.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/EnumerationHandle.java @@ -15,7 +15,7 @@ import org.eclipse.cdt.core.dom.ast.IEnumeration; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.ICElement; -public class EnumerationHandle extends CElementHandle implements org.eclipse.cdt.core.model.IEnumeration, ICElementHandle { +public class EnumerationHandle extends CElementHandle implements org.eclipse.cdt.core.model.IEnumeration { public EnumerationHandle(ICElement parent, IEnumeration enumeration) { super(parent, ICElement.C_ENUMERATION, enumeration.getName()); diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/util/ICacheEnumeration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/util/ICacheEnumeration.java deleted file mode 100644 index d8eb262aab0..00000000000 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/util/ICacheEnumeration.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2006 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Rational Software - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.core.util; - - -import java.util.Enumeration; - -/** - * The ICacheEnumeration is used to iterate over both the keys - * and values in an LRUCache. The getValue() method returns the - * value of the last key to be retrieved using nextElement(). - * The nextElement() method must be called before the - * getValue() method. - * - *

The iteration can be made efficient by making use of the fact that values in - * the cache (instances of LRUCacheEntry), know their key. For this reason, - * Hashtable lookups don't have to be made at each step of the iteration. - * - *

Modifications to the cache must not be performed while using the - * enumeration. Doing so will lead to an illegal state. - * - * @see LRUCache - * - * This interface is similar to the JDT ICacheEnumeration interface. - */ -public interface ICacheEnumeration extends Enumeration { - /** - * Returns the value of the previously accessed key in the enumeration. - * Must be called after a call to nextElement(). - * - * @return Value of current cache entry - */ - public Object getValue(); -} diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/util/LRUCache.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/util/LRUCache.java index 03857bbab71..d4a05654f1a 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/util/LRUCache.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/util/LRUCache.java @@ -239,33 +239,7 @@ public class LRUCache implements Cloneable { public boolean isEmpty() { return fEntryTable.isEmpty(); } - /** - * Returns an enumeration that iterates over all the keys and values - * currently in the cache. - */ - public ICacheEnumeration keysAndValues() { - return new ICacheEnumeration() { - - Enumeration> fValues = fEntryTable.elements(); - LRUCacheEntry fEntry; - - public boolean hasMoreElements() { - return fValues.hasMoreElements(); - } - - public K nextElement() { - fEntry = fValues.nextElement(); - return fEntry._fKey; - } - - public T getValue() { - if (fEntry == null) { - throw new java.util.NoSuchElementException(); - } - return fEntry._fValue; - } - }; - } + /** * Ensures there is the specified amount of free space in the receiver, * by removing old entries if necessary. Returns true if the requested space was diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java index 1a6e67d2b14..30a10749b32 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java @@ -11,6 +11,7 @@ package org.eclipse.cdt.core; import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectNature; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; @@ -31,7 +32,7 @@ public class CCProjectNature extends CProjectNature { /** * Checks to ensure that a cnature already exists, * if not throw a CoreException. Does NOT add a default builder - * @see IProjectNature#configure + * @see IProjectNature#configure() */ @Override public void configure() throws CoreException { diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java index 18467738c99..06cc560dc30 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java @@ -84,7 +84,6 @@ public class CCorePreferenceConstants { /** * Active code formatter ID. - * @see #getDefaultOptions */ public static final String CODE_FORMATTER = CCorePlugin.PLUGIN_ID + ".code_formatter"; //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java index 88b72176e6f..97fe184ad0c 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java @@ -45,7 +45,7 @@ public class CProjectNature implements IProjectNature { /** * Utility method for adding a nature to a project. * - * @param proj + * @param project * the project to add the nature * @param natureId * the id of the nature to assign to the project @@ -57,8 +57,8 @@ public class CProjectNature implements IProjectNature { public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException { IProjectDescription description = project.getDescription(); String[] prevNatures = description.getNatureIds(); - for (int i = 0; i < prevNatures.length; i++) { - if (natureId.equals(prevNatures[i])) + for (String prevNature : prevNatures) { + if (natureId.equals(prevNature)) return; } String[] newNatures = new String[prevNatures.length + 1]; @@ -71,7 +71,7 @@ public class CProjectNature implements IProjectNature { /** * Utility method for removing a project nature from a project. * - * @param proj + * @param project * the project to remove the nature from * @param natureId * the nature id to remove @@ -82,9 +82,9 @@ public class CProjectNature implements IProjectNature { public static void removeNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException { IProjectDescription description = project.getDescription(); String[] prevNatures = description.getNatureIds(); - List newNatures = new ArrayList(Arrays.asList(prevNatures)); + List newNatures = new ArrayList(Arrays.asList(prevNatures)); newNatures.remove(natureId); - description.setNatureIds((String[]) newNatures.toArray(new String[newNatures.size()])); + description.setNatureIds(newNatures.toArray(new String[newNatures.size()])); project.setDescription(description, monitor); } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java index d6eebed50b9..3a9cbb6f5e7 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java @@ -80,8 +80,6 @@ public class CommandLauncher { /** * return the constructed Command line. - * - * @return */ public String getCommandLine() { return getCommandLine(getCommandArgs()); @@ -193,8 +191,8 @@ public class CommandLauncher { protected String getCommandLine(String[] commandArgs) { StringBuffer buf = new StringBuffer(); if (fCommandArgs != null) { - for (int i = 0; i < commandArgs.length; i++) { - buf.append(commandArgs[i]); + for (String commandArg : commandArgs) { + buf.append(commandArg); buf.append(' '); } buf.append(lineSeparator); diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java index ed2ee19db0b..0fd664d696c 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java @@ -45,12 +45,12 @@ public class ErrorParserManager extends OutputStream { private IProject fProject; private IMarkerGenerator fMarkerGenerator; // Maps a file name without directory to a IFile object or a list of a IFile objects. - private Map fFilesInProject; // Files or lists of files keyed by the file name + private Map fFilesInProject; // Files or lists of files keyed by the file name - private Map fErrorParsers; - private ArrayList fErrors; + private Map fErrorParsers; + private ArrayList fErrors; - private Vector fDirectoryStack; + private Vector fDirectoryStack; private IPath fBaseDirectory; private String previousLine; @@ -78,10 +78,10 @@ public class ErrorParserManager extends OutputStream { if (parsersIDs == null) { enableAllParsers(); } else { - fErrorParsers = new LinkedHashMap(parsersIDs.length); - for (int i = 0; i < parsersIDs.length; i++) { - IErrorParser[] parsers = CCorePlugin.getDefault().getErrorParser(parsersIDs[i]); - fErrorParsers.put(parsersIDs[i], parsers); + fErrorParsers = new LinkedHashMap(parsersIDs.length); + for (String parsersID : parsersIDs) { + IErrorParser[] parsers = CCorePlugin.getDefault().getErrorParser(parsersID); + fErrorParsers.put(parsersID, parsers); } } fMarkerGenerator = markerGenerator; @@ -89,11 +89,11 @@ public class ErrorParserManager extends OutputStream { } private void initErrorParserManager(IPath workingDirectory) { - fFilesInProject = new HashMap(); - fDirectoryStack = new Vector(); - fErrors = new ArrayList(); + fFilesInProject = new HashMap(); + fDirectoryStack = new Vector(); + fErrors = new ArrayList(); - List collectedFiles = new ArrayList(); + List collectedFiles = new ArrayList(); fBaseDirectory = (workingDirectory == null || workingDirectory.isEmpty()) ? fProject.getLocation() : workingDirectory; collectFiles(fProject, collectedFiles); @@ -102,12 +102,14 @@ public class ErrorParserManager extends OutputStream { String filename = file.getName(); Object existing = fFilesInProject.put(filename, file); if (existing != null) { - Collection files; + Collection files; if (existing instanceof IFile) { - files = new ArrayList(); - files.add(existing); + files = new ArrayList(); + files.add((IFile) existing); } else { - files = (Collection) existing; + @SuppressWarnings("unchecked") + final Collection casted = (Collection) existing; + files = casted; } files.add(file); fFilesInProject.put(filename, files); @@ -121,7 +123,7 @@ public class ErrorParserManager extends OutputStream { public IPath getWorkingDirectory() { if (fDirectoryStack.size() != 0) { - return (IPath) fDirectoryStack.lastElement(); + return fDirectoryStack.lastElement(); } // Fall back to the Project Location return fBaseDirectory; @@ -143,7 +145,7 @@ public class ErrorParserManager extends OutputStream { public IPath popDirectory() { int i = fDirectoryStack.size(); if (i != 0) { - IPath dir = (IPath) fDirectoryStack.lastElement(); + IPath dir = fDirectoryStack.lastElement(); fDirectoryStack.removeElementAt(i - 1); return dir; } @@ -155,11 +157,11 @@ public class ErrorParserManager extends OutputStream { } private void enableAllParsers() { - fErrorParsers = new LinkedHashMap(); + fErrorParsers = new LinkedHashMap(); String[] parserIDs = CCorePlugin.getDefault().getAllErrorParsersIDs(); - for (int i = 0; i < parserIDs.length; i++) { - IErrorParser[] parsers = CCorePlugin.getDefault().getErrorParser(parserIDs[i]); - fErrorParsers.put(parserIDs[i], parsers); + for (String parserID : parserIDs) { + IErrorParser[] parsers = CCorePlugin.getDefault().getErrorParser(parserID); + fErrorParsers.put(parserID, parsers); } if (fErrorParsers.size() == 0) { initErrorParsersMap(); @@ -169,13 +171,13 @@ public class ErrorParserManager extends OutputStream { private void initErrorParsersMap() { String[] parserIDs = CCorePlugin.getDefault().getAllErrorParsersIDs(); - for (int i = 0; i < parserIDs.length; i++) { - IErrorParser[] parsers = CCorePlugin.getDefault().getErrorParser(parserIDs[i]); - fErrorParsers.put(parserIDs[i], parsers); + for (String parserID : parserIDs) { + IErrorParser[] parsers = CCorePlugin.getDefault().getErrorParser(parserID); + fErrorParsers.put(parserID, parsers); } } - protected void collectFiles(IProject parent, final List result) { + protected void collectFiles(IProject parent, final List result) { try { parent.accept(new IResourceProxyVisitor() { public boolean visit(IResourceProxy proxy) { @@ -204,15 +206,14 @@ public class ErrorParserManager extends OutputStream { return; String[] parserIDs = new String[fErrorParsers.size()]; - Iterator items = fErrorParsers.keySet().iterator(); + Iterator items = fErrorParsers.keySet().iterator(); for (int i = 0; items.hasNext(); i++) { - parserIDs[i] = (String) items.next(); + parserIDs[i] = items.next(); } for (int i = 0; i files = (Collection) obj; IFile matchingFile = null; - for (Iterator it = files.iterator(); it.hasNext();) { - IFile file = (IFile) it.next(); + for (Object name : files) { + IFile file = (IFile) name; IPath location = file.getLocation(); boolean match = false; if (path.isAbsolute()) { @@ -282,9 +283,9 @@ public class ErrorParserManager extends OutputStream { // It may be a link resource so we must check it also. if (file == null) { IFile[] files = root.findFilesForLocation(path); - for (int i = 0; i < files.length; i++) { - if (files[i].getProject().equals(fProject)) { - file = files[i]; + for (IFile file2 : files) { + if (file2.getProject().equals(fProject)) { + file = file2; break; } } @@ -479,9 +480,9 @@ public class ErrorParserManager extends OutputStream { public boolean reportProblems() { boolean reset = false; if (nOpens == 0) { - Iterator iter = fErrors.iterator(); + Iterator iter = fErrors.iterator(); while (iter.hasNext()) { - ProblemMarkerInfo problemMarkerInfo = (ProblemMarkerInfo) iter.next(); + ProblemMarkerInfo problemMarkerInfo = iter.next(); if (problemMarkerInfo.severity == IMarkerGenerator.SEVERITY_ERROR_BUILD) { reset = true; } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddress.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddress.java index a19ac277817..5259cfe3eeb 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddress.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddress.java @@ -14,14 +14,14 @@ package org.eclipse.cdt.core; import java.math.BigInteger; /** - * Represents C/C++ address in CDT. All implementors of this inteface should be + * Represents C/C++ address in CDT. All implementors of this interface should be * immutable, i.e. all methods should not modify objects, they should return * new object. * * Please see Addr32 and Addr64 classes to see how this interface should * be extended */ -public interface IAddress extends Comparable { +public interface IAddress extends Comparable { /** * Adds offset to address and returns new address object * which is the result @@ -56,7 +56,6 @@ public interface IAddress extends Comparable { /** * Returns the value of the address. - * @return */ BigInteger getValue(); @@ -99,7 +98,6 @@ public interface IAddress extends Comparable { * with all leading zeros. The length of returned string should be * the same for all addresses of given class. I.e. 10 for 32-bit * addresses and 18 for 64-bit addresses - * @return */ String toHexAddressString(); @@ -109,7 +107,6 @@ public interface IAddress extends Comparable { * with all leading zeros. The length of returned string should be * the same for all addresses of given class. I.e. 34 for 32-bit * addresses and 66 for 64-bit addresses - * @return */ String toBinaryAddressString(); diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddressFactory.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddressFactory.java index b81ca906c6f..7137d8a642c 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddressFactory.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddressFactory.java @@ -22,13 +22,11 @@ public interface IAddressFactory { /** * Returns zero address, i.e. minimal possible address - * @return */ IAddress getZero(); /** * Returns maximal address. - * @return */ IAddress getMax(); @@ -50,7 +48,6 @@ public interface IAddressFactory * Please see Addr32Factory.createAddress() for reference implementation. * * @param addr - * @return */ IAddress createAddress(String addr); @@ -70,7 +67,6 @@ public interface IAddressFactory * * @param addr * @param radix - * @return */ IAddress createAddress(String addr, int radix); @@ -78,7 +74,6 @@ public interface IAddressFactory * Create address from a BigInteger * * @param addr - * @return */ IAddress createAddress(BigInteger addr); } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IBinaryParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IBinaryParser.java index 45ac4d75b9d..ed724dbdffb 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IBinaryParser.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IBinaryParser.java @@ -69,7 +69,6 @@ public interface IBinaryParser extends IAdaptable { /** * Return the binary parser - * @return */ IBinaryParser getBinaryParser(); } @@ -150,12 +149,11 @@ public interface IBinaryParser extends IAdaptable { interface IBinaryShared extends IBinaryExecutable { /** * The Share Object name. - * @return */ String getSoName(); } - interface ISymbol extends Comparable { + interface ISymbol extends Comparable { /** * Symbol is type function. @@ -169,56 +167,47 @@ public interface IBinaryParser extends IAdaptable { /** * Name of the Symbol - * @return */ String getName(); /** * Address of the symbol - * @return */ IAddress getAddress(); /** * Size of the symbol. - * @return */ long getSize(); /** * Start linenumber of the symbol in the source - * @return */ int getStartLine(); /** * End line number of the symbol in the source - * @return */ int getEndLine(); /** * Source filename of the symbol. - * @return */ IPath getFilename(); /** * Type of the symbol - * @return */ int getType(); /** * Line number corresponding to the address offset. * @param offset - * @return */ int getLineNumber(long offset); /** * Return the binary object this symbol is from. - * @return */ IBinaryObject getBinaryObject(); } @@ -228,7 +217,6 @@ public interface IBinaryParser extends IAdaptable { * @param hints - array byte that can be use to recognise the file. * Can be null or empty array when no hints are passed. * @param path - * @return * @throws IOException */ IBinaryFile getBinary(byte[] hints, IPath path) throws IOException; @@ -237,14 +225,12 @@ public interface IBinaryParser extends IAdaptable { * Creates an IBinaryFile. * * @param path - * @return * @throws IOException */ IBinaryFile getBinary(IPath path) throws IOException; /** * Returns the name of the Format. - * @return */ String getFormat(); @@ -252,13 +238,11 @@ public interface IBinaryParser extends IAdaptable { * True if the resource is a binary. * @param hints * @param path - * @return */ boolean isBinary(byte[] hints, IPath path); /** - * Get a hint of the needed buffer size to recognise the file. - * @return + * Get a hint of the needed buffer size to recognize the file. */ int getHintBufferSize(); } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorManager.java index 9abd0dffd2e..4c09ddce5cd 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorManager.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptorManager.java @@ -17,40 +17,14 @@ import org.eclipse.core.runtime.IProgressMonitor; public interface ICDescriptorManager { - /** - * @param project - * @param id - * @throws CoreException - */ public void configure(IProject project, String id) throws CoreException; - /** - * @param project - * @param id - * @throws CoreException - */ + public void convert(IProject project, String id) throws CoreException; - /** - * @param project - * @return - * @throws CoreException - */ public ICDescriptor getDescriptor(IProject project) throws CoreException; - /** - * @param project - * @param forceCreation - * @return - * @throws CoreException - */ public ICDescriptor getDescriptor(IProject project, boolean create) throws CoreException; - /** - * @param project - * @param op - * @param monitor - * @throws CoreException - */ public void runDescriptorOperation(IProject project, ICDescriptorOperation op, IProgressMonitor monitor) throws CoreException; public void runDescriptorOperation(IProject project, @@ -59,13 +33,7 @@ public interface ICDescriptorManager { IProgressMonitor monitor) throws CoreException; - /** - * @param listener - */ public void addDescriptorListener(ICDescriptorListener listener); - /** - * @param listener - */ public void removeDescriptorListener(ICDescriptorListener listener); } diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Symbol.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Symbol.java index debfe7caefd..e82355c06d3 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Symbol.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Symbol.java @@ -15,7 +15,7 @@ import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; import org.eclipse.cdt.core.IBinaryParser.ISymbol; import org.eclipse.core.runtime.IPath; -public class Symbol implements ISymbol, Comparable { +public class Symbol implements ISymbol { protected final BinaryObjectAdapter binary; private final String name; diff --git a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/ElementSelectionDialog.java b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/ElementSelectionDialog.java index dd313106b21..37e0e513619 100644 --- a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/ElementSelectionDialog.java +++ b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/ElementSelectionDialog.java @@ -50,7 +50,7 @@ import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.ui.browser.typeinfo.TypeSelectionDialog; -import org.eclipse.cdt.internal.core.browser.util.IndexModelUtil; +import org.eclipse.cdt.internal.core.browser.IndexModelUtil; import org.eclipse.cdt.internal.ui.ICHelpContextIds;