1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 01:05:38 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-03-07 20:07:07 -08:00
parent c5df80239f
commit 8153aff8ff
26 changed files with 130 additions and 101 deletions

View file

@ -21,7 +21,6 @@ package org.eclipse.cdt.core.dom.ast;
* @noinstantiate This class is not intended to be instantiated by clients. * @noinstantiate This class is not intended to be instantiated by clients.
*/ */
public class ASTNodeProperty { public class ASTNodeProperty {
private final String name; private final String name;
public ASTNodeProperty(String n) { public ASTNodeProperty(String n) {

View file

@ -16,7 +16,6 @@ import org.eclipse.cdt.core.parser.util.IObjectMatcher;
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
*/ */
public class ASTTypeMatcher implements IObjectMatcher { public class ASTTypeMatcher implements IObjectMatcher {
/** /**
* Returns <code>true</code> if the two objects are equal or represent the same type. * Returns <code>true</code> if the two objects are equal or represent the same type.
*/ */

View file

@ -17,6 +17,17 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTCastExpression extends IASTExpression { public interface IASTCastExpression extends IASTExpression {
/**
* <code>TYPE_ID</code> represents the relationship between a cast
* expression and the type cast to.
*/
public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty("IASTCastExpression.TYPE_ID - Type Id expression is cast to"); //$NON-NLS-1$
/**
* <code>OPERAND</code> represents the relationship between a cast
* expression and the expression it is casting (operand).
*/
public static final ASTNodeProperty OPERAND = new ASTNodeProperty("IASTCastExpression.OPERAND - expression being cast"); //$NON-NLS-1$
/** /**
* <code>op_cast</code> represents a traditional cast. * <code>op_cast</code> represents a traditional cast.
@ -42,12 +53,6 @@ public interface IASTCastExpression extends IASTExpression {
*/ */
public void setOperator(int value); public void setOperator(int value);
/**
* <code>OPERAND</code> represents the relationship between a cast
* expression and the expression it is casting (operand).
*/
public static final ASTNodeProperty OPERAND = new ASTNodeProperty("IASTCastExpression.OPERAND - expression being cast"); //$NON-NLS-1$
/** /**
* Get expression being cast. * Get expression being cast.
* *
@ -63,12 +68,6 @@ public interface IASTCastExpression extends IASTExpression {
*/ */
public void setOperand(IASTExpression expression); public void setOperand(IASTExpression expression);
/**
* <code>TYPE_ID</code> represents the relationship between a cast
* expression and the type cast to.
*/
public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty("IASTCastExpression.TYPE_ID - Type Id expression is cast to"); //$NON-NLS-1$
/** /**
* Set the typeId. * Set the typeId.
* *

View file

@ -18,7 +18,6 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTFunctionDeclarator extends IASTDeclarator { public interface IASTFunctionDeclarator extends IASTDeclarator {
/** /**
* @since 5.1 * @since 5.1
*/ */

View file

@ -17,7 +17,6 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTFunctionDefinition extends IASTDeclaration { public interface IASTFunctionDefinition extends IASTDeclaration {
/** /**
* <code>DECL_SPECIFIER</code> represents the relationship between a * <code>DECL_SPECIFIER</code> represents the relationship between a
* <code>IASTFunctionDefinition</code> and its * <code>IASTFunctionDefinition</code> and its

View file

@ -17,7 +17,6 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTInitializerClause extends IASTNode { public interface IASTInitializerClause extends IASTNode {
@Override @Override
IASTInitializerClause copy(); IASTInitializerClause copy();

View file

@ -19,7 +19,6 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTInitializerList extends IASTInitializer, IASTInitializerClause { public interface IASTInitializerList extends IASTInitializer, IASTInitializerClause {
public static final ASTNodeProperty NESTED_INITIALIZER = new ASTNodeProperty( public static final ASTNodeProperty NESTED_INITIALIZER = new ASTNodeProperty(
"IASTInitializerList.NESTED_INITIALIZER [IASTInitializerClause]"); //$NON-NLS-1$ "IASTInitializerList.NESTED_INITIALIZER [IASTInitializerClause]"); //$NON-NLS-1$
@ -69,5 +68,4 @@ public interface IASTInitializerList extends IASTInitializer, IASTInitializerCla
*/ */
@Deprecated @Deprecated
public void addInitializer(IASTInitializer initializer); public void addInitializer(IASTInitializer initializer);
} }

View file

@ -37,13 +37,15 @@ public interface IASTLabelStatement extends IASTStatement, IASTNameOwner {
*/ */
public void setName(IASTName name); public void setName(IASTName name);
/**
* Returns the statement following the label.
*/
public IASTStatement getNestedStatement(); public IASTStatement getNestedStatement();
/** /**
* @param s * @param s
*/ */
public void setNestedStatement( IASTStatement s ); public void setNestedStatement(IASTStatement s);
/** /**
* @since 5.1 * @since 5.1
@ -56,5 +58,4 @@ public interface IASTLabelStatement extends IASTStatement, IASTNameOwner {
*/ */
@Override @Override
public IASTLabelStatement copy(CopyStyle style); public IASTLabelStatement copy(CopyStyle style);
} }

View file

@ -19,7 +19,6 @@ import org.eclipse.cdt.core.parser.IProblem;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTProblem extends IProblem, IASTNode { public interface IASTProblem extends IProblem, IASTNode {
/** /**
* @since 5.1 * @since 5.1
*/ */

View file

@ -11,14 +11,13 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represents a parse problem where we tried to match against a * This interface represents a parse problem where we tried to match against
* expression. * an expression.
* *
* @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 IASTProblemExpression extends IASTExpression, IASTProblemHolder { public interface IASTProblemExpression extends IASTExpression, IASTProblemHolder {
/** /**
* @since 5.1 * @since 5.1
*/ */

View file

@ -38,5 +38,4 @@ public interface IASTProblemHolder {
* <code>IASTProblem</code> * <code>IASTProblem</code>
*/ */
public void setProblem(IASTProblem p); public void setProblem(IASTProblem p);
} }

View file

@ -15,7 +15,6 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTTypeId extends IASTNode { public interface IASTTypeId extends IASTNode {
/** /**
* Constant. * Constant.
*/ */

View file

@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* Compound literal: type-id { initializer } * Compound literal: type-id { initializer }
* *
@ -20,7 +19,6 @@ package org.eclipse.cdt.core.dom.ast;
* @since 5.1 * @since 5.1
*/ */
public interface IASTTypeIdInitializerExpression extends IASTExpression { public interface IASTTypeIdInitializerExpression extends IASTExpression {
/** /**
* <code>TYPE_ID</code> represents the relationship between an * <code>TYPE_ID</code> represents the relationship between an
* <code>IASTTypeIdInitializerExpression</code> and * <code>IASTTypeIdInitializerExpression</code> and
@ -58,4 +56,10 @@ public interface IASTTypeIdInitializerExpression extends IASTExpression {
@Override @Override
public IASTTypeIdInitializerExpression copy(); public IASTTypeIdInitializerExpression copy();
/**
* @since 5.4
*/
@Override
public IASTTypeIdInitializerExpression copy(CopyStyle style);
} }

View file

@ -18,6 +18,8 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IVariable extends IBinding { public interface IVariable extends IBinding {
/** @since 5.4 */
public static final IVariable[] EMPTY_VARIABLE_ARRAY = {};
/** /**
* Returns the type of the variable * Returns the type of the variable

View file

@ -16,15 +16,14 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
/** /**
* This interface represents a designated initializer. e.g. struct x y = { .z=4, * This interface represents a designated initializer,
* .t[1] = 3 }; * e.g. struct x y = { .z = 4, .t[1] = 3 };
* *
* @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 ICASTDesignatedInitializer extends IASTInitializer, IASTInitializerClause { public interface ICASTDesignatedInitializer extends IASTInitializer, IASTInitializerClause {
public static final ICASTDesignator[] EMPTY_DESIGNATOR_ARRAY = {};
public static final ICASTDesignator[] EMPTY_DESIGNATOR_ARRAY = new ICASTDesignator[0];
public static final ASTNodeProperty DESIGNATOR = new ASTNodeProperty( public static final ASTNodeProperty DESIGNATOR = new ASTNodeProperty(
"ICASTDesignatedInitializer.DESIGNATOR [ICASTDesignator]"); //$NON-NLS-1$ "ICASTDesignatedInitializer.DESIGNATOR [ICASTDesignator]"); //$NON-NLS-1$
@ -77,5 +76,4 @@ public interface ICASTDesignatedInitializer extends IASTInitializer, IASTInitial
*/ */
@Deprecated @Deprecated
public void setOperandInitializer(IASTInitializer rhs); public void setOperandInitializer(IASTInitializer rhs);
} }

View file

@ -19,7 +19,6 @@ import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTCastExpression extends IASTCastExpression { public interface ICPPASTCastExpression extends IASTCastExpression {
/** /**
* <code>op_dynamic_cast</code> is used for dynamic_cast<>'s. * <code>op_dynamic_cast</code> is used for dynamic_cast<>'s.
*/ */
@ -45,10 +44,15 @@ public interface ICPPASTCastExpression extends IASTCastExpression {
*/ */
public static final int op_last = op_const_cast; public static final int op_last = op_const_cast;
/** /**
* @since 5.1 * @since 5.1
*/ */
@Override @Override
public ICPPASTCastExpression copy(); public ICPPASTCastExpression copy();
/**
* @since 5.4
*/
@Override
public ICPPASTCastExpression copy(CopyStyle style);
} }

View file

@ -24,7 +24,6 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTConstructorInitializer extends IASTInitializer { public interface ICPPASTConstructorInitializer extends IASTInitializer {
/** /**
* @since 5.2 * @since 5.2
*/ */
@ -39,6 +38,12 @@ public interface ICPPASTConstructorInitializer extends IASTInitializer {
*/ */
public IASTInitializerClause[] getArguments(); public IASTInitializerClause[] getArguments();
/**
* Not allowed on frozen ast.
* @since 5.2
*/
public void setArguments(IASTInitializerClause[] args);
/** /**
* @since 5.1 * @since 5.1
*/ */
@ -51,13 +56,6 @@ public interface ICPPASTConstructorInitializer extends IASTInitializer {
@Override @Override
public ICPPASTConstructorInitializer copy(CopyStyle style); public ICPPASTConstructorInitializer copy(CopyStyle style);
/**
* Not allowed on frozen ast.
* @since 5.2
*/
public void setArguments(IASTInitializerClause[] args);
/** /**
* @deprecated Replaced by {@link #getArguments()}. * @deprecated Replaced by {@link #getArguments()}.
*/ */

View file

@ -22,7 +22,6 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTDeleteExpression extends IASTExpression, IASTImplicitNameOwner { public interface ICPPASTDeleteExpression extends IASTExpression, IASTImplicitNameOwner {
/** /**
* <code>OPERAND</code> is the expression representing the pointer being * <code>OPERAND</code> is the expression representing the pointer being
* deleted. * deleted.
@ -66,13 +65,12 @@ public interface ICPPASTDeleteExpression extends IASTExpression, IASTImplicitNam
public void setIsVectored(boolean vectored); public void setIsVectored(boolean vectored);
/** /**
* Is this a delete [] ? * Is this a delete[] ?
* *
* @return boolean * @return boolean
*/ */
public boolean isVectored(); public boolean isVectored();
/** /**
* @since 5.1 * @since 5.1
*/ */

View file

@ -26,7 +26,6 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTNewExpression extends IASTExpression, IASTImplicitNameOwner { public interface ICPPASTNewExpression extends IASTExpression, IASTImplicitNameOwner {
public static final ASTNodeProperty NEW_PLACEMENT = new ASTNodeProperty( public static final ASTNodeProperty NEW_PLACEMENT = new ASTNodeProperty(
"ICPPASTNewExpression.NEW_PLACEMENT [IASTExpression]"); //$NON-NLS-1$ "ICPPASTNewExpression.NEW_PLACEMENT [IASTExpression]"); //$NON-NLS-1$
@ -83,7 +82,6 @@ public interface ICPPASTNewExpression extends IASTExpression, IASTImplicitNameOw
@Override @Override
public ICPPASTNewExpression copy(CopyStyle style); public ICPPASTNewExpression copy(CopyStyle style);
/** /**
* Not allowed on frozen ast. * Not allowed on frozen ast.
*/ */

View file

@ -20,7 +20,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTBinaryExpression;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IGPPASTBinaryExpression extends ICPPASTBinaryExpression { public interface IGPPASTBinaryExpression extends ICPPASTBinaryExpression {
/** /**
* <code>op_max</code> represents >? * <code>op_max</code> represents >?
*/ */

View file

@ -10,7 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.parser; package org.eclipse.cdt.core.parser;
/** /**
* Description of a C/C++ syntax problems and spelling errors as detected by the lexer, preprocessor, * Description of a C/C++ syntax problems and spelling errors as detected by the lexer, preprocessor,
* parser or the spelling engine. * parser or the spelling engine.
@ -26,8 +25,7 @@ package org.eclipse.cdt.core.parser;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
*/ */
public interface IProblem public interface IProblem {
{
/** /**
* Returns the problem id * Returns the problem id
*/ */
@ -79,7 +77,6 @@ public interface IProblem
*/ */
boolean isWarning(); boolean isWarning();
/** /**
* -1, returned when an offset or a line number is unknown. * -1, returned when an offset or a line number is unknown.
*/ */

View file

@ -144,6 +144,27 @@ public abstract class ArrayUtil {
return temp; return temp;
} }
/**
* Assumes that array contains nulls at the end, only.
* Appends object using the current length of the array.
* @param array The array to append to. Not {@code null}
* @param currentLength The number of non-{@code null} elements in the array
* @param obj The object to append. Not {@code null}
* @return The modified array, which may be the same as the first parameter.
* @since 5.4
*/
static public <T> T[] appendAt(T[] array, int currentLength, T obj) {
if (obj == null)
return array;
if (currentLength >= array.length) {
array = Arrays.copyOf(array, Math.max(Math.max(currentLength + 1, array.length * 2), DEFAULT_LENGTH));
}
Assert.isTrue(array[currentLength] == null);
Assert.isTrue(currentLength == 0 || array[currentLength - 1] != null);
array[currentLength]= obj;
return array;
}
/** /**
* Trims the given array and returns a new array with no null entries. * Trims the given array and returns a new array with no null entries.
* Assumes that nulls can be found at the end, only. * Assumes that nulls can be found at the end, only.
@ -216,6 +237,25 @@ public abstract class ArrayUtil {
return trim(array, false); return trim(array, false);
} }
/**
* Trims the given array and returns a new array with no {@code null} entries.
* Assumes that {@code null}s can be found at the end, only.
* Similar to {@link #trimAt(Class, Object[], int)}, but uses the new length instead of index.
*
* @param array the array to be trimmed
* @param newLength the new length of the array, has to be less or equal than
* the current length.
* @return the modified array, which may be the same as the first parameter.
* @since 5.4
*/
static public <T> T[] trim(T[] array, int newLength) {
if (newLength == array.length)
return array;
Assert.isTrue(array[newLength] == null);
Assert.isTrue(newLength == 0 || array[newLength - 1] != null);
return Arrays.copyOf(array, newLength);
}
/** /**
* Takes contents of the two arrays up to the first <code>null</code> element and concatenates * Takes contents of the two arrays up to the first <code>null</code> element and concatenates
* them. * them.
@ -446,7 +486,7 @@ public abstract class ArrayUtil {
} }
/** /**
* @deprecated Use {@link #trimAt(Class, Object[], int)} instead * @deprecated Use {@link #trim(Object[], int)} or {@link #trimAt(Class, Object[], int)} instead
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Deprecated @Deprecated
@ -456,10 +496,13 @@ public abstract class ArrayUtil {
/** /**
* To improve performance, this method should be used instead of * To improve performance, this method should be used instead of
* {@link #removeNulls(Class, Object[])} when all of the non-<code>null</code> elements in * {@link #removeNulls(Class, Object[])} when all of the non-{@code null} elements in
* the array are grouped together at the beginning of the array and all of the nulls are at * the array are grouped together at the beginning of the array and all of the nulls are at
* the end of the array. The position of the last non-null element in the array must also * the end of the array. The position of the last non-{@code null} element in the array must also
* be known. * be known.
* <p>
* If you don't indend to pass {@code null} array, consider using {@link #trim(Object[], int)}
* instead.
* *
* @since 5.1 * @since 5.1
*/ */
@ -525,7 +568,7 @@ public abstract class ArrayUtil {
System.arraycopy(array, 0, array, 1, i); System.arraycopy(array, 0, array, 1, i);
array[0] = obj; array[0] = obj;
} else { } else {
T[] temp = newArray(array, array.length*2); T[] temp = newArray(array, array.length * 2);
System.arraycopy(array, 0, temp, 1, array.length); System.arraycopy(array, 0, temp, 1, array.length);
temp[0] = obj; temp[0] = obj;
array = temp; array = temp;

View file

@ -28,7 +28,6 @@ public class CASTCastExpression extends ASTNode implements IASTCastExpression, I
private IASTExpression operand; private IASTExpression operand;
private IASTTypeId typeId; private IASTTypeId typeId;
public CASTCastExpression() { public CASTCastExpression() {
this.operator = op_cast; this.operator = op_cast;
} }

View file

@ -30,9 +30,9 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
*/ */
public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPASTFunctionDeclarator, public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPASTFunctionDeclarator,
IASTAmbiguityParent { IASTAmbiguityParent {
private ICPPASTParameterDeclaration[] parameters = null; private ICPPASTParameterDeclaration[] parameters;
private IASTTypeId[] typeIds = NO_EXCEPTION_SPECIFICATION; private IASTTypeId[] typeIds = NO_EXCEPTION_SPECIFICATION;
private IASTTypeId trailingReturnType= null; private IASTTypeId trailingReturnType;
private boolean varArgs; private boolean varArgs;
private boolean pureVirtual; private boolean pureVirtual;
@ -40,7 +40,7 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
private boolean isConst; private boolean isConst;
private boolean isMutable; private boolean isMutable;
private ICPPFunctionScope scope = null; private ICPPFunctionScope scope;
public CPPASTFunctionDeclarator() { public CPPASTFunctionDeclarator() {
} }