1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2014-04-23 19:05:49 -07:00
parent f7f3825ef8
commit 8f2ea4c665
11 changed files with 45 additions and 54 deletions

View file

@ -28,10 +28,11 @@ public interface IType extends Cloneable {
public Object clone();
/**
* Test whether this type is the same as the given one. A typedef is considered to be the same type as
* it's target type.
* See {@link ICPPTemplateTemplateParameter#isSameType(IType)} or {@link ICPPTemplateTypeParameter#isSameType(IType)}
* for the semantics of comparing template parameters denoting types.
* Test whether this type is the same as the given one. A typedef is considered to be the same
* type as it's target type.
* See {@link ICPPTemplateTemplateParameter#isSameType(IType)} or
* {@link ICPPTemplateTypeParameter#isSameType(IType)} for the semantics of comparing template
* parameters denoting types.
*/
public boolean isSameType(IType type);
}

View file

@ -44,7 +44,7 @@ public interface ICPPBase extends Cloneable {
public IType getBaseClassType();
/**
* @deprecated don't use it, a base class may be specified without the use of a name.
* @deprecated Don't use it, a base class may be specified without the use of a name.
*/
@Deprecated
public IName getBaseClassSpecifierName();
@ -57,11 +57,9 @@ public interface ICPPBase extends Cloneable {
/**
* The visibility qualifier applied to the base class.
*
*/
public int getVisibility();
/**
* Whether this is a virtual base class.
*/

View file

@ -21,7 +21,7 @@ public interface ICPPClassScope extends ICPPScope {
/**
* Returns the binding for the class this scope is associated with.
*/
ICPPClassType getClassType();
public ICPPClassType getClassType();
/**
* Returns an array of methods that were implicitly added to this class

View file

@ -116,17 +116,15 @@ public class SemanticQueries {
* we need to be able to keep track of more than one at a time.
*/
private static class FinalOverriderMap {
private Map<ICPPMethod, Map<Integer, List<ICPPMethod>>> fMap
= new HashMap<ICPPMethod, Map<Integer, List<ICPPMethod>>>();
private Map<ICPPMethod, Map<Integer, List<ICPPMethod>>> fMap = new HashMap<>();
/**
* Add 'overrider' as a final ovverider of 'method' in subobject
* 'subobjectNumber'.
* Add 'overrider' as a final overrider of 'method' in subobject 'subobjectNumber'.
*/
public void add(ICPPMethod method, int subobjectNumber, ICPPMethod overrider) {
Map<Integer, List<ICPPMethod>> overriders = fMap.get(method);
if (overriders == null) {
overriders = new HashMap<Integer, List<ICPPMethod>>();
overriders = new HashMap<>();
fMap.put(method, overriders);
}
CollectionUtils.listMapGet(overriders, subobjectNumber).add(overrider);
@ -154,7 +152,7 @@ public class SemanticQueries {
for (ICPPMethod method : other.fMap.keySet()) {
Map<Integer, List<ICPPMethod>> overriders = fMap.get(method);
if (overriders == null) {
overriders = new HashMap<Integer, List<ICPPMethod>>();
overriders = new HashMap<>();
fMap.put(method, overriders);
}
Map<Integer, List<ICPPMethod>> otherOverriders = other.fMap.get(method);
@ -171,7 +169,7 @@ public class SemanticQueries {
* which is themself, meaning they have not been overridden.
*/
public ICPPMethod[] collectPureVirtualMethods() {
List<ICPPMethod> pureVirtualMethods = new ArrayList<ICPPMethod>();
List<ICPPMethod> pureVirtualMethods = new ArrayList<>();
for (ICPPMethod method : fMap.keySet()) {
if (method.isPureVirtual()) {
Map<Integer, List<ICPPMethod>> finalOverriders = fMap.get(method);
@ -190,12 +188,12 @@ public class SemanticQueries {
// The last subobject number used for each type in the hierarchy. This is used to
// assign subobject numbers to subobjects. Virtual subobjects get a subobject
// number of zero, while non-virtual subobjects are number starting from one.
private Map<ICPPClassType, Integer> subobjectNumbers = new HashMap<ICPPClassType, Integer>();
private Map<ICPPClassType, Integer> subobjectNumbers = new HashMap<>();
// Cache of final overrider maps for virtual base subobjects. Since such subobjects
// only occur once in the hierarchy, we can cache the final overrider maps we
// compute for them.
private Map<ICPPClassType, FinalOverriderMap> virtualBaseCache = new HashMap<ICPPClassType, FinalOverriderMap>();
private Map<ICPPClassType, FinalOverriderMap> virtualBaseCache = new HashMap<>();
public ICPPMethod[] collect(ICPPClassType root, IASTNode point) {
FinalOverriderMap finalOverriderMap = collectFinalOverriders(root, false, new HashSet<ICPPClassType>(),

View file

@ -63,27 +63,17 @@ public class CPPBaseClause implements ICPPBase, ICPPInternalBase {
return baseClass;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBase#getVisibility()
*/
@Override
public int getVisibility() {
int vis = base.getVisibility();
if (vis == 0) {
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) base.getParent();
int key = compSpec.getKey();
if (key == ICPPClassType.k_class)
vis = ICPPBase.v_private;
else
vis = ICPPBase.v_public;
vis = compSpec.getKey() == ICPPClassType.k_class ? ICPPBase.v_private : ICPPBase.v_public;
}
return vis;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBase#isVirtual()
*/
@Override
public boolean isVirtual() {
return base.isVirtual();
@ -105,9 +95,6 @@ public class CPPBaseClause implements ICPPBase, ICPPInternalBase {
return base.getName();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBase#getClassDefinitionName()
*/
@Override
public IName getClassDefinitionName() {
IASTNode parent = base.getParent();

View file

@ -44,10 +44,9 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
/**
* A template template parameter.
*/
public class CPPTemplateTemplateParameter extends CPPTemplateParameter implements
ICPPTemplateTemplateParameter, ICPPInternalTemplate, ICPPUnknownBinding,
public class CPPTemplateTemplateParameter extends CPPTemplateParameter
implements ICPPTemplateTemplateParameter, ICPPInternalTemplate, ICPPUnknownBinding,
ICPPUnknownType {
private ICPPTemplateParameter[] templateParameters;
private ObjectMap instances;
private ICPPScope unknownScope;
@ -139,30 +138,37 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
public ICPPBase[] getBases() {
return ICPPBase.EMPTY_BASE_ARRAY;
}
@Override
public IField[] getFields() {
return IField.EMPTY_FIELD_ARRAY;
}
@Override
public IField findField(String name) {
return null;
}
@Override
public ICPPField[] getDeclaredFields() {
return ICPPField.EMPTY_CPPFIELD_ARRAY;
}
@Override
public ICPPMethod[] getMethods() {
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
}
@Override
public ICPPMethod[] getAllDeclaredMethods() {
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
}
@Override
public ICPPMethod[] getDeclaredMethods() {
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
}
@Override
public ICPPConstructor[] getConstructors() {
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
@ -171,6 +177,7 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
public IBinding[] getFriends() {
return IBinding.EMPTY_BINDING_ARRAY;
}
@Override
public ICPPClassType[] getNestedClasses() {
return ICPPClassType.EMPTY_CLASS_ARRAY;

View file

@ -187,16 +187,17 @@ public class ClassTypeHelper {
return ICPPBase.EMPTY_BASE_ARRAY;
}
}
ICPPASTBaseSpecifier[] bases = host.getCompositeTypeSpecifier().getBaseSpecifiers();
if (bases.length == 0)
ICPPASTBaseSpecifier[] baseSpecifiers = host.getCompositeTypeSpecifier().getBaseSpecifiers();
if (baseSpecifiers.length == 0)
return ICPPBase.EMPTY_BASE_ARRAY;
ICPPBase[] bindings = new ICPPBase[bases.length];
for (int i = 0; i < bases.length; i++) {
bindings[i] = new CPPBaseClause(bases[i]);
ICPPBase[] bases = new ICPPBase[baseSpecifiers.length];
for (int i = 0; i < baseSpecifiers.length; i++) {
bases[i] = new CPPBaseClause(baseSpecifiers[i]);
}
return bindings;
return bases;
}
public static ICPPField[] getDeclaredFields(ICPPInternalClassTypeMixinHost host) {

View file

@ -15,13 +15,12 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
/**
* @author Bryan Wilkinson
*
*/
public interface ICPPInternalBase extends Cloneable {
public Object clone();
/**
* Set the base class.
* Sets the base class.
*/
public void setBaseClass(IBinding binding) throws DOMException;
}

View file

@ -94,13 +94,13 @@ class PDOMCPPUsingDeclaration extends PDOMCPPBinding implements ICPPUsingDeclara
do {
IBinding delegate = alias.getBinding();
if (delegate != null) {
delegates= ArrayUtil.appendAt(IBinding.class, delegates, i++, delegate);
delegates= ArrayUtil.appendAt(delegates, i++, delegate);
}
} while ((alias = alias.getNext()) != null);
} catch (CoreException e) {
CCorePlugin.log(e);
}
delegates = ArrayUtil.trim(IBinding.class, delegates);
delegates = ArrayUtil.trim(delegates, i);
}
return delegates;
}