From 30c61470fb58528b418a56b99c82b99ddf03f3ac Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Fri, 21 Nov 2014 15:23:10 -0800 Subject: Cosmetics. --- ...BindingResolutionBugsSingleProjectFirstAST.java | 2 +- .../tests/IndexCPPTemplateResolutionTest.java | 23 ++++----- .../eclipse/cdt/internal/core/model/Openable.java | 53 +++++++------------ .../eclipse/cdt/core/dom/ast/ICompositeType.java | 2 +- .../org/eclipse/cdt/core/dom/ast/IScope.java | 24 ++++----- ...emplatePartialSpecializationSpecialization.java | 7 ++- .../cdt/core/dom/ast/cpp/ICPPTemplateInstance.java | 4 +- .../core/dom/parser/c/CASTTranslationUnit.java | 15 ++---- .../core/dom/parser/c/CCompositeTypeScope.java | 36 ++++++------- .../core/dom/parser/cpp/CPPASTTranslationUnit.java | 15 +++--- ...emplatePartialSpecializationSpecialization.java | 5 +- .../dom/parser/cpp/semantics/BaseClassLookup.java | 30 +++++------ .../core/pdom/dom/cpp/PDOMCPPClassScope.java | 10 ++-- .../pdom/dom/cpp/PDOMCPPClassSpecialization.java | 10 ++-- .../core/pdom/dom/cpp/PDOMCPPClassType.java | 4 +- .../refactoring/rename/RenameInformationPopup.java | 60 ++++++++++------------ .../AbstractDocCommentProposalComputer.java | 6 +-- .../ui/wizards/dialogfields/DialogField.java | 6 ++- .../cdt/utils/ui/controls/ControlFactory.java | 5 +- .../mi/internal/ui/dialogfields/DialogField.java | 6 ++- .../internal/ui/dialogfields/DialogField.java | 6 ++- 21 files changed, 149 insertions(+), 180 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugsSingleProjectFirstAST.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugsSingleProjectFirstAST.java index b537ab53a38..6600b4fbcf1 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugsSingleProjectFirstAST.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugsSingleProjectFirstAST.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - initial API and implementation + * Markus Schorn - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.internal.index.tests; diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java index 7713e4566e9..aea80db1c0c 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java @@ -1972,9 +1972,9 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa // typedef int type; // }; - // template struct foo {}; + // template struct foo {}; // int main() { - // typedef foo::type type; // ERROR HERE: 'foo::type' could not be + // typedef foo::type type; // } public void testSpecializationInIndex_367563a() throws Exception { getBindingFromASTName("type type", 4, ITypedef.class); @@ -1987,7 +1987,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa // template struct foo {}; // int main() { - // typedef foo::type type; // ERROR HERE: 'foo::type' could not be + // typedef foo::type type; // } public void testSpecializationInIndex_367563b() throws Exception { getBindingFromASTName("type type", 4, ITypedef.class); @@ -2008,7 +2008,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa // template <> struct foo { // typedef int type; // }; - // typedef foo::type>::type t; // ERROR HERE + // typedef foo::type>::type t; public void testCurrentInstanceOfClassTemplatePartialSpec_368404() throws Exception { ITypedef tdef= getBindingFromASTName("type t;", 4, ITypedef.class); assertEquals("int", ASTTypeUtil.getType(tdef, true)); @@ -2452,14 +2452,12 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa } // template - // struct multipliable2 - // { + // struct multipliable2 { // friend T operator *(const U& lhs, const T& rhs); // }; // // template - // struct multipliable1 - // { + // struct multipliable1 { // friend T operator *(const T& lhs, const T& rhs); // }; @@ -2467,8 +2465,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa // // int foo(overloaded); // - // int main() - // { + // int main() { // overloaded c, d; // foo(c * d); // } @@ -2477,14 +2474,12 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa } // template - // struct multipliable2 - // { + // struct multipliable2 { // friend T operator *(const U& lhs, const T& rhs); // }; // // template - // struct multipliable1 - // { + // struct multipliable1 { // friend T operator *(const T& lhs, const T& rhs) {} // }; diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Openable.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Openable.java index d305e3c5177..eebc7174af4 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Openable.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Openable.java @@ -81,7 +81,7 @@ public abstract class Openable extends Parent implements IOpenable { Map newElements, IResource underlyingResource) throws CModelException; /** - * Close the buffer associated with this element, if any. + * Closes the buffer associated with this element, if any. */ protected void closeBuffer() { if (!hasBuffer()) return; // nothing to do @@ -94,7 +94,7 @@ public abstract class Openable extends Parent implements IOpenable { } /** - * This element is being closed. Do any necessary cleanup. + * Does any necessary cleanup when this element is being closed. */ @Override protected void closing(Object info) throws CModelException { @@ -107,13 +107,13 @@ public abstract class Openable extends Parent implements IOpenable { @Override public IBuffer getBuffer() throws CModelException { if (hasBuffer()) { - // ensure element is open + // Ensure element is open. if (!isOpen()) { getElementInfo(); } IBuffer buffer = getBufferManager().getBuffer(this); if (buffer == null) { - // try to (re)open a buffer + // Try to (re)open a buffer. buffer = openBuffer(null); } return buffer; @@ -122,7 +122,7 @@ public abstract class Openable extends Parent implements IOpenable { } /** - * Answers the buffer factory to use for creating new buffers + * Returns the buffer factory to use for creating new buffers. */ public IBufferFactory getBufferFactory(){ return getBufferManager().getDefaultBufferFactory(); @@ -142,9 +142,7 @@ public abstract class Openable extends Parent implements IOpenable { protected boolean hasBuffer() { return false; } - /** - * @see org.eclipse.cdt.core.model.IOpenable#hasUnsavedChanges() - */ + @Override public boolean hasUnsavedChanges() throws CModelException{ if (isReadOnly() || !isOpen()) { @@ -154,8 +152,8 @@ public abstract class Openable extends Parent implements IOpenable { if (buf != null && buf.hasUnsavedChanges()) { return true; } - // for roots and projects must check open buffers - // to see if they have an child with unsaved changes + // For roots and projects must check open buffers to see + // if they have an child with unsaved changes. if (fType == C_MODEL || fType == C_PROJECT) { Enumeration openBuffers= getBufferManager().getOpenBuffers(); while (openBuffers.hasMoreElements()) { @@ -182,9 +180,6 @@ public abstract class Openable extends Parent implements IOpenable { return true; } - /** - * @see org.eclipse.cdt.core.model.IOpenable#isOpen() - */ @Override public boolean isOpen() { return CModelManager.getDefault().getInfo(this) != null; @@ -197,9 +192,8 @@ public abstract class Openable extends Parent implements IOpenable { } /** - * Returns true if this represents a source element. - * Openable source elements have an associated buffer created - * when they are opened. + * Returns true if this represents a source element. Openable source elements have + * an associated buffer created when they are opened. */ protected boolean isSourceElement() { return false; @@ -215,13 +209,10 @@ public abstract class Openable extends Parent implements IOpenable { @Override public void makeConsistent(IProgressMonitor monitor, boolean forced) throws CModelException { - // only translation units can be inconsistent - // other openables cannot be inconsistent so default is to do nothing + // Only translation units can be inconsistent. + // Other Openables cannot be inconsistent so default is to do nothing. } - /** - * @see org.eclipse.cdt.core.model.IOpenable#open(IProgressMonitor) - */ @Override public void open(IProgressMonitor pm) throws CModelException { getElementInfo(pm); @@ -248,9 +239,6 @@ public abstract class Openable extends Parent implements IOpenable { } } - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.model.CElement#generateInfos(java.lang.Object, java.util.Map, org.eclipse.core.runtime.IProgressMonitor) - */ @Override protected void generateInfos(CElementInfo info, Map newElements, IProgressMonitor monitor) throws CModelException { @@ -258,16 +246,16 @@ public abstract class Openable extends Parent implements IOpenable { System.out.println("OPENING Element ("+ Thread.currentThread()+"): " + this); //$NON-NLS-1$//$NON-NLS-2$ } - // open the parent if necessary + // Open the parent if necessary. openParent(info, newElements, monitor); if (monitor != null && monitor.isCanceled()) return; - // puts the info before building the structure so that questions to the handle behave as if the element existed - // (case of compilation units becoming working copies) + // Put the info before building the structure so that questions to the handle behave as if + // the element existed (case of compilation units becoming working copies). newElements.put(this, info); - // build the structure of the openable (this will open the buffer if needed) + // Build the structure of the Openable (this will open the buffer if needed). try { OpenableInfo openableInfo = (OpenableInfo) info; boolean isStructureKnown = buildStructure(openableInfo, monitor, newElements, getResource()); @@ -277,13 +265,10 @@ public abstract class Openable extends Parent implements IOpenable { throw e; } - // remove out of sync buffer for this element + // Remove out of sync buffer for this element. CModelManager.getDefault().getElementsOutOfSynchWithBuffers().remove(this); } - /** - * @see org.eclipse.cdt.core.model.IOpenable#save(IProgressMonitor, boolean) - */ @Override public void save(IProgressMonitor pm, boolean force) throws CModelException { IResource res = getResource(); @@ -293,7 +278,7 @@ public abstract class Openable extends Parent implements IOpenable { throw new CModelException(new CModelStatus(ICModelStatusConstants.READ_ONLY, this)); } } - // check also the underlying resource + // Check also the underlying resource. if (isReadOnly()) { throw new CModelException(new CModelStatus(ICModelStatusConstants.READ_ONLY, this)); } @@ -305,7 +290,7 @@ public abstract class Openable extends Parent implements IOpenable { } /** - * Find enclosing package fragment root if any + * Finds enclosing package fragment root if any. */ public SourceRoot getSourceRoot() { ICElement current = this; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ICompositeType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ICompositeType.java index 6775e42c92a..42c4aee3726 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ICompositeType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ICompositeType.java @@ -54,7 +54,7 @@ public interface ICompositeType extends IBinding, IType { public IField findField(String name); /** - * Returns the IScope object that is associated with this composite type + * Returns the IScope object that is associated with this composite type. */ public IScope getCompositeScope(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IScope.java index 522729372ff..a2b76f25380 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IScope.java @@ -137,40 +137,40 @@ public interface IScope { } } - public void setPrefixLookup(boolean prefixLookup) { + public final void setPrefixLookup(boolean prefixLookup) { fPrefixLookup = prefixLookup; } - public void setResolve(boolean resolve) { + public final void setResolve(boolean resolve) { fResolve = resolve; } - public void setIgnorePointOfDeclaration(boolean ignorePointOfDeclaration) { + public final void setIgnorePointOfDeclaration(boolean ignorePointOfDeclaration) { fIgnorePointOfDeclaration = ignorePointOfDeclaration; } - public void setLookupKey(char[] key) { + public final void setLookupKey(char[] key) { fLookupKey= key; } - public char[] getLookupKey() { + public final char[] getLookupKey() { return fLookupKey; } - public IASTNode getLookupPoint() { + public final IASTNode getLookupPoint() { return fLookupPoint; } - public boolean isResolve() { + public final boolean isResolve() { return fResolve; } - public boolean isPrefixLookup() { + public final boolean isPrefixLookup() { return fPrefixLookup; } - public boolean isIgnorePointOfDeclaration() { + public final boolean isIgnorePointOfDeclaration() { return fIgnorePointOfDeclaration; } - public IIndexFileSet getIncludedFiles() { + public final IIndexFileSet getIncludedFiles() { return fTu == null ? IIndexFileSet.EMPTY : fTu.getIndexFileSet(); } - public IIndex getIndex() { + public final IIndex getIndex() { return fTu == null ? null : fTu.getIndex(); } - public IASTName getLookupName() { + public final IASTName getLookupName() { return fLookupPointIsName ? (IASTName) fLookupPoint : null; } public IASTTranslationUnit getTranslationUnit() { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassTemplatePartialSpecializationSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassTemplatePartialSpecializationSpecialization.java index 964f542e6c3..8be6e8ad7bf 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassTemplatePartialSpecializationSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassTemplatePartialSpecializationSpecialization.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - initial API and implementation + * Markus Schorn - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.core.dom.ast.cpp; @@ -17,7 +17,6 @@ package org.eclipse.cdt.core.dom.ast.cpp; * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. */ -public interface ICPPClassTemplatePartialSpecializationSpecialization extends - ICPPClassTemplatePartialSpecialization, ICPPClassSpecialization { - +public interface ICPPClassTemplatePartialSpecializationSpecialization + extends ICPPClassTemplatePartialSpecialization, ICPPClassSpecialization { } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPTemplateInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPTemplateInstance.java index fb71b0c5c30..654a57f3478 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPTemplateInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPTemplateInstance.java @@ -31,7 +31,7 @@ public interface ICPPTemplateInstance extends ICPPSpecialization { ICPPTemplateInstance[] EMPTY_TEMPLATE_INSTANCE_ARRAY = {}; /** - * get the template that this was instantiated from + * Returns the template that this instance was instantiated from. */ public ICPPTemplateDefinition getTemplateDefinition(); @@ -43,7 +43,7 @@ public interface ICPPTemplateInstance extends ICPPSpecialization { /** * Explicit specializations are modeled as instances of a template. - * Returns true if this binding is an explicit specialization. + * Returns {@code true} if this binding is an explicit specialization. * @since 5.2 */ public boolean isExplicitSpecialization(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTranslationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTranslationUnit.java index c462651af8e..2e2dbc77d88 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTranslationUnit.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTranslationUnit.java @@ -6,9 +6,9 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM Rational Software - Initial API and implementation - * Markus Schorn (Wind River Systems) - * Yuan Zhang / Beth Tibbitts (IBM Research) + * IBM Rational Software - Initial API and implementation + * Markus Schorn (Wind River Systems) + * Yuan Zhang / Beth Tibbitts (IBM Research) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.c; @@ -31,7 +31,7 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; * C-specific implementation of a translation unit. */ public class CASTTranslationUnit extends ASTTranslationUnit implements IASTAmbiguityParent { - private CScope compilationUnit = null; + private CScope compilationUnit; private final CStructMapper fStructMapper; public CASTTranslationUnit() { @@ -78,11 +78,6 @@ public class CASTTranslationUnit extends ASTTranslationUnit implements IASTAmbig return ArrayUtil.removeNulls(IASTName.class, names); } - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getReferences(org.eclipse.cdt.core.dom.ast.IBinding) - */ @Override public IASTName[] getReferences(IBinding binding) { if (binding instanceof IMacroBinding) @@ -112,7 +107,7 @@ public class CASTTranslationUnit extends ASTTranslationUnit implements IASTAmbig public ICompositeType mapToASTType(ICompositeType type) { return fStructMapper.mapToAST(type); } - + @Override protected IType createType(IASTTypeId typeid) { return CVisitor.createType(typeid.getAbstractDeclarator()); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CCompositeTypeScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CCompositeTypeScope.java index f5537c5268f..e031738cea4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CCompositeTypeScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CCompositeTypeScope.java @@ -32,39 +32,33 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTQueries; * Implementation of scope for structs and unions. */ public class CCompositeTypeScope extends CScope implements ICCompositeTypeScope { - public CCompositeTypeScope( ICASTCompositeTypeSpecifier compTypeSpec ){ - super( compTypeSpec, EScopeKind.eClassType); + public CCompositeTypeScope(ICASTCompositeTypeSpecifier compTypeSpec) { + super(compTypeSpec, EScopeKind.eClassType); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.c.ICCompositeTypeScope#getBinding(char[]) - */ @Override - public IBinding getBinding( char[] name ) { - return super.getBinding( NAMESPACE_TYPE_OTHER, name ); + public IBinding getBinding(char[] name) { + return super.getBinding(NAMESPACE_TYPE_OTHER, name); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String) - */ @Override - public IBinding[] find( String name ) { - CollectNamesAction action = new CollectNamesAction( name.toCharArray() ); - getPhysicalNode().accept( action ); + public IBinding[] find(String name) { + CollectNamesAction action = new CollectNamesAction(name.toCharArray()); + getPhysicalNode().accept(action); - IASTName [] names = action.getNames(); - IBinding [] result = null; + IASTName[] names = action.getNames(); + IBinding[] result = null; for (IASTName astName : names) { IBinding b = astName.resolveBinding(); - if( b == null ) continue; + if (b == null) continue; try { - if( b.getScope() == this ) - result = ArrayUtil.append( IBinding.class, result, b ); - } catch ( DOMException e ) { + if (b.getScope() == this) + result = ArrayUtil.append(IBinding.class, result, b); + } catch (DOMException e) { } } - return ArrayUtil.trim( IBinding.class, result ); + return ArrayUtil.trim(IBinding.class, result); } @Override @@ -74,7 +68,7 @@ public class CCompositeTypeScope extends CScope implements ICCompositeTypeScope if (binding instanceof ICompositeType) return (ICompositeType) binding; - return new CStructure.CStructureProblem(compSpec.getName(), ISemanticProblem.BINDING_NO_CLASS, compSpec.getName().toCharArray() ); + return new CStructure.CStructureProblem(compSpec.getName(), ISemanticProblem.BINDING_NO_CLASS, compSpec.getName().toCharArray()); } @Override diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java index b34be7ccaf3..df2e85b9ba5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2011 IBM Corporation and others. + * Copyright (c) 2004, 2014 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 @@ -165,13 +165,16 @@ public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPAST super.skippedFile(offset, fileContent); fScopeMapper.registerAdditionalDirectives(offset, fileContent.getUsingDirectives()); } - - // bug 217102: namespace scopes from the index have to be mapped back to the AST. - public IScope mapToASTScope(IIndexScope scope) { - return fScopeMapper.mapToASTScope(scope); + + // Namespace scopes from the index have to be mapped back to the AST (bug 217102). + public IScope mapToASTScope(IScope scope) { + if (scope instanceof IIndexScope) { + return fScopeMapper.mapToASTScope((IIndexScope) scope); + } + return scope; } - // bug 262719: class types from the index have to be mapped back to the AST. + // Class types from the index have to be mapped back to the AST (bug 262719). public ICPPClassType mapToAST(ICPPClassType binding, IASTNode point) { return fScopeMapper.mapToAST(binding, point); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplatePartialSpecializationSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplatePartialSpecializationSpecialization.java index 8fbdd440b41..d60ebf3d720 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplatePartialSpecializationSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplatePartialSpecializationSpecialization.java @@ -1,4 +1,4 @@ - /******************************************************************************* +/******************************************************************************* * Copyright (c) 2009, 2011 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 @@ -35,7 +35,8 @@ public class CPPClassTemplatePartialSpecializationSpecialization extends CPPClas private final ICPPClassTemplate fClassTemplate; private final ICPPTemplateArgument[] fArguments; - public CPPClassTemplatePartialSpecializationSpecialization(ICPPClassTemplatePartialSpecialization orig, ICPPTemplateParameterMap argumentMap, ICPPClassTemplate template, + public CPPClassTemplatePartialSpecializationSpecialization(ICPPClassTemplatePartialSpecialization orig, + ICPPTemplateParameterMap argumentMap, ICPPClassTemplate template, ICPPTemplateArgument[] args) throws DOMException { super(orig, template.getOwner(), argumentMap); fClassTemplate= template; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BaseClassLookup.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BaseClassLookup.java index 7f643a26998..e7870df9770 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BaseClassLookup.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BaseClassLookup.java @@ -41,10 +41,10 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalUnknownScope; import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding; /** - * Helper class for performing the base class lookup. First a directed graph without loops is computed - * to represent the base class hierarchy up to those bases for which the lookup finds matches. Next, from - * these leaves we search for virtual bases that are hidden. With this information the matches are extracted - * from the graph. + * Helper class for performing the base class lookup. First a directed graph without loops is + * computed to represent the base class hierarchy up to those bases for which the lookup finds + * matches. Next, from these leaves we search for virtual bases that are hidden. With this + * information the matches are extracted from the graph. */ class BaseClassLookup { public static void lookupInBaseClasses(LookupData data, ICPPClassScope classScope) { @@ -55,7 +55,7 @@ class BaseClassLookup { if (classType == null) return; - final HashMap infoMap = new HashMap(); + final HashMap infoMap = new HashMap<>(); BaseClassLookup rootInfo= lookupInBaseClass(data, null, false, classType, infoMap, 0); if (data.contentAssist) { rootInfo.collectResultForContentAssist(data); @@ -108,7 +108,7 @@ class BaseClassLookup { return; if (fChildren.isEmpty()) { - fChildren= new ArrayList(); + fChildren= new ArrayList<>(); fVirtual= new BitSet(); } fVirtual.set(fChildren.size(), virtual); @@ -156,7 +156,7 @@ class BaseClassLookup { if (baseClassScope != null) { BaseClassLookup info= infoMap.get(baseClassScope); if (info != null) { - // avoid loops + // Avoid loops. if (info.getResult() == null) { data.problem = new ProblemBinding(null, IProblemBinding.SEMANTIC_CIRCULAR_INHERITANCE, root.getNameCharArray()); @@ -204,12 +204,12 @@ class BaseClassLookup { } } } catch (DOMException e) { - // continue the lookup + // Continue the lookup. } } - // There is no result in the baseClass itself or we do content assist, we have to examine its - // base-classes + // There is no result in the baseClass itself or we do content assist, we have to examine + // its base classes. ICPPClassType baseClass= result.getClassType(); if (baseClass != null) { ICPPBase[] grandBases= ClassTypeHelper.getBases(baseClass, data.getLookupPoint()); @@ -217,9 +217,9 @@ class BaseClassLookup { HashSet grandBaseBindings= null; BitSet selectedBases= null; if (grandBases.length > 1) { - grandBaseBindings= new HashSet(); + grandBaseBindings= new HashSet<>(); - // if we have reachable bases, then ignore the others + // If we have reachable bases, then ignore the others. selectedBases = selectPreferredBases(data, grandBases); } for (int i = 0; i < grandBases.length; i++) { @@ -229,7 +229,7 @@ class BaseClassLookup { IBinding grandBaseBinding = grandBase.getBaseClass(); if (!(grandBaseBinding instanceof ICPPClassType)) { - // 14.6.2.3 scope is not examined + // 14.6.2.3 scope is not examined. if (grandBaseBinding instanceof ICPPUnknownBinding) { if (data.skippedScope == null) data.skippedScope= root; @@ -247,7 +247,7 @@ class BaseClassLookup { final IScope grandBaseScope= grandBaseClass.getCompositeScope(); if (grandBaseScope == null || grandBaseScope instanceof ICPPInternalUnknownScope) { - // 14.6.2.3 scope is not examined + // 14.6.2.3 scope is not examined. if (data.skippedScope == null) data.skippedScope= root; continue; @@ -335,7 +335,7 @@ class BaseClassLookup { } baseInfo.propagateHiddenAsVirtual(); } else { - // mark to catch recursions + // Mark to catch recursions. baseInfo= new BaseClassLookup(baseClass, fLookupPoint); infoMap.put(baseScope, baseInfo); baseInfo.hideVirtualBases(infoMap, depth); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassScope.java index f767b47d185..a83c8065748 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassScope.java @@ -152,7 +152,8 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope { public IBinding[] getBindings(ScopeLookupData lookup) { try { if (lookup.getLookupName() instanceof ICPPASTConversionName) { - BindingCollector visitor = new BindingCollector(fBinding.getLinkage(), Keywords.cOPERATOR, CONVERSION_FILTER, true, false, true); + BindingCollector visitor = new BindingCollector(fBinding.getLinkage(), + Keywords.cOPERATOR, CONVERSION_FILTER, true, false, true); acceptViaCache(fBinding, visitor, true); return visitor.getBindings(); } @@ -171,10 +172,11 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope { return getBindingsViaCache(fBinding, nameChars, IndexFilter.CPP_DECLARED_OR_IMPLICIT_NO_INSTANCE); } - // prefix lookup - BindingCollector visitor = new BindingCollector(fBinding.getLinkage(), nameChars, IndexFilter.CPP_DECLARED_OR_IMPLICIT_NO_INSTANCE, true, true, !true); + // Prefix lookup. + BindingCollector visitor = new BindingCollector(fBinding.getLinkage(), nameChars, + IndexFilter.CPP_DECLARED_OR_IMPLICIT_NO_INSTANCE, true, true, false); if (ContentAssistMatcherFactory.getInstance().match(nameChars, fBinding.getNameCharArray())) { - // add the class itself, constructors will be found during the visit + // Add the class itself, constructors will be found during the visit. visitor.visit((IPDOMNode) getClassNameBinding()); } acceptViaCache(fBinding, visitor, true); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java index 4fc86d161c1..0e3b70491c4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java @@ -53,8 +53,8 @@ import org.eclipse.core.runtime.CoreException; /** * @author Bryan Wilkinson */ -class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements - ICPPClassSpecialization, IPDOMMemberOwner, IPDOMCPPClassType { +class PDOMCPPClassSpecialization extends PDOMCPPSpecialization + implements ICPPClassSpecialization, IPDOMMemberOwner, IPDOMCPPClassType { private static final int FIRST_BASE = PDOMCPPSpecialization.RECORD_SIZE + 0; private static final int MEMBERLIST = FIRST_BASE + 4; private static final int FINAL = MEMBERLIST + PDOMCPPMemberBlock.RECORD_SIZE; // byte @@ -66,11 +66,11 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements protected static final int RECORD_SIZE = FINAL + 1; private volatile ICPPClassScope fScope; - private ObjectMap specializationMap; // Obtained from the synchronized PDOM cache + private ObjectMap specializationMap; // Obtained from the synchronized PDOM cache. private final ThreadLocal> fInProgress= new ThreadLocal>() { @Override protected Set initialValue() { - return new HashSet(); + return new HashSet<>(); } }; @@ -257,7 +257,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements return bases; try { - List list = new ArrayList(); + List list = new ArrayList<>(); for (PDOMCPPBase base = getFirstBase(); base != null; base = base.getNextBase()) { list.add(base); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java index 5884c3b8372..a604f55c2a5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java @@ -66,7 +66,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO setKind(classType); setAnonymous(classType); setFinal(classType); - // Linked list is initialized by storage being zero'd by malloc + // Linked list is initialized by storage being zero'd by malloc. } public PDOMCPPClassType(PDOMLinkage linkage, long bindingRecord) { @@ -304,7 +304,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO public ICPPBase[] getBases() { Long key= record + PDOMCPPLinkage.CACHE_BASES; ICPPBase[] bases= (ICPPBase[]) getPDOM().getCachedResult(key); - if (bases != null) + if (bases != null) return bases; try { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/RenameInformationPopup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/RenameInformationPopup.java index b06421c6c07..795e3ad6e17 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/RenameInformationPopup.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/RenameInformationPopup.java @@ -11,6 +11,32 @@ *******************************************************************************/ package org.eclipse.cdt.internal.ui.refactoring.rename; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IMenuListener2; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.bindings.keys.IKeyLookup; +import org.eclipse.jface.bindings.keys.KeyLookupFactory; +import org.eclipse.jface.bindings.keys.KeyStroke; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.text.ITextListener; +import org.eclipse.jface.text.ITextViewerExtension5; +import org.eclipse.jface.text.IViewportListener; +import org.eclipse.jface.text.IWidgetTokenKeeper; +import org.eclipse.jface.text.IWidgetTokenKeeperExtension; +import org.eclipse.jface.text.IWidgetTokenOwner; +import org.eclipse.jface.text.IWidgetTokenOwnerExtension; +import org.eclipse.jface.text.TextEvent; +import org.eclipse.jface.text.link.LinkedPosition; +import org.eclipse.jface.text.source.ISourceViewer; +import org.eclipse.jface.util.Geometry; +import org.eclipse.jface.util.Util; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyleRange; @@ -45,36 +71,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; import org.eclipse.swt.widgets.Tracker; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IMenuListener2; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.bindings.keys.IKeyLookup; -import org.eclipse.jface.bindings.keys.KeyLookupFactory; -import org.eclipse.jface.bindings.keys.KeyStroke; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.util.Geometry; -import org.eclipse.jface.util.Util; - -import org.eclipse.jface.text.ITextListener; -import org.eclipse.jface.text.ITextViewerExtension5; -import org.eclipse.jface.text.IViewportListener; -import org.eclipse.jface.text.IWidgetTokenKeeper; -import org.eclipse.jface.text.IWidgetTokenKeeperExtension; -import org.eclipse.jface.text.IWidgetTokenOwner; -import org.eclipse.jface.text.IWidgetTokenOwnerExtension; -import org.eclipse.jface.text.TextEvent; -import org.eclipse.jface.text.link.LinkedPosition; -import org.eclipse.jface.text.source.ISourceViewer; - import org.eclipse.ui.IPartListener2; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPartReference; @@ -348,10 +344,6 @@ public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenK }); } -// fPopup.moveBelow(null); // make sure hovers are on top of the info popup -// XXX workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=170774 -// fPopup.moveBelow(workbenchShell.getShells()[0]); - UIJob delayJob= new UIJob(display, RenameMessages.RenameInformationPopup_delayJobName) { @Override public IStatus runInUIThread(IProgressMonitor monitor) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/AbstractDocCommentProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/AbstractDocCommentProposalComputer.java index be8e0e2558f..d245f88af32 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/AbstractDocCommentProposalComputer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/AbstractDocCommentProposalComputer.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Andrew Ferguson (Symbian) - Initial implementation + * Andrew Ferguson (Symbian) - Initial implementation *******************************************************************************/ package org.eclipse.cdt.internal.ui.text.doctools; @@ -29,7 +29,6 @@ import org.eclipse.cdt.ui.text.contentassist.ICompletionProposalComputer; import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner; import org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration; - abstract class AbstractDocCommentProposalComputer implements ICompletionProposalComputer { protected abstract IDocCommentViewerConfiguration getConfiguration(IDocCommentOwner owner); @@ -58,15 +57,12 @@ abstract class AbstractDocCommentProposalComputer implements ICompletionProposal @Override public void sessionEnded() { - // XXX } @Override public void sessionStarted() { - // XXX } - private static IResource getResource() { ITranslationUnit tu= getTranslationUnit(); return tu.getResource(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/DialogField.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/DialogField.java index 6be4a06c3b9..1e72f12bc39 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/DialogField.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/DialogField.java @@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.ui.wizards.dialogfields; import org.eclipse.core.runtime.Assert; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; @@ -144,6 +145,7 @@ public class DialogField { /** * Creates a spacer control. + * * @param parent The parent composite */ public static Control createEmptySpace(Composite parent) { @@ -152,8 +154,8 @@ public class DialogField { /** * Creates a spacer control with the given span. - * The composite is assumed to have MGridLayout as - * layout. + * The composite is assumed to have {@link GridLayout} as layout. + * * @param parent The parent composite */ public static Control createEmptySpace(Composite parent, int span) { diff --git a/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/ControlFactory.java b/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/ControlFactory.java index d87abf88047..af4e72e2a6b 100644 --- a/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/ControlFactory.java +++ b/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/ControlFactory.java @@ -173,6 +173,7 @@ public class ControlFactory { /** * Creates a spacer control. + * * @param parent The parent composite */ public static Control createEmptySpace(Composite parent) { @@ -181,8 +182,8 @@ public class ControlFactory { /** * Creates a spacer control with the given span. - * The composite is assumed to have MGridLayout as - * layout. + * The composite is assumed to have {@link GridLayout} as layout. + * * @param parent The parent composite */ public static Control createEmptySpace(Composite parent, int span) { diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/DialogField.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/DialogField.java index c5b99479949..8b6dbcd82f6 100644 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/DialogField.java +++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/dialogfields/DialogField.java @@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.mi.internal.ui.dialogfields; import org.eclipse.core.runtime.Assert; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; @@ -153,6 +154,7 @@ public class DialogField { /** * Creates a spacer control. + * * @param parent The parent composite */ public static Control createEmptySpace(Composite parent) { @@ -161,8 +163,8 @@ public class DialogField { /** * Creates a spacer control with the given span. - * The composite is assumed to have MGridLayout as - * layout. + * The composite is assumed to have {@link GridLayout} as layout. + * * @param parent The parent composite */ public static Control createEmptySpace(Composite parent, int span) { diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogfields/DialogField.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogfields/DialogField.java index 6d4d4dd465a..8f90c758b5f 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogfields/DialogField.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogfields/DialogField.java @@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.internal.ui.dialogfields; import org.eclipse.core.runtime.Assert; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; @@ -153,6 +154,7 @@ public class DialogField { /** * Creates a spacer control. + * * @param parent The parent composite */ public static Control createEmptySpace(Composite parent) { @@ -161,8 +163,8 @@ public class DialogField { /** * Creates a spacer control with the given span. - * The composite is assumed to have MGridLayout as - * layout. + * The composite is assumed to have {@link GridLayout} as layout. + * * @param parent The parent composite */ public static Control createEmptySpace(Composite parent, int span) { -- cgit v1.2.3