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

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-07-27 10:40:34 -07:00
parent 3427d95db8
commit acc49b9da2
7 changed files with 43 additions and 47 deletions

View file

@ -23,7 +23,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPUsingDirective {
ICPPUsingDirective[] EMPTY_ARRAY = new ICPPUsingDirective[0];
/**

View file

@ -24,7 +24,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
import org.eclipse.core.runtime.CoreException;
/**
* Integral c++ type.
* Built-in c++ type.
*/
public class CPPBasicType implements ICPPBasicType, ISerializableType {
public static final CPPBasicType BOOLEAN = new CPPBasicType(Kind.eBoolean, 0, null);
@ -35,9 +35,9 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
public CPPBasicType(Kind kind, int qualifiers, IASTExpression expression) {
if (kind == Kind.eUnspecified) {
if ( (qualifiers & (IS_COMPLEX | IS_IMAGINARY)) != 0) {
if ((qualifiers & (IS_COMPLEX | IS_IMAGINARY)) != 0) {
fKind= Kind.eFloat;
} else if ( (qualifiers & (IS_LONG | IS_SHORT | IS_SIGNED | IS_UNSIGNED | IS_LONG_LONG)) != 0 ) {
} else if ((qualifiers & (IS_LONG | IS_SHORT | IS_SIGNED | IS_UNSIGNED | IS_LONG_LONG)) != 0) {
fKind= Kind.eInt;
} else {
fKind= Kind.eUnspecified;
@ -54,18 +54,18 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
}
public CPPBasicType(ICPPASTSimpleDeclSpecifier sds) {
this (getKind(sds), getModifiers(sds), null);
this(getKind(sds), getModifiers(sds), null);
}
private static int getModifiers(ICPPASTSimpleDeclSpecifier sds) {
return
( sds.isLong() ? IBasicType.IS_LONG : 0 ) |
( sds.isShort() ? IBasicType.IS_SHORT : 0 ) |
( sds.isSigned() ? IBasicType.IS_SIGNED: 0 ) |
( sds.isUnsigned()? IBasicType.IS_UNSIGNED : 0 ) |
( sds.isLongLong()? IBasicType.IS_LONG_LONG : 0 ) |
( sds.isComplex() ? IBasicType.IS_COMPLEX : 0 ) |
( sds.isImaginary()?IBasicType.IS_IMAGINARY : 0 );
(sds.isLong() ? IBasicType.IS_LONG : 0) |
(sds.isShort() ? IBasicType.IS_SHORT : 0) |
(sds.isSigned() ? IBasicType.IS_SIGNED: 0) |
(sds.isUnsigned() ? IBasicType.IS_UNSIGNED : 0) |
(sds.isLongLong() ? IBasicType.IS_LONG_LONG : 0) |
(sds.isComplex() ? IBasicType.IS_COMPLEX : 0) |
(sds.isImaginary() ? IBasicType.IS_IMAGINARY : 0);
}
private static Kind getKind(ICPPASTSimpleDeclSpecifier sds) {
@ -73,7 +73,7 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
}
static Kind getKind(final int simpleDeclSpecType) {
switch(simpleDeclSpecType) {
switch (simpleDeclSpecType) {
case IASTSimpleDeclSpecifier.t_bool:
return Kind.eBoolean;
case IASTSimpleDeclSpecifier.t_char:
@ -97,7 +97,6 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
}
}
public boolean isSameType(IType object) {
if (object == this)
return true;
@ -208,13 +207,11 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
return new CPPBasicType(Kind.values()[kind], modifiers);
}
@Deprecated
public int getQualifierBits() {
return getModifiers();
}
@Deprecated
public int getType() {
switch (fKind) {
@ -239,6 +236,7 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
}
return t_unspecified;
}
/**
* @deprecated types don't have values
*/

View file

@ -67,7 +67,7 @@ public abstract class CompositeIndexBinding implements IIndexBinding {
}
public String[] getQualifiedName() {
return new String[] {getName()};
return new String[] { getName() };
}
public IIndexScope getScope() {
@ -88,7 +88,7 @@ public abstract class CompositeIndexBinding implements IIndexBinding {
}
public boolean isFileLocal() throws CoreException {
return rbinding != null ? rbinding.isFileLocal() : false;
return rbinding != null && rbinding.isFileLocal();
}
public IIndexFile getLocalToFile() throws CoreException {

View file

@ -103,7 +103,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
ICPPNamespace[] namespaces;
if (rscope instanceof CompositeCPPNamespace) {
// avoid duplicating the search
namespaces = ((CompositeCPPNamespace)rscope).namespaces;
namespaces = ((CompositeCPPNamespace) rscope).namespaces;
} else {
namespaces = getNamespaces(rscope.getScopeBinding());
}
@ -233,7 +233,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
}
protected IIndexFragmentBinding findOneBinding(IBinding binding) {
return super.findOneBinding(binding, false);
return findOneBinding(binding, false);
}
/* (non-Javadoc)
@ -259,7 +259,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof ICPPFunction) {
return new CompositeCPPFunctionInstance(this, (ICPPFunction) binding);
} else {
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
} else if (binding instanceof ICPPTemplateDefinition) {
@ -276,7 +276,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof ICPPFunctionType) {
return new CompositeCPPFunctionTemplateSpecialization(this, (ICPPFunction) binding);
} else {
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
}
} else {
if (binding instanceof ICPPClassType) {
@ -294,7 +294,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof ITypedef) {
return new CompositeCPPTypedefSpecialization(this, (ICPPBinding) binding);
} else {
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
} else if(binding instanceof ICPPTemplateParameter) {
@ -305,7 +305,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof ICPPTemplateTemplateParameter) {
result = new CompositeCPPTemplateTemplateParameter(this, (ICPPTemplateTemplateParameter) binding);
} else {
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
}
} else if (binding instanceof ICPPTemplateDefinition) {
if (binding instanceof ICPPClassTemplate) {
@ -318,7 +318,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof ICPPFunctionTemplate) {
return new CompositeCPPFunctionTemplate(this, (ICPPFunction) binding);
} else {
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
}
} else if (binding instanceof ICPPParameter) {
result = new CompositeCPPParameter(this, (ICPPParameter) binding);
@ -360,7 +360,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof IIndexMacroContainer) {
result= new CompositeMacroContainer(this, binding);
} else {
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
}
} catch(CoreException ce) {
CCorePlugin.log(ce);
@ -385,7 +385,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
int result = 1;
result = prime * result + (int) (i ^ (i >>> 32));
result = prime * result + j;
result = prime * result + (int)k;
result = prime * result + (int) k;
return result;
}
@Override
@ -398,7 +398,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
}
}
public static Object createInstanceCacheKey(ICompositesFactory cf,IIndexFragmentBinding rbinding) {
public static Object createInstanceCacheKey(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
return new Key(Thread.currentThread().getId(), cf.hashCode(), rbinding.getBindingID());
}
public static Object createSpecializationKey(ICompositesFactory cf,IIndexFragmentBinding rbinding) {

View file

@ -24,13 +24,13 @@ import org.eclipse.core.runtime.CoreException;
public interface IPDOMCPPClassType extends ICPPClassType, IPDOMBinding, IIndexType {
/**
* Visit the children of the class type without using the cache. This method is
* Visits the children of the class type without using the cache. This method is
* used to populate the cache.
*/
void acceptUncached(IPDOMVisitor visitor) throws CoreException;
/**
* Return the scope name, for use in {@link IScope#getScopeName()}
* Returns the scope name, for use in {@link IScope#getScopeName()}
*/
IIndexName getScopeName();
}

View file

@ -147,7 +147,7 @@ class PDOMCPPNamespace extends PDOMCPPBinding
}
public ICPPUsingDirective[] getUsingDirectives() {
return new ICPPUsingDirective[0];
return ICPPUsingDirective.EMPTY_ARRAY;
}
public IBinding[] find(String name) {

View file

@ -72,7 +72,7 @@ public class LineSearchElement extends PDOMSearchElement {
if (!(obj instanceof Match))
return false;
Match m = (Match) obj;
return (fOffset == m.fOffset) && (fLength == m.fLength);
return fOffset == m.fOffset && fLength == m.fLength;
}
@Override
@ -142,7 +142,7 @@ public class LineSearchElement extends PDOMSearchElement {
if (!(obj instanceof LineSearchElement))
return false;
LineSearchElement other = (LineSearchElement) obj;
return (fOffset == other.fOffset) && (super.equals(obj)) && (fMatches.equals(other.fMatches));
return fOffset == other.fOffset && super.equals(obj) && fMatches.equals(other.fMatches);
}
@Override
@ -220,7 +220,6 @@ public class LineSearchElement extends PDOMSearchElement {
private static LineSearchElement[] collectLineElements(AbstractCharArray buf, Match[] matches,
IIndexFileLocation fileLocation) {
List<LineSearchElement> result = new ArrayList<LineSearchElement>();
List<Match> matchCollector= new ArrayList<Match>();
@ -237,7 +236,7 @@ public class LineSearchElement extends PDOMSearchElement {
final int minOffset= matchOffset + match.getLength();
match= null;
matchOffset= Integer.MAX_VALUE;
for(i=i+1; i<matches.length; i++) {
for(i= i + 1; i < matches.length; i++) {
// Advance to next match that is not overlapped
final Match nextMatch= matches[i];
final int nextOffset= nextMatch.getOffset();