1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2014-11-21 15:23:10 -08:00
parent 6c9b53ea60
commit 30c61470fb
21 changed files with 149 additions and 180 deletions

View file

@ -1974,7 +1974,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
// template <typename> struct foo {}; // template <typename> struct foo {};
// int main() { // int main() {
// typedef foo<int>::type type; // ERROR HERE: 'foo<int>::type' could not be // typedef foo<int>::type type;
// } // }
public void testSpecializationInIndex_367563a() throws Exception { public void testSpecializationInIndex_367563a() throws Exception {
getBindingFromASTName("type type", 4, ITypedef.class); getBindingFromASTName("type type", 4, ITypedef.class);
@ -1987,7 +1987,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
// template <typename> struct foo {}; // template <typename> struct foo {};
// int main() { // int main() {
// typedef foo<int*>::type type; // ERROR HERE: 'foo<int>::type' could not be // typedef foo<int*>::type type;
// } // }
public void testSpecializationInIndex_367563b() throws Exception { public void testSpecializationInIndex_367563b() throws Exception {
getBindingFromASTName("type type", 4, ITypedef.class); getBindingFromASTName("type type", 4, ITypedef.class);
@ -2008,7 +2008,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
// template <> struct foo<int> { // template <> struct foo<int> {
// typedef int type; // typedef int type;
// }; // };
// typedef foo<remove_const<const int>::type>::type t; // ERROR HERE // typedef foo<remove_const<const int>::type>::type t;
public void testCurrentInstanceOfClassTemplatePartialSpec_368404() throws Exception { public void testCurrentInstanceOfClassTemplatePartialSpec_368404() throws Exception {
ITypedef tdef= getBindingFromASTName("type t;", 4, ITypedef.class); ITypedef tdef= getBindingFromASTName("type t;", 4, ITypedef.class);
assertEquals("int", ASTTypeUtil.getType(tdef, true)); assertEquals("int", ASTTypeUtil.getType(tdef, true));
@ -2452,14 +2452,12 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
} }
// template <class T, class U> // template <class T, class U>
// struct multipliable2 // struct multipliable2 {
// {
// friend T operator *(const U& lhs, const T& rhs); // friend T operator *(const U& lhs, const T& rhs);
// }; // };
// //
// template <class T> // template <class T>
// struct multipliable1 // struct multipliable1 {
// {
// friend T operator *(const T& lhs, const T& rhs); // friend T operator *(const T& lhs, const T& rhs);
// }; // };
@ -2467,8 +2465,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
// //
// int foo(overloaded); // int foo(overloaded);
// //
// int main() // int main() {
// {
// overloaded c, d; // overloaded c, d;
// foo(c * d); // foo(c * d);
// } // }
@ -2477,14 +2474,12 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
} }
// template <class T, class U> // template <class T, class U>
// struct multipliable2 // struct multipliable2 {
// {
// friend T operator *(const U& lhs, const T& rhs); // friend T operator *(const U& lhs, const T& rhs);
// }; // };
// //
// template <class T> // template <class T>
// struct multipliable1 // struct multipliable1 {
// {
// friend T operator *(const T& lhs, const T& rhs) {} // friend T operator *(const T& lhs, const T& rhs) {}
// }; // };

View file

@ -81,7 +81,7 @@ public abstract class Openable extends Parent implements IOpenable {
Map<ICElement, CElementInfo> newElements, IResource underlyingResource) throws CModelException; Map<ICElement, CElementInfo> 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() { protected void closeBuffer() {
if (!hasBuffer()) return; // nothing to do 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 @Override
protected void closing(Object info) throws CModelException { protected void closing(Object info) throws CModelException {
@ -107,13 +107,13 @@ public abstract class Openable extends Parent implements IOpenable {
@Override @Override
public IBuffer getBuffer() throws CModelException { public IBuffer getBuffer() throws CModelException {
if (hasBuffer()) { if (hasBuffer()) {
// ensure element is open // Ensure element is open.
if (!isOpen()) { if (!isOpen()) {
getElementInfo(); getElementInfo();
} }
IBuffer buffer = getBufferManager().getBuffer(this); IBuffer buffer = getBufferManager().getBuffer(this);
if (buffer == null) { if (buffer == null) {
// try to (re)open a buffer // Try to (re)open a buffer.
buffer = openBuffer(null); buffer = openBuffer(null);
} }
return buffer; 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(){ public IBufferFactory getBufferFactory(){
return getBufferManager().getDefaultBufferFactory(); return getBufferManager().getDefaultBufferFactory();
@ -142,9 +142,7 @@ public abstract class Openable extends Parent implements IOpenable {
protected boolean hasBuffer() { protected boolean hasBuffer() {
return false; return false;
} }
/**
* @see org.eclipse.cdt.core.model.IOpenable#hasUnsavedChanges()
*/
@Override @Override
public boolean hasUnsavedChanges() throws CModelException{ public boolean hasUnsavedChanges() throws CModelException{
if (isReadOnly() || !isOpen()) { if (isReadOnly() || !isOpen()) {
@ -154,8 +152,8 @@ public abstract class Openable extends Parent implements IOpenable {
if (buf != null && buf.hasUnsavedChanges()) { if (buf != null && buf.hasUnsavedChanges()) {
return true; return true;
} }
// for roots and projects must check open buffers // For roots and projects must check open buffers to see
// to see if they have an child with unsaved changes // if they have an child with unsaved changes.
if (fType == C_MODEL || fType == C_PROJECT) { if (fType == C_MODEL || fType == C_PROJECT) {
Enumeration<IBuffer> openBuffers= getBufferManager().getOpenBuffers(); Enumeration<IBuffer> openBuffers= getBufferManager().getOpenBuffers();
while (openBuffers.hasMoreElements()) { while (openBuffers.hasMoreElements()) {
@ -182,9 +180,6 @@ public abstract class Openable extends Parent implements IOpenable {
return true; return true;
} }
/**
* @see org.eclipse.cdt.core.model.IOpenable#isOpen()
*/
@Override @Override
public boolean isOpen() { public boolean isOpen() {
return CModelManager.getDefault().getInfo(this) != null; 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. * Returns true if this represents a source element. Openable source elements have
* Openable source elements have an associated buffer created * an associated buffer created when they are opened.
* when they are opened.
*/ */
protected boolean isSourceElement() { protected boolean isSourceElement() {
return false; return false;
@ -215,13 +209,10 @@ public abstract class Openable extends Parent implements IOpenable {
@Override @Override
public void makeConsistent(IProgressMonitor monitor, boolean forced) throws CModelException { public void makeConsistent(IProgressMonitor monitor, boolean forced) throws CModelException {
// only translation units can be inconsistent // Only translation units can be inconsistent.
// other openables cannot be inconsistent so default is to do nothing // Other Openables cannot be inconsistent so default is to do nothing.
} }
/**
* @see org.eclipse.cdt.core.model.IOpenable#open(IProgressMonitor)
*/
@Override @Override
public void open(IProgressMonitor pm) throws CModelException { public void open(IProgressMonitor pm) throws CModelException {
getElementInfo(pm); 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 @Override
protected void generateInfos(CElementInfo info, Map<ICElement, CElementInfo> newElements, protected void generateInfos(CElementInfo info, Map<ICElement, CElementInfo> newElements,
IProgressMonitor monitor) throws CModelException { 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$ 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); openParent(info, newElements, monitor);
if (monitor != null && monitor.isCanceled()) if (monitor != null && monitor.isCanceled())
return; return;
// puts the info before building the structure so that questions to the handle behave as if the element existed // Put the info before building the structure so that questions to the handle behave as if
// (case of compilation units becoming working copies) // the element existed (case of compilation units becoming working copies).
newElements.put(this, info); 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 { try {
OpenableInfo openableInfo = (OpenableInfo) info; OpenableInfo openableInfo = (OpenableInfo) info;
boolean isStructureKnown = buildStructure(openableInfo, monitor, newElements, getResource()); boolean isStructureKnown = buildStructure(openableInfo, monitor, newElements, getResource());
@ -277,13 +265,10 @@ public abstract class Openable extends Parent implements IOpenable {
throw e; throw e;
} }
// remove out of sync buffer for this element // Remove out of sync buffer for this element.
CModelManager.getDefault().getElementsOutOfSynchWithBuffers().remove(this); CModelManager.getDefault().getElementsOutOfSynchWithBuffers().remove(this);
} }
/**
* @see org.eclipse.cdt.core.model.IOpenable#save(IProgressMonitor, boolean)
*/
@Override @Override
public void save(IProgressMonitor pm, boolean force) throws CModelException { public void save(IProgressMonitor pm, boolean force) throws CModelException {
IResource res = getResource(); IResource res = getResource();
@ -293,7 +278,7 @@ public abstract class Openable extends Parent implements IOpenable {
throw new CModelException(new CModelStatus(ICModelStatusConstants.READ_ONLY, this)); throw new CModelException(new CModelStatus(ICModelStatusConstants.READ_ONLY, this));
} }
} }
// check also the underlying resource // Check also the underlying resource.
if (isReadOnly()) { if (isReadOnly()) {
throw new CModelException(new CModelStatus(ICModelStatusConstants.READ_ONLY, this)); 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() { public SourceRoot getSourceRoot() {
ICElement current = this; ICElement current = this;

View file

@ -54,7 +54,7 @@ public interface ICompositeType extends IBinding, IType {
public IField findField(String name); 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(); public IScope getCompositeScope();
} }

View file

@ -137,40 +137,40 @@ public interface IScope {
} }
} }
public void setPrefixLookup(boolean prefixLookup) { public final void setPrefixLookup(boolean prefixLookup) {
fPrefixLookup = prefixLookup; fPrefixLookup = prefixLookup;
} }
public void setResolve(boolean resolve) { public final void setResolve(boolean resolve) {
fResolve = resolve; fResolve = resolve;
} }
public void setIgnorePointOfDeclaration(boolean ignorePointOfDeclaration) { public final void setIgnorePointOfDeclaration(boolean ignorePointOfDeclaration) {
fIgnorePointOfDeclaration = ignorePointOfDeclaration; fIgnorePointOfDeclaration = ignorePointOfDeclaration;
} }
public void setLookupKey(char[] key) { public final void setLookupKey(char[] key) {
fLookupKey= key; fLookupKey= key;
} }
public char[] getLookupKey() { public final char[] getLookupKey() {
return fLookupKey; return fLookupKey;
} }
public IASTNode getLookupPoint() { public final IASTNode getLookupPoint() {
return fLookupPoint; return fLookupPoint;
} }
public boolean isResolve() { public final boolean isResolve() {
return fResolve; return fResolve;
} }
public boolean isPrefixLookup() { public final boolean isPrefixLookup() {
return fPrefixLookup; return fPrefixLookup;
} }
public boolean isIgnorePointOfDeclaration() { public final boolean isIgnorePointOfDeclaration() {
return fIgnorePointOfDeclaration; return fIgnorePointOfDeclaration;
} }
public IIndexFileSet getIncludedFiles() { public final IIndexFileSet getIncludedFiles() {
return fTu == null ? IIndexFileSet.EMPTY : fTu.getIndexFileSet(); return fTu == null ? IIndexFileSet.EMPTY : fTu.getIndexFileSet();
} }
public IIndex getIndex() { public final IIndex getIndex() {
return fTu == null ? null : fTu.getIndex(); return fTu == null ? null : fTu.getIndex();
} }
public IASTName getLookupName() { public final IASTName getLookupName() {
return fLookupPointIsName ? (IASTName) fLookupPoint : null; return fLookupPointIsName ? (IASTName) fLookupPoint : null;
} }
public IASTTranslationUnit getTranslationUnit() { public IASTTranslationUnit getTranslationUnit() {

View file

@ -17,7 +17,6 @@ package org.eclipse.cdt.core.dom.ast.cpp;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPClassTemplatePartialSpecializationSpecialization extends public interface ICPPClassTemplatePartialSpecializationSpecialization
ICPPClassTemplatePartialSpecialization, ICPPClassSpecialization { extends ICPPClassTemplatePartialSpecialization, ICPPClassSpecialization {
} }

View file

@ -31,7 +31,7 @@ public interface ICPPTemplateInstance extends ICPPSpecialization {
ICPPTemplateInstance[] EMPTY_TEMPLATE_INSTANCE_ARRAY = {}; 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(); public ICPPTemplateDefinition getTemplateDefinition();
@ -43,7 +43,7 @@ public interface ICPPTemplateInstance extends ICPPSpecialization {
/** /**
* Explicit specializations are modeled as instances of a template. * Explicit specializations are modeled as instances of a template.
* Returns <code>true</code> if this binding is an explicit specialization. * Returns {@code true} if this binding is an explicit specialization.
* @since 5.2 * @since 5.2
*/ */
public boolean isExplicitSpecialization(); public boolean isExplicitSpecialization();

View file

@ -31,7 +31,7 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* C-specific implementation of a translation unit. * C-specific implementation of a translation unit.
*/ */
public class CASTTranslationUnit extends ASTTranslationUnit implements IASTAmbiguityParent { public class CASTTranslationUnit extends ASTTranslationUnit implements IASTAmbiguityParent {
private CScope compilationUnit = null; private CScope compilationUnit;
private final CStructMapper fStructMapper; private final CStructMapper fStructMapper;
public CASTTranslationUnit() { public CASTTranslationUnit() {
@ -78,11 +78,6 @@ public class CASTTranslationUnit extends ASTTranslationUnit implements IASTAmbig
return ArrayUtil.removeNulls(IASTName.class, names); 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 @Override
public IASTName[] getReferences(IBinding binding) { public IASTName[] getReferences(IBinding binding) {
if (binding instanceof IMacroBinding) if (binding instanceof IMacroBinding)

View file

@ -32,39 +32,33 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
* Implementation of scope for structs and unions. * Implementation of scope for structs and unions.
*/ */
public class CCompositeTypeScope extends CScope implements ICCompositeTypeScope { public class CCompositeTypeScope extends CScope implements ICCompositeTypeScope {
public CCompositeTypeScope( ICASTCompositeTypeSpecifier compTypeSpec ){ public CCompositeTypeScope(ICASTCompositeTypeSpecifier compTypeSpec) {
super( compTypeSpec, EScopeKind.eClassType); super(compTypeSpec, EScopeKind.eClassType);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICCompositeTypeScope#getBinding(char[])
*/
@Override @Override
public IBinding getBinding( char[] name ) { public IBinding getBinding(char[] name) {
return super.getBinding( NAMESPACE_TYPE_OTHER, name ); return super.getBinding(NAMESPACE_TYPE_OTHER, name);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
*/
@Override @Override
public IBinding[] find( String name ) { public IBinding[] find(String name) {
CollectNamesAction action = new CollectNamesAction( name.toCharArray() ); CollectNamesAction action = new CollectNamesAction(name.toCharArray());
getPhysicalNode().accept( action ); getPhysicalNode().accept(action);
IASTName [] names = action.getNames(); IASTName[] names = action.getNames();
IBinding [] result = null; IBinding[] result = null;
for (IASTName astName : names) { for (IASTName astName : names) {
IBinding b = astName.resolveBinding(); IBinding b = astName.resolveBinding();
if( b == null ) continue; if (b == null) continue;
try { try {
if( b.getScope() == this ) if (b.getScope() == this)
result = ArrayUtil.append( IBinding.class, result, b ); result = ArrayUtil.append(IBinding.class, result, b);
} catch ( DOMException e ) { } catch (DOMException e) {
} }
} }
return ArrayUtil.trim( IBinding.class, result ); return ArrayUtil.trim(IBinding.class, result);
} }
@Override @Override
@ -74,7 +68,7 @@ public class CCompositeTypeScope extends CScope implements ICCompositeTypeScope
if (binding instanceof ICompositeType) if (binding instanceof ICompositeType)
return (ICompositeType) binding; 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 @Override

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -166,12 +166,15 @@ public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPAST
fScopeMapper.registerAdditionalDirectives(offset, fileContent.getUsingDirectives()); fScopeMapper.registerAdditionalDirectives(offset, fileContent.getUsingDirectives());
} }
// bug 217102: namespace scopes from the index have to be mapped back to the AST. // Namespace scopes from the index have to be mapped back to the AST (bug 217102).
public IScope mapToASTScope(IIndexScope scope) { public IScope mapToASTScope(IScope scope) {
return fScopeMapper.mapToASTScope(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) { public ICPPClassType mapToAST(ICPPClassType binding, IASTNode point) {
return fScopeMapper.mapToAST(binding, point); return fScopeMapper.mapToAST(binding, point);
} }

View file

@ -1,4 +1,4 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009, 2011 Wind River Systems, Inc. and others. * Copyright (c) 2009, 2011 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * 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 ICPPClassTemplate fClassTemplate;
private final ICPPTemplateArgument[] fArguments; private final ICPPTemplateArgument[] fArguments;
public CPPClassTemplatePartialSpecializationSpecialization(ICPPClassTemplatePartialSpecialization orig, ICPPTemplateParameterMap argumentMap, ICPPClassTemplate template, public CPPClassTemplatePartialSpecializationSpecialization(ICPPClassTemplatePartialSpecialization orig,
ICPPTemplateParameterMap argumentMap, ICPPClassTemplate template,
ICPPTemplateArgument[] args) throws DOMException { ICPPTemplateArgument[] args) throws DOMException {
super(orig, template.getOwner(), argumentMap); super(orig, template.getOwner(), argumentMap);
fClassTemplate= template; fClassTemplate= template;

View file

@ -41,10 +41,10 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalUnknownScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding; 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 * Helper class for performing the base class lookup. First a directed graph without loops is
* to represent the base class hierarchy up to those bases for which the lookup finds matches. Next, from * computed to represent the base class hierarchy up to those bases for which the lookup finds
* these leaves we search for virtual bases that are hidden. With this information the matches are extracted * matches. Next, from these leaves we search for virtual bases that are hidden. With this
* from the graph. * information the matches are extracted from the graph.
*/ */
class BaseClassLookup { class BaseClassLookup {
public static void lookupInBaseClasses(LookupData data, ICPPClassScope classScope) { public static void lookupInBaseClasses(LookupData data, ICPPClassScope classScope) {
@ -55,7 +55,7 @@ class BaseClassLookup {
if (classType == null) if (classType == null)
return; return;
final HashMap<IScope, BaseClassLookup> infoMap = new HashMap<IScope, BaseClassLookup>(); final HashMap<IScope, BaseClassLookup> infoMap = new HashMap<>();
BaseClassLookup rootInfo= lookupInBaseClass(data, null, false, classType, infoMap, 0); BaseClassLookup rootInfo= lookupInBaseClass(data, null, false, classType, infoMap, 0);
if (data.contentAssist) { if (data.contentAssist) {
rootInfo.collectResultForContentAssist(data); rootInfo.collectResultForContentAssist(data);
@ -108,7 +108,7 @@ class BaseClassLookup {
return; return;
if (fChildren.isEmpty()) { if (fChildren.isEmpty()) {
fChildren= new ArrayList<BaseClassLookup>(); fChildren= new ArrayList<>();
fVirtual= new BitSet(); fVirtual= new BitSet();
} }
fVirtual.set(fChildren.size(), virtual); fVirtual.set(fChildren.size(), virtual);
@ -156,7 +156,7 @@ class BaseClassLookup {
if (baseClassScope != null) { if (baseClassScope != null) {
BaseClassLookup info= infoMap.get(baseClassScope); BaseClassLookup info= infoMap.get(baseClassScope);
if (info != null) { if (info != null) {
// avoid loops // Avoid loops.
if (info.getResult() == null) { if (info.getResult() == null) {
data.problem = new ProblemBinding(null, IProblemBinding.SEMANTIC_CIRCULAR_INHERITANCE, data.problem = new ProblemBinding(null, IProblemBinding.SEMANTIC_CIRCULAR_INHERITANCE,
root.getNameCharArray()); root.getNameCharArray());
@ -204,12 +204,12 @@ class BaseClassLookup {
} }
} }
} catch (DOMException e) { } 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 // There is no result in the baseClass itself or we do content assist, we have to examine
// base-classes // its base classes.
ICPPClassType baseClass= result.getClassType(); ICPPClassType baseClass= result.getClassType();
if (baseClass != null) { if (baseClass != null) {
ICPPBase[] grandBases= ClassTypeHelper.getBases(baseClass, data.getLookupPoint()); ICPPBase[] grandBases= ClassTypeHelper.getBases(baseClass, data.getLookupPoint());
@ -217,9 +217,9 @@ class BaseClassLookup {
HashSet<IBinding> grandBaseBindings= null; HashSet<IBinding> grandBaseBindings= null;
BitSet selectedBases= null; BitSet selectedBases= null;
if (grandBases.length > 1) { if (grandBases.length > 1) {
grandBaseBindings= new HashSet<IBinding>(); 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); selectedBases = selectPreferredBases(data, grandBases);
} }
for (int i = 0; i < grandBases.length; i++) { for (int i = 0; i < grandBases.length; i++) {
@ -229,7 +229,7 @@ class BaseClassLookup {
IBinding grandBaseBinding = grandBase.getBaseClass(); IBinding grandBaseBinding = grandBase.getBaseClass();
if (!(grandBaseBinding instanceof ICPPClassType)) { 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 (grandBaseBinding instanceof ICPPUnknownBinding) {
if (data.skippedScope == null) if (data.skippedScope == null)
data.skippedScope= root; data.skippedScope= root;
@ -247,7 +247,7 @@ class BaseClassLookup {
final IScope grandBaseScope= grandBaseClass.getCompositeScope(); final IScope grandBaseScope= grandBaseClass.getCompositeScope();
if (grandBaseScope == null || grandBaseScope instanceof ICPPInternalUnknownScope) { 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) if (data.skippedScope == null)
data.skippedScope= root; data.skippedScope= root;
continue; continue;
@ -335,7 +335,7 @@ class BaseClassLookup {
} }
baseInfo.propagateHiddenAsVirtual(); baseInfo.propagateHiddenAsVirtual();
} else { } else {
// mark to catch recursions // Mark to catch recursions.
baseInfo= new BaseClassLookup(baseClass, fLookupPoint); baseInfo= new BaseClassLookup(baseClass, fLookupPoint);
infoMap.put(baseScope, baseInfo); infoMap.put(baseScope, baseInfo);
baseInfo.hideVirtualBases(infoMap, depth); baseInfo.hideVirtualBases(infoMap, depth);

View file

@ -152,7 +152,8 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
public IBinding[] getBindings(ScopeLookupData lookup) { public IBinding[] getBindings(ScopeLookupData lookup) {
try { try {
if (lookup.getLookupName() instanceof ICPPASTConversionName) { 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); acceptViaCache(fBinding, visitor, true);
return visitor.getBindings(); return visitor.getBindings();
} }
@ -171,10 +172,11 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
return getBindingsViaCache(fBinding, nameChars, IndexFilter.CPP_DECLARED_OR_IMPLICIT_NO_INSTANCE); return getBindingsViaCache(fBinding, nameChars, IndexFilter.CPP_DECLARED_OR_IMPLICIT_NO_INSTANCE);
} }
// prefix lookup // Prefix lookup.
BindingCollector visitor = new BindingCollector(fBinding.getLinkage(), nameChars, IndexFilter.CPP_DECLARED_OR_IMPLICIT_NO_INSTANCE, true, true, !true); BindingCollector visitor = new BindingCollector(fBinding.getLinkage(), nameChars,
IndexFilter.CPP_DECLARED_OR_IMPLICIT_NO_INSTANCE, true, true, false);
if (ContentAssistMatcherFactory.getInstance().match(nameChars, fBinding.getNameCharArray())) { 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()); visitor.visit((IPDOMNode) getClassNameBinding());
} }
acceptViaCache(fBinding, visitor, true); acceptViaCache(fBinding, visitor, true);

View file

@ -53,8 +53,8 @@ import org.eclipse.core.runtime.CoreException;
/** /**
* @author Bryan Wilkinson * @author Bryan Wilkinson
*/ */
class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements class PDOMCPPClassSpecialization extends PDOMCPPSpecialization
ICPPClassSpecialization, IPDOMMemberOwner, IPDOMCPPClassType { implements ICPPClassSpecialization, IPDOMMemberOwner, IPDOMCPPClassType {
private static final int FIRST_BASE = PDOMCPPSpecialization.RECORD_SIZE + 0; private static final int FIRST_BASE = PDOMCPPSpecialization.RECORD_SIZE + 0;
private static final int MEMBERLIST = FIRST_BASE + 4; private static final int MEMBERLIST = FIRST_BASE + 4;
private static final int FINAL = MEMBERLIST + PDOMCPPMemberBlock.RECORD_SIZE; // byte 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; protected static final int RECORD_SIZE = FINAL + 1;
private volatile ICPPClassScope fScope; 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<Set<IBinding>> fInProgress= new ThreadLocal<Set<IBinding>>() { private final ThreadLocal<Set<IBinding>> fInProgress= new ThreadLocal<Set<IBinding>>() {
@Override @Override
protected Set<IBinding> initialValue() { protected Set<IBinding> initialValue() {
return new HashSet<IBinding>(); return new HashSet<>();
} }
}; };
@ -257,7 +257,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
return bases; return bases;
try { try {
List<PDOMCPPBase> list = new ArrayList<PDOMCPPBase>(); List<PDOMCPPBase> list = new ArrayList<>();
for (PDOMCPPBase base = getFirstBase(); base != null; base = base.getNextBase()) { for (PDOMCPPBase base = getFirstBase(); base != null; base = base.getNextBase()) {
list.add(base); list.add(base);
} }

View file

@ -66,7 +66,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
setKind(classType); setKind(classType);
setAnonymous(classType); setAnonymous(classType);
setFinal(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) { public PDOMCPPClassType(PDOMLinkage linkage, long bindingRecord) {

View file

@ -11,6 +11,32 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.ui.refactoring.rename; 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.osgi.util.NLS;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange; 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.ToolBar;
import org.eclipse.swt.widgets.ToolItem; import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Tracker; 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.IPartListener2;
import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartReference; 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) { UIJob delayJob= new UIJob(display, RenameMessages.RenameInformationPopup_delayJobName) {
@Override @Override
public IStatus runInUIThread(IProgressMonitor monitor) { public IStatus runInUIThread(IProgressMonitor monitor) {

View file

@ -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.IDocCommentOwner;
import org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration; import org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration;
abstract class AbstractDocCommentProposalComputer implements ICompletionProposalComputer { abstract class AbstractDocCommentProposalComputer implements ICompletionProposalComputer {
protected abstract IDocCommentViewerConfiguration getConfiguration(IDocCommentOwner owner); protected abstract IDocCommentViewerConfiguration getConfiguration(IDocCommentOwner owner);
@ -58,15 +57,12 @@ abstract class AbstractDocCommentProposalComputer implements ICompletionProposal
@Override @Override
public void sessionEnded() { public void sessionEnded() {
// XXX
} }
@Override @Override
public void sessionStarted() { public void sessionStarted() {
// XXX
} }
private static IResource getResource() { private static IResource getResource() {
ITranslationUnit tu= getTranslationUnit(); ITranslationUnit tu= getTranslationUnit();
return tu.getResource(); return tu.getResource();

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.ui.wizards.dialogfields;
import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
@ -144,6 +145,7 @@ public class DialogField {
/** /**
* Creates a spacer control. * Creates a spacer control.
*
* @param parent The parent composite * @param parent The parent composite
*/ */
public static Control createEmptySpace(Composite parent) { public static Control createEmptySpace(Composite parent) {
@ -152,8 +154,8 @@ public class DialogField {
/** /**
* Creates a spacer control with the given span. * Creates a spacer control with the given span.
* The composite is assumed to have <code>MGridLayout</code> as * The composite is assumed to have {@link GridLayout} as layout.
* layout. *
* @param parent The parent composite * @param parent The parent composite
*/ */
public static Control createEmptySpace(Composite parent, int span) { public static Control createEmptySpace(Composite parent, int span) {

View file

@ -173,6 +173,7 @@ public class ControlFactory {
/** /**
* Creates a spacer control. * Creates a spacer control.
*
* @param parent The parent composite * @param parent The parent composite
*/ */
public static Control createEmptySpace(Composite parent) { public static Control createEmptySpace(Composite parent) {
@ -181,8 +182,8 @@ public class ControlFactory {
/** /**
* Creates a spacer control with the given span. * Creates a spacer control with the given span.
* The composite is assumed to have <code>MGridLayout</code> as * The composite is assumed to have {@link GridLayout} as layout.
* layout. *
* @param parent The parent composite * @param parent The parent composite
*/ */
public static Control createEmptySpace(Composite parent, int span) { public static Control createEmptySpace(Composite parent, int span) {

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.mi.internal.ui.dialogfields;
import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
@ -153,6 +154,7 @@ public class DialogField {
/** /**
* Creates a spacer control. * Creates a spacer control.
*
* @param parent The parent composite * @param parent The parent composite
*/ */
public static Control createEmptySpace(Composite parent) { public static Control createEmptySpace(Composite parent) {
@ -161,8 +163,8 @@ public class DialogField {
/** /**
* Creates a spacer control with the given span. * Creates a spacer control with the given span.
* The composite is assumed to have <code>MGridLayout</code> as * The composite is assumed to have {@link GridLayout} as layout.
* layout. *
* @param parent The parent composite * @param parent The parent composite
*/ */
public static Control createEmptySpace(Composite parent, int span) { public static Control createEmptySpace(Composite parent, int span) {

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.internal.ui.dialogfields;
import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
@ -153,6 +154,7 @@ public class DialogField {
/** /**
* Creates a spacer control. * Creates a spacer control.
*
* @param parent The parent composite * @param parent The parent composite
*/ */
public static Control createEmptySpace(Composite parent) { public static Control createEmptySpace(Composite parent) {
@ -161,8 +163,8 @@ public class DialogField {
/** /**
* Creates a spacer control with the given span. * Creates a spacer control with the given span.
* The composite is assumed to have <code>MGridLayout</code> as * The composite is assumed to have {@link GridLayout} as layout.
* layout. *
* @param parent The parent composite * @param parent The parent composite
*/ */
public static Control createEmptySpace(Composite parent, int span) { public static Control createEmptySpace(Composite parent, int span) {