diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java index 7f43f0fa779..3e024b0ab8d 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java @@ -4629,12 +4629,12 @@ public class AST2CPPTests extends AST2TestBase { assertInstances(col, B, 4); } - // class X { - // public: - // void f(int); - // int a; - // }; - // int X:: * pmi = &X::a; + // class X { + // public: + // void f(int); + // int a; + // }; + // int X:: * pmi = &X::a; public void testBasicPointerToMember() throws Exception { IASTTranslationUnit tu = parse(getAboveComment(), CPP); assertEquals(tu.getDeclarations().length, 2); @@ -4644,12 +4644,11 @@ public class AST2CPPTests extends AST2TestBase { assertEquals("X::", po.getName().toString()); } - // struct B {}; - // struct D : B {}; - // void foo(D* dp) - // { - // B* bp = dynamic_cast(dp); - // } + // struct B {}; + // struct D : B {}; + // void foo(D* dp) { + // B* bp = dynamic_cast(dp); + // } public void testBug84466() throws Exception { IASTTranslationUnit tu = parse(getAboveComment(), CPP); ICPPASTCastExpression dynamic_cast = @@ -4663,8 +4662,7 @@ public class AST2CPPTests extends AST2TestBase { } public void testBug88338_CPP() throws Exception { - IASTTranslationUnit tu = parse( - "struct A; struct A* a;", CPP); + IASTTranslationUnit tu = parse("struct A; struct A* a;", CPP); NameCollector col = new NameCollector(); tu.accept(col); @@ -4692,11 +4690,11 @@ public class AST2CPPTests extends AST2TestBase { assertEquals(f.getNestedDeclarator().getName().toString(), "pfi"); } - // class X { public: int bar; }; - // void f(){ - // X a[10]; - // a[0].bar; - // } + // class X { public: int bar; }; + // void f(){ + // X a[10]; + // a[0].bar; + // } public void testBug95484() throws Exception { IASTTranslationUnit tu = parse(getAboveComment(), CPP); NameCollector col = new NameCollector(); @@ -4706,10 +4704,10 @@ public class AST2CPPTests extends AST2TestBase { assertSame(bar, col.getName(6).resolveBinding()); } - // int strcmp(const char *); - // void f(const char * const * argv){ - // strcmp(*argv); - // } + // int strcmp(const char *); + // void f(const char * const * argv){ + // strcmp(*argv); + // } public void testBug95419() throws Exception { IASTTranslationUnit tu = parse(getAboveComment(), CPP); NameCollector col = new NameCollector(); @@ -4719,14 +4717,14 @@ public class AST2CPPTests extends AST2TestBase { assertSame(strcmp, col.getName(4).resolveBinding()); } - // class Other; - // class Base { - // public: Base(Other *); - // }; - // class Sub : public Base { - // public: Sub(Other *); - // }; - // Sub::Sub(Other * b) : Base(b) {} + // class Other; + // class Base { + // public: Base(Other *); + // }; + // class Sub : public Base { + // public: Sub(Other *); + // }; + // Sub::Sub(Other * b) : Base(b) {} public void testBug95673() throws Exception { BindingAssertionHelper ba= getAssertionHelper(); @@ -4735,12 +4733,12 @@ public class AST2CPPTests extends AST2TestBase { assertSame(ctor, ctor2); } - // void mem(void *, const void *); - // void f() { - // char *x; int offset; - // mem(x, "FUNC"); - // mem(x + offset, "FUNC2"); - // } + // void mem(void *, const void *); + // void f() { + // char *x; int offset; + // mem(x, "FUNC"); + // mem(x + offset, "FUNC2"); + // } public void testBug95768() throws Exception { IASTTranslationUnit tu = parse(getAboveComment(), CPP); NameCollector col = new NameCollector(); @@ -4908,14 +4906,14 @@ public class AST2CPPTests extends AST2TestBase { assertSame(i, col.getName(7).resolveBinding()); } - // int f() { - // return 5; - // } - // int main() { - // int a(5); - // int b(f()); - // return a+b; - // } + // int f() { + // return 5; + // } + // int main() { + // int a(5); + // int b(f()); + // return a+b; + // } public void testBug86849() throws Exception { IASTTranslationUnit tu = parse(getAboveComment(), CPP); NameCollector col = new NameCollector(); @@ -6263,24 +6261,24 @@ public class AST2CPPTests extends AST2TestBase { // void test2(char []); // void test3(t); // void xx() { - // char* x= 0; - // test1(x); - // test2(x); // problem binding here - // test3(x); // problem binding here + // char* x= 0; + // test1(x); + // test2(x); + // test3(x); // } public void testAdjustmentOfParameterTypes_239975() throws Exception { parseAndCheckBindings(getAboveComment(), CPP); } // class A { - // public: - // void m(int c); + // public: + // void m(int c); // }; // // void test(char c) { - // void (A::* ptr2mem)(char); - // ptr2mem= reinterpret_cast(&A::m); - // ptr2mem= (void (A::*)(int))(0); + // void (A::* ptr2mem)(char); + // ptr2mem= reinterpret_cast(&A::m); + // ptr2mem= (void (A::*)(int))(0); // } public void testTypeIdForPtrToMember_242197() throws Exception { parseAndCheckBindings(getAboveComment(), CPP); @@ -7236,24 +7234,23 @@ public class AST2CPPTests extends AST2TestBase { } // class S { - // S(int); + // S(int); // }; // void test() { - // S **temp = new S*[1]; // problem on S - // temp = new S*; // problem on S - // temp = new (S*); // problem on S - // temp = new ::S*[1]; // problem on S - // temp = new ::S*; // problem on S - // temp = new (::S*); // problem on S + // S **temp = new S*[1]; + // temp = new S*; + // temp = new (S*); + // temp = new ::S*[1]; + // temp = new ::S*; + // temp = new (::S*); // } public void testNewPointerOfClass_267168() throws Exception { - final String code = getAboveComment(); - parseAndCheckBindings(code, CPP); + parseAndCheckBindings(); } // void f(char *(names[2])= 0); // void f2(const char *(n[])) { - // if (n && 1){} + // if (n && 1){} // } public void testPointerToArrayWithDefaultVal_267184() throws Exception { final String code = getAboveComment(); @@ -7270,10 +7267,10 @@ public class AST2CPPTests extends AST2TestBase { parseAndCheckBindings(code, CPP); } - // class X { - // virtual void pv() = 0; - // void (*ptrToFunc) ()= 0; - // }; + // class X { + // virtual void pv() = 0; + // void (*ptrToFunc) ()= 0; + // }; public void testPureVirtualVsInitDeclarator_267184() throws Exception { final String code = getAboveComment(); IASTTranslationUnit tu= parseAndCheckBindings(code, CPP); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTEnumerationSpecifier.java index f61564f2c8d..2169c725e33 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTEnumerationSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTEnumerationSpecifier.java @@ -20,22 +20,28 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn /** * This interface represents an enumerator member of an enum specifier. * - * @author jcamelon * @noimplement This interface is not intended to be implemented by clients. */ public interface IASTEnumerator extends IASTNode, IASTNameOwner { /** * Empty array (constant). */ - public static final IASTEnumerator[] EMPTY_ENUMERATOR_ARRAY = new IASTEnumerator[0]; + public static final IASTEnumerator[] EMPTY_ENUMERATOR_ARRAY = {}; /** - * ENUMERATOR_NAME describes the relationship between - * IASTEnumerator and IASTName. + * {@code ENUMERATOR_NAME} describes the relationship between + * {@code IASTEnumerator} and {@code IASTName}. */ public static final ASTNodeProperty ENUMERATOR_NAME = new ASTNodeProperty( "IASTEnumerator.ENUMERATOR_NAME - IASTName for IASTEnumerator"); //$NON-NLS-1$ + /** + * {@code ENUMERATOR_VALUE} describes the relationship between + * {@code IASTEnumerator} and {@code IASTExpression}. + */ + public static final ASTNodeProperty ENUMERATOR_VALUE = new ASTNodeProperty( + "IASTEnumerator.ENUMERATOR_VALUE - IASTExpression (value) for IASTEnumerator"); //$NON-NLS-1$ + /** * Set the enumerator's name. * @@ -46,17 +52,10 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn /** * Get the enumerator's name. * - * @return IASTName + * @return {@code IASTName} */ public IASTName getName(); - /** - * ENUMERATOR_VALUE describes the relationship between - * IASTEnumerator and IASTExpression. - */ - public static final ASTNodeProperty ENUMERATOR_VALUE = new ASTNodeProperty( - "IASTEnumerator.ENUMERATOR_VALUE - IASTExpression (value) for IASTEnumerator"); //$NON-NLS-1$ - /** * Sets enumerator value. * @@ -67,7 +66,7 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn /** * Returns enumerator value. * - * @return IASTExpression value + * @return {@code IASTExpression} value */ public IASTExpression getValue(); @@ -82,13 +81,19 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn */ @Override public IASTEnumerator copy(CopyStyle style); - } /** - * ENUMERATOR describes the relationship between - * IASTEnumerationSpecifier and the nested - * IASTEnumerators. + * {@code ENUMERATION_NAME} describes the relationship between + * {@code IASTEnumerationSpecifier} and its {@link IASTName}. + */ + public static final ASTNodeProperty ENUMERATION_NAME = new ASTNodeProperty( + "IASTEnumerationSpecifier.ENUMERATION_NAME - IASTName for IASTEnumerationSpecifier"); //$NON-NLS-1$ + + /** + * {@code ENUMERATOR} describes the relationship between + * {@code IASTEnumerationSpecifier} and the nested + * {@link IASTEnumerator}s. */ public static final ASTNodeProperty ENUMERATOR = new ASTNodeProperty( "IASTEnumerationSpecifier.ENUMERATOR - nested IASTEnumerator for IASTEnumerationSpecifier"); //$NON-NLS-1$ @@ -96,25 +101,17 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn /** * Adds an enumerator. * - * @param enumerator - * IASTEnumerator + * @param enumerator {@code IASTEnumerator} */ public void addEnumerator(IASTEnumerator enumerator); /** * Returns enumerators. * - * @return IASTEnumerator [] array + * @return {@code IASTEnumerator[]} array */ public IASTEnumerator[] getEnumerators(); - /** - * ENUMERATION_NAME describes the relationship between - * IASTEnumerationSpecifier and its IASTName. - */ - public static final ASTNodeProperty ENUMERATION_NAME = new ASTNodeProperty( - "IASTEnumerationSpecifier.ENUMERATION_NAME - IASTName for IASTEnumerationSpecifier"); //$NON-NLS-1$ - /** * Sets the enum's name. * @@ -123,7 +120,7 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn public void setName(IASTName name); /** - * Get the enum's name. + * Returns the enum's name. */ public IASTName getName(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IEnumeration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IEnumeration.java index 47577e3a252..47ee0f56c84 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IEnumeration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IEnumeration.java @@ -25,6 +25,7 @@ public interface IEnumeration extends IBinding, IType { * @since 5.2 */ long getMinValue(); + /** * @since 5.2 */ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IEnumerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IEnumerator.java index 8260314fc80..f58b81b7441 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IEnumerator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IEnumerator.java @@ -20,11 +20,11 @@ public interface IEnumerator extends IBinding { /** * Returns the type of this enumeration. The type of an enumerator * is the enumeration in which it is declared. - * + * * @return the type of the enumeration */ public IType getType(); - + /** * Returns the value assigned to this enumerator. * @since 5.1 diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTEnumerationSpecifier.java index 0910d79f7c9..4ea40433a9c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTEnumerationSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTEnumerationSpecifier.java @@ -6,7 +6,7 @@ * 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.cpp; @@ -14,14 +14,13 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty; import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier; /** - * enum struct : unsigned int {...} + * enum struct : unsigned int {...} * * @since 5.2 * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. */ public interface ICPPASTEnumerationSpecifier extends IASTEnumerationSpecifier, ICPPASTDeclSpecifier { - public static final ASTNodeProperty BASE_TYPE = new ASTNodeProperty( "ICPPASTEnumerationSpecifier.BASE_TYPE [ICPPASTDeclSpecifier]"); //$NON-NLS-1$ @@ -35,18 +34,17 @@ public interface ICPPASTEnumerationSpecifier extends IASTEnumerationSpecifier, I public ICPPASTEnumerationSpecifier copy(CopyStyle style); /** - * Not allowed on frozen ast. + * Not allowed on frozen AST. */ public void setIsScoped(boolean isScoped); /** - * An enum is scoped if it uses the enumeration head - * enum class or enum struct + * An enum is scoped if it uses the enumeration head {@code enum class} or {@code enum struct}. */ public boolean isScoped(); /** - * Not allowed on frozen ast. + * Not allowed on frozen AST. */ public void setIsOpaque(boolean isOpaque); @@ -61,13 +59,13 @@ public interface ICPPASTEnumerationSpecifier extends IASTEnumerationSpecifier, I public void setBaseType(ICPPASTDeclSpecifier baseType); /** - * Returns the base type for this enum or null if it was not specified. + * Returns the base type for this enum or {@code null} if it was not specified. */ public ICPPASTDeclSpecifier getBaseType(); /** - * Returns the scope containing the enumerators of this enumeration, or null if the specifier - * is opaque. + * Returns the scope containing the enumerators of this enumeration, + * or {@code null} if the specifier is opaque. */ public ICPPScope getScope(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTEnumerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTEnumerator.java index ff3726895e8..64b910d26e1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTEnumerator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTEnumerator.java @@ -114,7 +114,7 @@ public abstract class ASTEnumerator extends ASTNode implements IASTEnumerator, I IASTNode parent= getParent(); if (parent instanceof IASTInternalEnumerationSpecifier) { IASTInternalEnumerationSpecifier ies= (IASTInternalEnumerationSpecifier) parent; - if (ies.startValueComputation()) { // prevents infinite recursions + if (ies.startValueComputation()) { // Prevent infinite recursion. createEnumValues((IASTEnumerationSpecifier) parent); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ArithmeticConversion.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ArithmeticConversion.java index c9e68fe1402..8024045af06 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ArithmeticConversion.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ArithmeticConversion.java @@ -340,7 +340,7 @@ public abstract class ArithmeticConversion { if (basicTarget.isShort()) { return Short.MIN_VALUE <= n && n <= Short.MAX_VALUE; } - // Can't represent long longs with java longs. + // Can't represent long longs with Java longs. if (basicTarget.isLong() || basicTarget.isLongLong()) { return true; } @@ -352,7 +352,7 @@ public abstract class ArithmeticConversion { if (basicTarget.isShort()) { return n < (Short.MAX_VALUE + 1L) * 2; } - // Can't represent long longs with java longs. + // Can't represent long longs with Java longs. if (basicTarget.isLong() || basicTarget.isLongLong()) { return true; } @@ -419,9 +419,10 @@ public abstract class ArithmeticConversion { long sizeofSource = sourceSizeAndAlignment == null ? getApproximateSize(source) : sourceSizeAndAlignment.size; long sizeofTarget = targetSizeAndAlignment == null ? getApproximateSize(target) : targetSizeAndAlignment.size; - if (sizeofSource == sizeofTarget) + if (sizeofSource == sizeofTarget) { return target.isUnsigned() == source.isUnsigned(); - else + } else { return sizeofSource < sizeofTarget; + } } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/IASTInternalEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/IASTInternalEnumerationSpecifier.java index 0acd5ec5b71..90ae59b2811 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/IASTInternalEnumerationSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/IASTInternalEnumerationSpecifier.java @@ -17,7 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier; */ public interface IASTInternalEnumerationSpecifier extends IASTEnumerationSpecifier { /** - * Notifies that the value computation for the enumeration is started. Returns whether this is + * Notifies that the value computation for the enumeration has started. Returns whether this is * the first attempt to do so. */ boolean startValueComputation(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEnumerationSpecifier.java index 680c115c882..ac6316af847 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEnumerationSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEnumerationSpecifier.java @@ -6,9 +6,9 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * John Camelon (IBM Rational Software) - Initial API and implementation - * Markus Schorn (Wind River Systems) - * Yuan Zhang / Beth Tibbitts (IBM Research) + * John Camelon (IBM Rational Software) - Initial API and implementation + * Markus Schorn (Wind River Systems) + * Yuan Zhang / Beth Tibbitts (IBM Research) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.c; @@ -23,10 +23,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTInternalEnumerationSpecifier */ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier implements IASTInternalEnumerationSpecifier, ICASTEnumerationSpecifier { - private IASTName name; - private boolean valuesComputed= false; - + private boolean valuesComputed; public CASTEnumerationSpecifier() { } @@ -54,7 +52,6 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier return super.copy(copy, style); } - @Override public boolean startValueComputation() { if (valuesComputed) @@ -70,20 +67,19 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier if (enumerator != null) { enumerator.setParent(this); enumerator.setPropertyInParent(ENUMERATOR); - enumerators = ArrayUtil.appendAt( IASTEnumerator.class, enumerators, ++enumeratorsPos, enumerator ); + enumerators = ArrayUtil.appendAt(IASTEnumerator.class, enumerators, ++enumeratorsPos, enumerator); } } - @Override public IASTEnumerator[] getEnumerators() { - if( enumerators == null ) return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY; - enumerators = ArrayUtil.trimAt( IASTEnumerator.class, enumerators, enumeratorsPos ); + if (enumerators == null) return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY; + enumerators = ArrayUtil.trimAt(IASTEnumerator.class, enumerators, enumeratorsPos); return enumerators; } private IASTEnumerator [] enumerators = null; - private int enumeratorsPos=-1; + private int enumeratorsPos = -1; @Override @@ -102,34 +98,35 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier } @Override - public boolean accept( ASTVisitor action ){ - if( action.shouldVisitDeclSpecifiers ){ - 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.shouldVisitDeclSpecifiers) { + 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; IASTEnumerator[] etors = getEnumerators(); - for ( int i = 0; i < etors.length; i++ ) { - if( !etors[i].accept( action ) ) return false; + for (int i = 0; i < etors.length; i++) { + if (!etors[i].accept(action)) + return false; } - if( action.shouldVisitDeclSpecifiers ){ - switch( action.leave( this ) ){ - case ASTVisitor.PROCESS_ABORT : return false; - case ASTVisitor.PROCESS_SKIP : return true; - default : break; + if (action.shouldVisitDeclSpecifiers) { + switch(action.leave(this)) { + case ASTVisitor.PROCESS_ABORT: return false; + case ASTVisitor.PROCESS_SKIP: return true; + default: break; } } return true; } @Override - public int getRoleForName(IASTName n ) { - if( this.name == n ) + public int getRoleForName(IASTName n) { + if (this.name == n) return r_definition; return r_unclear; } - } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEnumerationSpecifier.java index 1496b64957d..6424e2d816c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEnumerationSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEnumerationSpecifier.java @@ -52,9 +52,9 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier @Override public CPPASTEnumerationSpecifier copy(CopyStyle style) { - CPPASTEnumerationSpecifier copy = - new CPPASTEnumerationSpecifier(fIsScoped, fName == null ? null : fName.copy(style), - fBaseType == null ? null : fBaseType.copy(style)); + CPPASTEnumerationSpecifier copy = new CPPASTEnumerationSpecifier(fIsScoped, + fName == null ? null : fName.copy(style), + fBaseType == null ? null : fBaseType.copy(style)); copy.fIsOpaque = fIsOpaque; for (IASTEnumerator enumerator : getEnumerators()) { copy.addEnumerator(enumerator == null ? null : enumerator.copy(style)); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBaseClause.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBaseClause.java index a4a8766e86d..a26ce7f838b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBaseClause.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBaseClause.java @@ -89,6 +89,7 @@ public class CPPBaseClause implements ICPPBase, ICPPInternalBase { } @Override + @Deprecated public IName getBaseClassSpecifierName() { return base.getName(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredFunction.java index db8cc030f9c..bc13b50c14b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredFunction.java @@ -34,6 +34,7 @@ public class CPPDeferredFunction extends CPPUnknownBinding implements ICPPDeferr * Creates a CPPDeferredFunction given a set of overloaded functions * (some of which may be templates) that the function might resolve to. * At least one candidate must be provided. + * * @param candidates a set of overloaded functions, some of which may be templates * @return the constructed CPPDeferredFunction */ @@ -47,7 +48,8 @@ public class CPPDeferredFunction extends CPPUnknownBinding implements ICPPDeferr /** * Creates a CPPDeferredFunction given a name. This is for cases where there - * are no candidates that could be passed to createForCandidates(). + * are no candidates that could be passed to {@link #createForCandidates}. + * * @param name the name of the function * @return the constructed CPPDeferredFunction */ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPEnumeration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPEnumeration.java index 07f992a44ce..2184bfa90fc 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPEnumeration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPEnumeration.java @@ -47,7 +47,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil; import org.eclipse.core.runtime.PlatformObject; /** - * Enumerations in C++ + * Enumeration in C++ */ public class CPPEnumeration extends PlatformObject implements ICPPEnumeration, ICPPInternalBinding { private static final IASTName NOT_INITIALIZED = CPPASTName.NOT_INITIALIZED; @@ -90,8 +90,8 @@ public class CPPEnumeration extends PlatformObject implements ICPPEnumeration, I private Long fMaxValue; private Long fMinValue; - private ICPPEnumeration fIndexBinding= null; - private boolean fSearchedIndex= false; + private ICPPEnumeration fIndexBinding; + private boolean fSearchedIndex; public CPPEnumeration(ICPPASTEnumerationSpecifier spec, IType fixedType) { final IASTName name = spec.getName(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPEnumerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPEnumerator.java index eab149b455c..e6faff54cc9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPEnumerator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPEnumerator.java @@ -43,56 +43,35 @@ public class CPPEnumerator extends PlatformObject implements IEnumerator, ICPPIn enumerator.setBinding(this); } - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPBinding#getDeclarations() - */ @Override public IASTNode[] getDeclarations() { return null; } - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPBinding#getDefinition() - */ @Override public IASTNode getDefinition() { return enumName; } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.IBinding#getName() - */ @Override public String getName() { return new String(getNameCharArray()); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.IBinding#getNameCharArray() - */ @Override public char[] getNameCharArray() { return enumName.getSimpleID(); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.IBinding#getScope() - */ @Override public IScope getScope() { return CPPVisitor.getContainingScope(enumName); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.IBinding#getPhysicalNode() - */ public IASTNode getPhysicalNode() { return enumName; } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.IEnumerator#getType() - */ @Override public IType getType() { IASTEnumerator etor = (IASTEnumerator) enumName.getParent(); @@ -100,25 +79,16 @@ public class CPPEnumerator extends PlatformObject implements IEnumerator, ICPPIn return (IType) enumSpec.getName().resolveBinding(); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.IBinding#getFullyQualifiedName() - */ @Override public String[] getQualifiedName() { return CPPVisitor.getQualifiedName(this); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.IBinding#getFullyQualifiedNameCharArray() - */ @Override public char[][] getQualifiedNameCharArray() { return CPPVisitor.getQualifiedNameCharArray(this); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#isGloballyQualified() - */ @Override public boolean isGloballyQualified() throws DOMException { IScope scope = getScope(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPEvaluation.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPEvaluation.java index bb8dec7d1b1..0a787701c77 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPEvaluation.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPEvaluation.java @@ -88,7 +88,7 @@ public interface ICPPEvaluation extends ISerializableEvaluation { /** * Keeps track of state during a constexpr evaluation. */ - class ConstexprEvaluationContext { + final class ConstexprEvaluationContext { /** * The maximum number of steps allowed in a single constexpr evaluation. * This is used to prevent a buggy constexpr function from causing the @@ -100,7 +100,7 @@ public interface ICPPEvaluation extends ISerializableEvaluation { private IASTNode fPoint; /** - * Construct a ConstexprEvaluationContext for a new constexpr evaluation. + * Constructs a ConstexprEvaluationContext for a new constexpr evaluation. * @param point the point of instantiation, determines the scope for name lookups */ public ConstexprEvaluationContext(IASTNode point) { @@ -109,7 +109,8 @@ public interface ICPPEvaluation extends ISerializableEvaluation { } /** - * Record a new step being performed in this constexpr evaluation. + * Records a new step being performed in this constexpr evaluation. + * * @return this constexpr evaluation */ public ConstexprEvaluationContext recordStep() { @@ -118,14 +119,14 @@ public interface ICPPEvaluation extends ISerializableEvaluation { } /** - * Get the number of steps performed so far in the constexpr evaluation. + * Returns the number of steps performed so far in the constexpr evaluation. */ public int getStepsPerformed() { return fStepsPerformed; } /** - * Get the point of instantiation. + * Returns the point of instantiation. */ public IASTNode getPoint() { return fPoint; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java index 61f6c9595ac..59986c798a3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java @@ -982,7 +982,7 @@ public class CPPTemplates { spec = enumSpec.specializeEnumerator(enumerator); } else if (decl instanceof ICPPUsingDeclaration) { IBinding[] delegates= ((ICPPUsingDeclaration) decl).getDelegates(); - List result= new ArrayList(); + List result= new ArrayList<>(); ICPPClassSpecialization within = getSpecializationContext(owner); for (IBinding delegate : delegates) { try { @@ -2853,7 +2853,7 @@ public class CPPTemplates { if (keys.length == 0) return ObjectMap.EMPTY_MAP; - List defs= new ArrayList(); + List defs= new ArrayList<>(); IBinding owner= b; while (owner != null) { if (owner instanceof ICPPTemplateDefinition) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeTraits.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeTraits.java index d5493bed5ed..81d1e595e6a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeTraits.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeTraits.java @@ -165,20 +165,20 @@ public class TypeTraits { } /** - * Returns true if and only if the given class has a trivial copy constructor. + * Returns {@code true} if and only if the given class has a trivial copy constructor. * A copy constructor is trivial if: *
    *
  • it is implicitly defined by the compiler, and
  • - *
  • isPolymorphic(classType) is false, and
  • + *
  • {@code isPolymorphic(classType)} is {@code false}, and
  • *
  • the class has no virtual base classes, and
  • *
  • every direct base class has trivial copy constructor, and
  • *
  • for every nonstatic data member that has class type or array of class type, that type * has trivial copy constructor.
  • *
