diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompositeTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompositeTypeSpecifier.java index 63ffc95b19c..446c1d11b9a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompositeTypeSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompositeTypeSpecifier.java @@ -18,51 +18,54 @@ package org.eclipse.cdt.core.dom.ast; */ public interface IASTCompositeTypeSpecifier extends IASTDeclSpecifier, IASTNameOwner, IASTDeclarationListOwner { /** - * TYPE_NAME represents the relationship between an - * IASTCompositeTypeSpecifier and its IASTName. + * {@code k_struct} represents 'struct' in C and C++. + */ + public static final int k_struct = 1; + + /** + * {@code k_union} represents 'union' in C and C++. + */ + public static final int k_union = 2; + + /** + * {@code k_last} allows for subinterfaces to continue enumerating keys. + */ + public static final int k_last = k_union; + + /** + * {@code TYPE_NAME} represents the relationship between an + * {@code IASTCompositeTypeSpecifier} and its {@code IASTName}. */ public static final ASTNodeProperty TYPE_NAME = new ASTNodeProperty( "IASTCompositeTypeSpecifier.TYPE_NAME - IASTName for IASTCompositeTypeSpecifier"); //$NON-NLS-1$ /** - * MEMBER_DECLARATION represents the relationship between an - * IASTCompositeTypeSpecifier and its nestedIASTDeclarations. + * {@code MEMBER_DECLARATION} represents the relationship between an + * {@code IASTCompositeTypeSpecifier} and its nested{@code IASTDeclaration}s. */ public static final ASTNodeProperty MEMBER_DECLARATION = new ASTNodeProperty( "IASTCompositeTypeSpecifier.MEMBER_DECLARATION - Nested IASTDeclaration for IASTCompositeTypeSpecifier"); //$NON-NLS-1$ /** - * Get the type (key) of this composite specifier. + * Returns the type (key) of this composite specifier. * * @return key for this type + * @see #k_struct + * @see #k_union */ public int getKey(); /** - * k_struct represents 'struct' in C & C++ - */ - public static final int k_struct = 1; - - /** - * k_union represents 'union' in C & C++ - */ - public static final int k_union = 2; - - /** - * k_last allows for subinterfaces to continue enumerating - * keys - */ - public static final int k_last = k_union; - - /** - * Set the type (key) of this composite specifier. + * Sets the type (key) of this composite specifier. * * @param key + * @see #k_struct + * @see #k_union */ public void setKey(int key); /** - * Return the name for this composite type. If this is an anonymous type, + * Returns the name for this composite type. If this is an anonymous type, * this will return an empty name. * * @return the name of the type @@ -70,7 +73,7 @@ public interface IASTCompositeTypeSpecifier extends IASTDeclSpecifier, IASTNameO public IASTName getName(); /** - * Set the name for this composite type. + * Sets the name for this composite type. * * @param name */ @@ -84,15 +87,14 @@ public interface IASTCompositeTypeSpecifier extends IASTDeclSpecifier, IASTNameO public IASTDeclaration[] getMembers(); /** - * Add a member declaration. + * Adds a member declaration. * * @param declaration */ public void addMemberDeclaration(IASTDeclaration declaration); /** - * Get the scope that this interface eludes to in the logical tree. - * + * Returns the scope that this interface eludes to in the logical tree. */ public IScope getScope(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ICompositeType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ICompositeType.java index 1a9add73a46..1ecc7f0aba1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ICompositeType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ICompositeType.java @@ -11,7 +11,7 @@ package org.eclipse.cdt.core.dom.ast; /** - * Interface for all composite types: classes, structs or unions. + * Interface for all composite types: classes, structs and unions. * * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTCompositeTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTCompositeTypeSpecifier.java index e370d71331a..82d800c926f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTCompositeTypeSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTCompositeTypeSpecifier.java @@ -24,23 +24,23 @@ import org.eclipse.cdt.core.dom.ast.IASTNode; */ public interface ICPPASTCompositeTypeSpecifier extends IASTCompositeTypeSpecifier, ICPPASTDeclSpecifier { /** - * k_class C++ introduces the class concept for composite types. + * {@code k_class} C++ introduces the class concept for composite types. */ public static final int k_class = IASTCompositeTypeSpecifier.k_last + 1; /** - * k_last allows for subinterfaces to extend the kind type. + * {@code k_last} allows for subinterfaces to extend the kind type. */ public static final int k_last = k_class; /** - * VISIBILITY_LABEL is used to express the relationship for a visibility label "declaration". + * {@code VISIBILITY_LABEL} is used to express the relationship for a visibility label "declaration". */ public static final ASTNodeProperty VISIBILITY_LABEL = new ASTNodeProperty( "ICPPASTCompositeTypeSpecifier.VISIBILITY_LABEL - Visibility label \"declaration\""); //$NON-NLS-1$ /** - * BASE_SPECIFIER expresses the subclass role. + * {@code BASE_SPECIFIER} expresses the subclass role. */ public static final ASTNodeProperty BASE_SPECIFIER = new ASTNodeProperty( "ICPPASTCompositeTypeSpecifier.BASE_SPECIFIER - Expresses the subclass role"); //$NON-NLS-1$ @@ -50,21 +50,13 @@ public interface ICPPASTCompositeTypeSpecifier extends IASTCompositeTypeSpecifie "ICPPASTCompositeTypeSpecifier.CLASS_VIRT_SPECIFIER [ICPPASTClassVirtSpecifier]"); //$NON-NLS-1$ /** - * Base Specifiers are where a class expresses from whom it inherits. + * Base specifiers are where a class expresses from whom it inherits. * * @noimplement This interface is not intended to be implemented by clients. */ public static interface ICPPASTBaseSpecifier extends IASTNode, IASTNameOwner, ICPPASTPackExpandable { public static final ICPPASTBaseSpecifier[] EMPTY_BASESPECIFIER_ARRAY = {}; - /** - * @deprecated Use {@link ICPPASTBaseSpecifier#NAME_SPECIFIER} instead. - * @noreference This field is not intended to be referenced by clients. - */ - @Deprecated - public static final ASTNodeProperty NAME = new ASTNodeProperty( - "ICPPASTBaseSpecifier.NAME - Name of base class"); //$NON-NLS-1$ - /** * Relation between base specifier and its name specifier. * @@ -73,6 +65,14 @@ public interface ICPPASTCompositeTypeSpecifier extends IASTCompositeTypeSpecifie public static final ASTNodeProperty NAME_SPECIFIER = new ASTNodeProperty( "ICPPASTBaseSpecifier.NAME_SPECIFIER - Name specifier of base class"); //$NON-NLS-1$ + /** + * @deprecated Use {@link ICPPASTBaseSpecifier#NAME_SPECIFIER} instead. + * @noreference This field is not intended to be referenced by clients. + */ + @Deprecated + public static final ASTNodeProperty NAME = new ASTNodeProperty( + "ICPPASTBaseSpecifier.NAME - Name of base class"); //$NON-NLS-1$ + public static final int v_public = ICPPASTVisibilityLabel.v_public; public static final int v_protected = ICPPASTVisibilityLabel.v_protected; public static final int v_private = ICPPASTVisibilityLabel.v_private; @@ -193,7 +193,7 @@ public interface ICPPASTCompositeTypeSpecifier extends IASTCompositeTypeSpecifie public ICPPASTClassVirtSpecifier getVirtSpecifier(); /** - * Set the class-virt-specifier for this class. + * Sets the class-virt-specifier for this class. * @since 5.7 */ public void setVirtSpecifier(ICPPASTClassVirtSpecifier virtSpecifier); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java index 777e0555cd2..8732dc6a879 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java @@ -128,8 +128,9 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp public CPPClassType(IASTName name, IBinding indexBinding) { name = stripQualifier(name); IASTNode parent = name.getParent(); - while (parent instanceof IASTName) + while (parent instanceof IASTName) { parent = parent.getParent(); + } if (parent instanceof IASTCompositeTypeSpecifier) { definition = name; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java index e8ad1a55edc..71d6ae1fe60 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java @@ -541,13 +541,14 @@ public class CPPVisitor extends ASTQueries { } } - // Create a binding + // Create a binding. if (elabType.getKind() != IASTElaboratedTypeSpecifier.k_enum) { - if (templateDecl != null) + if (templateDecl != null) { binding = new CPPClassTemplate(name); - else + } else { binding = new CPPClassType(name, binding); - // name may live in a different scope, so make sure to add it to the owner scope, as well. + } + // Name may live in a different scope, so make sure to add it to the owner scope as well. ASTInternal.addName(scope, elabType.getName()); } } catch (DOMException e) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/refactoring/actions/RefactoringAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/refactoring/actions/RefactoringAction.java index ce247a74fe3..6d9ee01f505 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/refactoring/actions/RefactoringAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/refactoring/actions/RefactoringAction.java @@ -6,8 +6,8 @@ * 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.ui.refactoring.actions; import org.eclipse.jface.action.Action; @@ -43,7 +43,7 @@ public abstract class RefactoringAction extends Action { /** * Sets behavior with respect to saving dirty editors. * @param saveRequired if true, dirty editors will be saved before refactoring. - * + * * @deprecated saving of editors should be controlled by refactoring runner, not by the action. * @since 5.3 */ @@ -65,7 +65,7 @@ public abstract class RefactoringAction extends Action { fEditor= null; fSite= site; } - + @Override public final void run() { if (saveRequired) { @@ -84,11 +84,9 @@ public abstract class RefactoringAction extends Action { run(fEditor.getSite(), wc, (ITextSelection) s); } } - } else if (fSite != null) { - if (fElement != null) { - run(fSite, fElement); - } - } + } else if (fSite != null && fElement != null) { + run(fSite, fElement); + } } public void updateSelection(ICElement elem) {