diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompoundStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompoundStatement.java index 7a8b29c66b4..8e9016bd425 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompoundStatement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompoundStatement.java @@ -17,7 +17,6 @@ package org.eclipse.cdt.core.dom.ast; * @noimplement This interface is not intended to be implemented by clients. */ public interface IASTCompoundStatement extends IASTStatement { - /** * NESTED_STATEMENT represents the relationship between an * IASTCompoundStatement and its nested diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTEqualsInitializer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTEqualsInitializer.java index 67cca433a4b..4c95de2148a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTEqualsInitializer.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTEqualsInitializer.java @@ -6,11 +6,10 @@ * 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; - /** * Initializer with equals sign (copy initialization) as in int x= 0;. * @since 5.2 @@ -21,7 +20,6 @@ package org.eclipse.cdt.core.dom.ast; public interface IASTEqualsInitializer extends IASTInitializer { ASTNodeProperty INITIALIZER = new ASTNodeProperty( "IASTEqualsInitializer - INITIALIZER [IASTInitializerClause]"); //$NON-NLS-1$ - /** * Returns the expression or braced initializer list of this initializer. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTFieldDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTFieldDeclarator.java index 52ebc25457f..1569f1bcf2d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTFieldDeclarator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTFieldDeclarator.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Doug Schaefer (IBM) - Initial API and implementation + * Doug Schaefer (IBM) - Initial API and implementation *******************************************************************************/ package org.eclipse.cdt.core.dom.ast; @@ -18,7 +18,6 @@ package org.eclipse.cdt.core.dom.ast; * @noimplement This interface is not intended to be implemented by clients. */ public interface IASTFieldDeclarator extends IASTDeclarator { - /** * FIELD_SIZE represents the relationship between a * IASTFieldDeclarator and its IASTExpression. @@ -27,15 +26,14 @@ public interface IASTFieldDeclarator extends IASTDeclarator { "IASTFieldDeclarator.FIELD_SIZE - BitField Size of IASTFieldDeclarator"); //$NON-NLS-1$ /** - * This returns the number of bits if this is a bit field. If it is not a - * bit field, it returns null. + * Returns the number of bits if this is a bit field, otherwise {@code null}. * * @return size of bit field or null. */ public IASTExpression getBitFieldSize(); /** - * Set the bitfield size. + * Sets the bitfield size. * * @param size * IASTExpression diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTFunctionDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTFunctionDefinition.java index 24191a961b1..39aeb1bd3a9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTFunctionDefinition.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTFunctionDefinition.java @@ -41,8 +41,7 @@ public interface IASTFunctionDefinition extends IASTDeclaration { "IASTFunctionDefinition.FUNCTION_BODY - Function Body for IASTFunctionDefinition"); //$NON-NLS-1$ /** - * Get the decl specifier for the function. - * + * Returns the decl specifier for the function. */ public IASTDeclSpecifier getDeclSpecifier(); @@ -54,7 +53,7 @@ public interface IASTFunctionDefinition extends IASTDeclaration { public void setDeclSpecifier(IASTDeclSpecifier declSpec); /** - * Get the function declarator of the function. + * Returns the function declarator of the function. * Note, that the function declarator may contain nested declarators and may also nest within * another declarator. In the latter case this function definition is always the parent of the * outermost declarator. @@ -66,7 +65,7 @@ public interface IASTFunctionDefinition extends IASTDeclaration { public IASTFunctionDeclarator getDeclarator(); /** - * Set the declarator for the function. + * Sets the declarator for the function. * Note, that the function declarator may contain nested declarators and may also nest within * another declarator. In the latter case this function definition is set to be the parent of the * outermost declarator. @@ -79,14 +78,14 @@ public interface IASTFunctionDefinition extends IASTDeclaration { public void setDeclarator(IASTFunctionDeclarator declarator); /** - * Get the body of the function. This is usually a compound statement but + * Returns the body of the function. This is usually a compound statement but * C++ also has a function try block. * */ public IASTStatement getBody(); /** - * Set the body of the function. + * Sets the body of the function. * * @param statement */ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTInitializer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTInitializer.java index 4684dc536ba..7057f4dcd5c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTInitializer.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTInitializer.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Doug Schaefer (IBM) - Initial API and implementation + * Doug Schaefer (IBM) - Initial API and implementation *******************************************************************************/ package org.eclipse.cdt.core.dom.ast; @@ -17,11 +17,10 @@ package org.eclipse.cdt.core.dom.ast; * @noimplement This interface is not intended to be implemented by clients. */ public interface IASTInitializer extends IASTNode { - /** * Constant. */ - public final static IASTInitializer[] EMPTY_INITIALIZER_ARRAY = new IASTInitializer[0]; + public final static IASTInitializer[] EMPTY_INITIALIZER_ARRAY = {}; /** * @since 5.1 diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTInitializerList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTInitializerList.java index e0701c605cb..f0283c25d37 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTInitializerList.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTInitializerList.java @@ -36,7 +36,6 @@ public interface IASTInitializerList extends IASTInitializer, IASTInitializerCla */ public IASTInitializerClause[] getClauses(); - /** * Add an initializer clause to the initializer list. Depending on how the AST is created the * initializer may be null. A null initializer will not be returned diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTParameterDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTParameterDeclaration.java index 4808e3e4ea4..a230453e458 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTParameterDeclaration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTParameterDeclaration.java @@ -39,21 +39,21 @@ public interface IASTParameterDeclaration extends IASTNode { "IASTParameterDeclaration.DECLARATOR - IASTDeclarator for IASTParameterDeclaration"); //$NON-NLS-1$ /** - * Get the decl specifier. + * Returns the decl specifier. * * @return IASTDeclSpecifier */ public IASTDeclSpecifier getDeclSpecifier(); /** - * Get the declarator. + * Returns the declarator. * * @return IASTDeclarator */ public IASTDeclarator getDeclarator(); /** - * Set the decl specifier. + * Sets the decl specifier. * * @param declSpec * IASTDeclSpecifier. @@ -61,7 +61,7 @@ public interface IASTParameterDeclaration extends IASTNode { public void setDeclSpecifier(IASTDeclSpecifier declSpec); /** - * Set the declarator. + * Sets the declarator. * * @param declarator * IASTDeclarator diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IParameter.java index 6b96a2f8de9..2a4da1e83f8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IParameter.java @@ -6,8 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Doug Schaefer (IBM) - Initial API and implementation - * Markus Schorn (Wind River Systems) + * Doug Schaefer (IBM) - Initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.core.dom.ast; @@ -19,7 +19,7 @@ package org.eclipse.cdt.core.dom.ast; * @noimplement This interface is not intended to be implemented by clients. */ public interface IParameter extends IVariable { - public static final IParameter [] EMPTY_PARAMETER_ARRAY = new IParameter[0]; + public static final IParameter [] EMPTY_PARAMETER_ARRAY = {}; /** * Inherited from {@link IVariable}, always returns null. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/c/ICASTKnRFunctionDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/c/ICASTKnRFunctionDeclarator.java index d5d2c07bed2..1f41b41daeb 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/c/ICASTKnRFunctionDeclarator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/c/ICASTKnRFunctionDeclarator.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM - Initial API and implementation + * IBM - Initial API and implementation *******************************************************************************/ package org.eclipse.cdt.core.dom.ast.gnu.c; @@ -23,7 +23,6 @@ import org.eclipse.cdt.core.dom.ast.IASTName; * @noimplement This interface is not intended to be implemented by clients. */ public interface ICASTKnRFunctionDeclarator extends IASTFunctionDeclarator { - /** * PARAMETER_NAME refers to the names qualified in a K&R C * function definition. @@ -31,21 +30,6 @@ public interface ICASTKnRFunctionDeclarator extends IASTFunctionDeclarator { public static final ASTNodeProperty PARAMETER_NAME = new ASTNodeProperty( "ICASTKnRFunctionDeclarator.PARAMETER_NAME - K&R Parameter Name"); //$NON-NLS-1$ - /** - * Overwrite the parameter names. TODO - this should change to add - * - * @param names - * IASTName [] - */ - public void setParameterNames(IASTName[] names); - - /** - * Get parameter names. - * - * @return IASTName [] - */ - public IASTName[] getParameterNames(); - /** * FUNCTION_PARAMETER represents the relationship between an * K&R function declarator and the full parameter declarations. @@ -54,7 +38,22 @@ public interface ICASTKnRFunctionDeclarator extends IASTFunctionDeclarator { "ICASTKnRFunctionDeclarator.FUNCTION_PARAMETER - Full K&R Parameter Declaration"); //$NON-NLS-1$ /** - * Overrwrite the parameter lists. + * Sets the parameter names. TODO - this should change to add + * + * @param names + * IASTName [] + */ + public void setParameterNames(IASTName[] names); + + /** + * Returns parameter names. + * + * @return IASTName [] + */ + public IASTName[] getParameterNames(); + + /** + * Sets the parameter lists. * * @param decls * TODO - replace w/zadd diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTBinaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTBinaryExpression.java index 085c2ecd08a..d433dcdb11d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTBinaryExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTBinaryExpression.java @@ -6,9 +6,9 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * John Camelon (IBM Rational Software) - Initial API and implementation - * Yuan Zhang / Beth Tibbitts (IBM Research) - * Markus Schorn (Wind River Systems) + * John Camelon (IBM Rational Software) - Initial API and implementation + * Yuan Zhang / Beth Tibbitts (IBM Research) + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.c; @@ -28,9 +28,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; /** * Binary expression for c */ -public class CASTBinaryExpression extends ASTNode implements - IASTBinaryExpression, IASTAmbiguityParent { - +public class CASTBinaryExpression extends ASTNode + implements IASTBinaryExpression, IASTAmbiguityParent { private int op; private IASTExpression operand1; private IASTExpression operand2; @@ -112,13 +111,13 @@ public class CASTBinaryExpression extends ASTNode implements } @Override - public boolean accept( ASTVisitor action ){ + public boolean accept(ASTVisitor action) { if (operand1 instanceof IASTBinaryExpression || operand2 instanceof IASTBinaryExpression) { return acceptWithoutRecursion(this, action); } - if( action.shouldVisitExpressions ){ - switch( action.visit( this ) ){ + if (action.shouldVisitExpressions) { + switch (action.visit(this)) { case ASTVisitor.PROCESS_ABORT : return false; case ASTVisitor.PROCESS_SKIP : return true; default : break; @@ -153,7 +152,7 @@ public class CASTBinaryExpression extends ASTNode implements if (stack.fState == 0) { if (action.shouldVisitExpressions) { switch (action.visit(expr)) { - case ASTVisitor.PROCESS_ABORT : + case ASTVisitor.PROCESS_ABORT: return false; case ASTVisitor.PROCESS_SKIP: stack= stack.fNext; @@ -197,16 +196,14 @@ public class CASTBinaryExpression extends ASTNode implements @Override public void replace(IASTNode child, IASTNode other) { - if( child == operand1 ) - { - other.setPropertyInParent( child.getPropertyInParent() ); - other.setParent( child.getParent() ); + if (child == operand1) { + other.setPropertyInParent(child.getPropertyInParent()); + other.setParent(child.getParent()); operand1 = (IASTExpression) other; } - if( child == operand2) - { - other.setPropertyInParent( child.getPropertyInParent() ); - other.setParent( child.getParent() ); + if (child == operand2) { + other.setPropertyInParent(child.getPropertyInParent()); + other.setParent(child.getParent()); operand2 = (IASTExpression) other; } } @@ -220,34 +217,36 @@ public class CASTBinaryExpression extends ASTNode implements if (type != null) { return type; } - switch (op) { - case op_lessEqual: - case op_lessThan: - case op_greaterEqual: - case op_greaterThan: - case op_logicalAnd: - case op_logicalOr: - case op_equals: - case op_notequals: - return new CBasicType(Kind.eInt, 0, this); - case IASTBinaryExpression.op_plus: - if (t1 instanceof IArrayType) { - return arrayTypeToPointerType((ICArrayType) t1); - } else if (t2 instanceof IPointerType) { - return t2; - } else if (t2 instanceof IArrayType) { - return arrayTypeToPointerType((ICArrayType) t2); - } - break; - case IASTBinaryExpression.op_minus: - if (t2 instanceof IPointerType || t2 instanceof IArrayType) { - if (t1 instanceof IPointerType || t1 instanceof IArrayType) { - return CVisitor.getPtrDiffType(this); - } - return t1; + switch (op) { + case op_lessEqual: + case op_lessThan: + case op_greaterEqual: + case op_greaterThan: + case op_logicalAnd: + case op_logicalOr: + case op_equals: + case op_notequals: + return new CBasicType(Kind.eInt, 0, this); + + case IASTBinaryExpression.op_plus: + if (t1 instanceof IArrayType) { + return arrayTypeToPointerType((ICArrayType) t1); + } else if (t2 instanceof IPointerType) { + return t2; + } else if (t2 instanceof IArrayType) { + return arrayTypeToPointerType((ICArrayType) t2); + } + break; + + case IASTBinaryExpression.op_minus: + if (t2 instanceof IPointerType || t2 instanceof IArrayType) { + if (t1 instanceof IPointerType || t1 instanceof IArrayType) { + return CVisitor.getPtrDiffType(this); } - break; + return t1; + } + break; } return t1; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCompoundStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCompoundStatement.java index 874bc35b21d..6fdf72c13b5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCompoundStatement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCompoundStatement.java @@ -6,8 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM Rational Software - Initial API and implementation - * Yuan Zhang / Beth Tibbitts (IBM Research) + * IBM Rational Software - Initial API and implementation + * Yuan Zhang / Beth Tibbitts (IBM Research) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.c; @@ -25,8 +25,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; * @author jcamelon */ public class CASTCompoundStatement extends ASTNode implements IASTCompoundStatement, IASTAmbiguityParent { - private IASTStatement [] statements = null; - private IScope scope = null; + private IASTStatement[] statements; + private IScope scope; @Override public CASTCompoundStatement copy() { @@ -69,20 +69,20 @@ public class CASTCompoundStatement extends ASTNode implements IASTCompoundStatem } @Override - public boolean accept(ASTVisitor action){ - if (action.shouldVisitStatements){ - switch (action.visit(this)){ + public boolean accept(ASTVisitor action) { + if (action.shouldVisitStatements) { + switch (action.visit(this)) { case ASTVisitor.PROCESS_ABORT: return false; case ASTVisitor.PROCESS_SKIP: return true; default: break; } } - IASTStatement [] s = getStatements(); + IASTStatement[] s = getStatements(); for (int i = 0; i < s.length; i++) { if (!s[i].accept(action)) return false; } - if (action.shouldVisitStatements){ - switch (action.leave(this)){ + if (action.shouldVisitStatements) { + switch (action.leave(this)) { case ASTVisitor.PROCESS_ABORT: return false; case ASTVisitor.PROCESS_SKIP: return true; default: break; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTDeclarationStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTDeclarationStatement.java index d09045f102f..59f7e8c4517 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTDeclarationStatement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTDeclarationStatement.java @@ -6,9 +6,9 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * John Camelon (IBM Rational Software) - Initial API and implementation - * Yuan Zhang / Beth Tibbitts (IBM Research) - * Markus Schorn (Wind River Systems) + * John Camelon (IBM Rational Software) - Initial API and implementation + * Yuan Zhang / Beth Tibbitts (IBM Research) + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.c; @@ -23,10 +23,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; * A declaration statement. */ public class CASTDeclarationStatement extends ASTNode implements IASTDeclarationStatement, IASTAmbiguityParent { - private IASTDeclaration declaration; - public CASTDeclarationStatement() { } @@ -34,12 +32,11 @@ public class CASTDeclarationStatement extends ASTNode implements IASTDeclaration setDeclaration(declaration); } - @Override public CASTDeclarationStatement copy() { return copy(CopyStyle.withoutLocations); } - + @Override public CASTDeclarationStatement copy(CopyStyle style) { CASTDeclarationStatement copy = new CASTDeclarationStatement(); @@ -67,20 +64,20 @@ public class CASTDeclarationStatement extends ASTNode implements IASTDeclaration } @Override - public boolean accept( ASTVisitor action ){ - if( action.shouldVisitStatements ){ - switch( action.visit( this ) ){ - case ASTVisitor.PROCESS_ABORT : return false; - case ASTVisitor.PROCESS_SKIP : return true; - default : break; + public boolean accept(ASTVisitor action) { + if (action.shouldVisitStatements) { + switch (action.visit(this)) { + case ASTVisitor.PROCESS_ABORT: return false; + case ASTVisitor.PROCESS_SKIP: return true; + default: break; } } - if( declaration != null ) if( !declaration.accept( action ) ) return false; - if( action.shouldVisitStatements ){ - switch( action.leave( this ) ){ - case ASTVisitor.PROCESS_ABORT : return false; - case ASTVisitor.PROCESS_SKIP : return true; - default : break; + if (declaration != null && !declaration.accept(action)) return false; + if (action.shouldVisitStatements) { + switch (action.leave(this)) { + case ASTVisitor.PROCESS_ABORT: return false; + case ASTVisitor.PROCESS_SKIP: return true; + default: break; } } return true; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTIdExpression.java index 78ec3a7a3b2..ebe4394c304 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTIdExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTIdExpression.java @@ -35,10 +35,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemType; * ID Expression in C. */ public class CASTIdExpression extends ASTNode implements IASTIdExpression, IASTCompletionContext { - private IASTName name; - public CASTIdExpression() { } @@ -77,22 +75,22 @@ public class CASTIdExpression extends ASTNode implements IASTIdExpression, IASTC } @Override - public boolean accept( ASTVisitor action ){ - if( action.shouldVisitExpressions ){ - switch( action.visit( this ) ){ - case ASTVisitor.PROCESS_ABORT : return false; - case ASTVisitor.PROCESS_SKIP : return true; - default : break; + public boolean accept(ASTVisitor action) { + if (action.shouldVisitExpressions) { + switch (action.visit(this)) { + case ASTVisitor.PROCESS_ABORT: return false; + case ASTVisitor.PROCESS_SKIP: return true; + default: break; } } - if( name != null ) if( !name.accept( action ) ) return false; + if (name != null && !name.accept(action)) return false; - if( action.shouldVisitExpressions ){ - switch( action.leave( this ) ){ - case ASTVisitor.PROCESS_ABORT : return false; - case ASTVisitor.PROCESS_SKIP : return true; - default : break; + if (action.shouldVisitExpressions) { + switch (action.leave(this)) { + case ASTVisitor.PROCESS_ABORT: return false; + case ASTVisitor.PROCESS_SKIP: return true; + default: break; } } return true; @@ -100,7 +98,7 @@ public class CASTIdExpression extends ASTNode implements IASTIdExpression, IASTC @Override public int getRoleForName(IASTName n) { - if( n == name ) return r_reference; + if (n == name) return r_reference; return r_unclear; } @@ -136,7 +134,6 @@ public class CASTIdExpression extends ASTNode implements IASTIdExpression, IASTC return ValueCategory.LVALUE; } - @Override public IBinding[] findBindings(IASTName n, boolean isPrefix) { IBinding[] bindings = CVisitor.findBindingsForContentAssist(n, isPrefix); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTName.java index 3e7e8115e28..7ce3ae5d948 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTName.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTName.java @@ -105,7 +105,6 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext this.binding = binding; } - @Override public String toString() { if (name == EMPTY_CHAR_ARRAY) @@ -154,7 +153,6 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext return true; } - @Override public int getRoleOfName(boolean allowResolution) { IASTNode parent = getParent(); @@ -248,6 +246,7 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext bindings[i] = null; } break; + case ICompositeType.k_union: if (kind != IASTElaboratedTypeSpecifier.k_union) { bindings[i] = null; @@ -258,13 +257,14 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext bindings[i]= null; } } - return ArrayUtil.removeNulls(IBinding.class, bindings); + return ArrayUtil.removeNulls(bindings); } @Override public IASTName getLastName() { return this; } + @Override public boolean isQualified() { return false; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTReturnStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTReturnStatement.java index eb5154298e9..a87dc806eea 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTReturnStatement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTReturnStatement.java @@ -6,9 +6,9 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * John Camelon (IBM Rational Software) - Initial API and implementation - * Yuan Zhang / Beth Tibbitts (IBM Research) - * Markus Schorn (Wind River Systems) + * John Camelon (IBM Rational Software) - Initial API and implementation + * Yuan Zhang / Beth Tibbitts (IBM Research) + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.c; @@ -20,9 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IASTReturnStatement; import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; -public class CASTReturnStatement extends ASTNode implements - IASTReturnStatement, IASTAmbiguityParent { - +public class CASTReturnStatement extends ASTNode implements IASTReturnStatement, IASTAmbiguityParent { private IASTExpression retValue; public CASTReturnStatement() { @@ -39,8 +37,8 @@ public class CASTReturnStatement extends ASTNode implements @Override public CASTReturnStatement copy(CopyStyle style) { - CASTReturnStatement copy = new CASTReturnStatement(retValue == null ? null - : retValue.copy(style)); + CASTReturnStatement copy = + new CASTReturnStatement(retValue == null ? null : retValue.copy(style)); copy.setOffsetAndLength(this); if (style == CopyStyle.withLocations) { copy.setCopyLocation(this); @@ -78,20 +76,20 @@ public class CASTReturnStatement extends ASTNode implements } @Override - public boolean accept( ASTVisitor action ){ - if( action.shouldVisitStatements ){ - switch( action.visit( this ) ){ - case ASTVisitor.PROCESS_ABORT : return false; - case ASTVisitor.PROCESS_SKIP : return true; - default : break; + public boolean accept(ASTVisitor action) { + if (action.shouldVisitStatements) { + switch (action.visit(this)) { + case ASTVisitor.PROCESS_ABORT: return false; + case ASTVisitor.PROCESS_SKIP: return true; + default: break; } } - if( retValue != null ) if( !retValue.accept( action ) ) return false; - if( action.shouldVisitStatements ){ - switch( action.leave( this ) ){ - case ASTVisitor.PROCESS_ABORT : return false; - case ASTVisitor.PROCESS_SKIP : return true; - default : break; + if (retValue != null && !retValue.accept(action)) return false; + if (action.shouldVisitStatements) { + switch (action.leave(this)) { + case ASTVisitor.PROCESS_ABORT: return false; + case ASTVisitor.PROCESS_SKIP: return true; + default: break; } } return true; @@ -99,10 +97,9 @@ public class CASTReturnStatement extends ASTNode implements @Override public void replace(IASTNode child, IASTNode other) { - if( child == retValue ) - { - other.setPropertyInParent( child.getPropertyInParent() ); - other.setParent( child.getParent() ); + if (child == retValue) { + other.setPropertyInParent(child.getPropertyInParent()); + other.setParent(child.getParent()); retValue = (IASTExpression) other; } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CParameter.java index 48452cd8ea5..36871a78535 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CParameter.java @@ -6,8 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM Rational Software - Initial API and implementation - * Markus Schorn (Wind River Systems) + * IBM Rational Software - Initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.c; @@ -50,12 +50,6 @@ public class CParameter extends PlatformObject implements IParameter { this.declarations = new IASTName[] { parameterName }; } - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.core.dom.ast.IVariable#getType() - */ - @Override public IType getType() { if (type == null && declarations[0].getParent() instanceof IASTDeclarator) @@ -102,11 +96,6 @@ public class CParameter extends PlatformObject implements IParameter { return CVisitor.EMPTY_CHAR_ARRAY; } - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.core.dom.ast.IBinding#getScope() - */ @Override public IScope getScope() { // IASTParameterDeclaration or IASTSimpleDeclaration @@ -138,41 +127,21 @@ public class CParameter extends PlatformObject implements IParameter { declarations = ArrayUtil.append(IASTName.class, declarations, name); } - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.core.dom.ast.IVariable#isStatic() - */ @Override public boolean isStatic() { return false; } - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.core.dom.ast.IVariable#isExtern() - */ @Override public boolean isExtern() { return false; } - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto() - */ @Override public boolean isAuto() { return hasStorageClass(IASTDeclSpecifier.sc_auto); } - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister() - */ @Override public boolean isRegister() { return hasStorageClass(IASTDeclSpecifier.sc_register); @@ -216,4 +185,9 @@ public class CParameter extends PlatformObject implements IParameter { public IValue getInitialValue() { return null; } + + @Override + public String toString() { + return getName(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNameBase.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNameBase.java index a0a080bea4f..53bf88475b7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNameBase.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNameBase.java @@ -167,7 +167,6 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName { } return false; } - @Override public final String toString() { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassWizardUtil.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassWizardUtil.java index 9cf4a4b5a72..0c979f1f1c5 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassWizardUtil.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassWizardUtil.java @@ -73,7 +73,7 @@ public class NewClassWizardUtil { ICElement curr = element; while (curr != null && !foundSourceRoot) { if (curr instanceof ICContainer && folder == null) { - folder = (ICContainer)curr; + folder = (ICContainer) curr; } foundSourceRoot = (curr instanceof ISourceRoot); curr = curr.getParent(); @@ -118,31 +118,6 @@ public class NewClassWizardUtil { return null; } - //XXX Remove -// /** -// * Returns the parent source folder for the given resource. If the given -// * resource is already a source folder, the corresponding C element is returned. -// * -// * @param resource the resource -// * @return the source folder -// */ -// public static ICContainer getSourceFolder(IResource resource) { -// if (resource != null && resource.exists()) { -// int resType = resource.getType(); -// if (resType == IResource.PROJECT || resType == IResource.FOLDER) { -// ICElement elem = CoreModel.getDefault().create(resource.getFullPath()); -// if (elem != null) { -// ICContainer sourceFolder = getSourceFolder(elem); -// if (sourceFolder != null) -// return sourceFolder; -// } -// } else { -// return getSourceFolder(resource.getParent()); -// } -// } -// return null; -// } - /** * Checks if a given resource is under a source root. * diff --git a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Parameter.java b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Parameter.java index 31e8aa81a2c..132704bbf6b 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Parameter.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Parameter.java @@ -30,5 +30,4 @@ public class C99Parameter extends C99Variable implements IParameter, ITypeable { param.setStatic(var.isStatic()); return param; } - } diff --git a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Variable.java b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Variable.java index a185634d97b..d1e812d3590 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Variable.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Variable.java @@ -23,8 +23,6 @@ import org.eclipse.core.runtime.PlatformObject; @SuppressWarnings("restriction") public class C99Variable extends PlatformObject implements IC99Binding, IVariable, ITypeable { - - private boolean isAuto; private boolean isExtern; private boolean isRegister; @@ -36,14 +34,12 @@ public class C99Variable extends PlatformObject implements IC99Binding, IVariabl private IScope scope; public C99Variable() { - } public C99Variable(String name) { this.name = name; } - public void setType(IType type) { this.type = type; } @@ -51,7 +47,6 @@ public class C99Variable extends PlatformObject implements IC99Binding, IVariabl public IType getType() { return type; } - public void setAuto(boolean auto) { this.isAuto = auto; @@ -60,7 +55,6 @@ public class C99Variable extends PlatformObject implements IC99Binding, IVariabl public boolean isAuto() { return isAuto; } - public void setExtern(boolean extern) { this.isExtern = extern; @@ -69,7 +63,6 @@ public class C99Variable extends PlatformObject implements IC99Binding, IVariabl public boolean isExtern() { return isExtern; } - public void setRegister(boolean isRegister) { this.isRegister = isRegister; @@ -78,7 +71,6 @@ public class C99Variable extends PlatformObject implements IC99Binding, IVariabl public boolean isRegister() { return isRegister; } - public void setStatic(boolean isStatic) { this.isStatic = isStatic; @@ -88,7 +80,6 @@ public class C99Variable extends PlatformObject implements IC99Binding, IVariabl return isStatic; } - public void setName(String name) { this.name = name; } @@ -123,4 +114,9 @@ public class C99Variable extends PlatformObject implements IC99Binding, IVariabl public IValue getInitialValue() { return null; } + + @Override + public String toString() { + return getName(); + } }