- * Similar to std::tr1::has_trivial_copy. + * Similar to {@code std::tr1::has_trivial_copy}. * * @param classType the class to check - * @return true if the class has a trivial copy constructor + * @return {@code true} if the class has a trivial copy constructor */ public static boolean hasTrivialCopyCtor(ICPPClassType classType, IASTNode point) { if (getImplicitCopyCtor(classType, point) == null) @@ -207,7 +207,7 @@ public class TypeTraits { } /** - * Returns true if and only if the given class has a trivial default constructor. + * Returns {@code true} if and only if the given class has a trivial default constructor. * A default constructor is trivial if: *
    *
  • it is implicitly defined by the compiler, and
  • @@ -215,11 +215,11 @@ public class TypeTraits { *
  • for every nonstatic data member that has class type or array of class type, that type * has trivial default constructor.
  • *
- * Similar to std::tr1::has_trivial_default_constructor. + * Similar to {@code std::tr1::has_trivial_default_constructor}. * * @param classType the class to check * @param point - * @return true if the class has a trivial default constructor + * @return {@code true} if the class has a trivial default constructor */ public static boolean hasTrivialDefaultConstructor(ICPPClassType classType, IASTNode point) { for (ICPPConstructor ctor : ClassTypeHelper.getConstructors(classType, point)) { @@ -244,7 +244,7 @@ public class TypeTraits { } /** - * Returns true if and only if the given class has a trivial destructor. + * Returns {@code true} if and only if the given class has a trivial destructor. * A destructor is trivial if: *
    *
  • it is implicitly defined by the compiler, and
  • @@ -252,10 +252,10 @@ public class TypeTraits { *
  • for every nonstatic data member that has class type or array of class type, that type * has trivial destructor.
  • *
- * Similar to std::tr1::has_trivial_destructor. + * Similar to {@code std::tr1::has_trivial_destructor}. * * @param classType the class to check - * @return true if the class has a trivial destructor + * @return {@code true} if the class has a trivial destructor */ public static boolean hasTrivialDestructor(ICPPClassType classType, IASTNode point) { for (ICPPMethod method : ClassTypeHelper.getDeclaredMethods(classType, point)) { @@ -280,11 +280,11 @@ public class TypeTraits { } /** - * Returns true if and only if the given class declares or inherits a virtual - * function. Similar to std::tr1::is_polymorphic. + * Returns {@code true} if and only if the given class declares or inherits a virtual + * function. Similar to {@code std::tr1::is_polymorphic}. * * @param classType the class to check - * @return true if the class declares or inherits a virtual function. + * @return {@code true} if the class declares or inherits a virtual function. */ public static boolean isPolymorphic(ICPPClassType classType, IASTNode point) { if (hasDeclaredVirtualMethod(classType, point)) @@ -310,12 +310,12 @@ public class TypeTraits { } /** - * Returns the compiler-generated copy constructor for the given class, or null + * Returns the compiler-generated copy constructor for the given class, or {@code null} * if the class doesn't have a compiler-generated copy constructor. * * @param classType the class to get the copy ctor for. - * @return the compiler-generated copy constructor, or null if the class doesn't - * have a compiler-generated copy constructor. + * @return the compiler-generated copy constructor, or {@code null} if the class doesn't + * have a compiler-generated copy constructor. */ private static ICPPConstructor getImplicitCopyCtor(ICPPClassType classType, IASTNode point) { for (ICPPConstructor ctor : ClassTypeHelper.getConstructors(classType, point)) { @@ -383,10 +383,10 @@ public class TypeTraits { private static IBasicType smallestFittingType(ICPPEnumeration enumeration, ICPPBasicType... types) { for (int i = 0; i < types.length - 1; ++i) { if (ArithmeticConversion.fitsIntoType(types[i], enumeration.getMinValue()) - && ArithmeticConversion.fitsIntoType(types[i], enumeration.getMaxValue())) { + && ArithmeticConversion.fitsIntoType(types[i], enumeration.getMaxValue())) { return types[i]; } } - return types[types.length - 1]; // assume it fits into the largest type provided + return types[types.length - 1]; // Assume it fits into the largest type provided. } }