From 9240257992f3cffea3f8587a7e86a625d25d9f9e Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Fri, 11 Mar 2016 15:46:31 -0500 Subject: [PATCH] Cosmetics. Change-Id: If6660920227beedfa8d2c39c3e24cf1bd6454d5e --- .../org/eclipse/cdt/core/dom/ast/ASTVisitor.java | 2 +- .../org/eclipse/cdt/core/dom/ast/IBinding.java | 2 +- .../internal/ui/refactoring/utils/ASTHelper.java | 14 +++++--------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java index 6bce6af22eb..004348f55fe 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java @@ -308,7 +308,7 @@ public abstract class ASTVisitor { return PROCESS_CONTINUE; } - public int visit( IASTProblem problem ){ + public int visit(IASTProblem problem) { return PROCESS_CONTINUE; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBinding.java index 69906fad107..83045494b5e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBinding.java @@ -45,7 +45,7 @@ public interface IBinding extends IAdaptable { public ILinkage getLinkage(); /** - * Returns the binding that owns this binding, or null if there is no owner. + * Returns the binding that owns this binding, or {@code null} if there is no owner. *

* The owner is determined as follows: *
{@link ICPPUsingDeclaration}: The owner depends on where the declaration is found, diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ASTHelper.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ASTHelper.java index 7acb0a00ea1..6fe1e4515de 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ASTHelper.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ASTHelper.java @@ -40,14 +40,14 @@ public class ASTHelper { private ASTHelper() { } - static public IASTNode getDeclarationForNode(IASTNode node) { + public static IASTNode getDeclarationForNode(IASTNode node) { while (node != null && !(node instanceof IASTSimpleDeclaration) && !(node instanceof IASTParameterDeclaration)) { node = node.getParent(); } return node; } - static public IASTDeclarator getDeclaratorForNode(IASTNode node) { + public static IASTDeclarator getDeclaratorForNode(IASTNode node) { IASTNode tmpNode = getDeclarationForNode(node); IASTDeclarator declarator = null; @@ -63,7 +63,7 @@ public class ASTHelper { return declarator; } - static public IASTDeclSpecifier getDeclarationSpecifier(IASTNode declaration) { + public static IASTDeclSpecifier getDeclarationSpecifier(IASTNode declaration) { if (declaration != null) { if (declaration instanceof IASTSimpleDeclaration) { IASTSimpleDeclaration simpleDecl = (IASTSimpleDeclaration) declaration; @@ -122,9 +122,7 @@ public class ASTHelper { IASTTranslationUnit unit, String aktFileName) { Collection statements = new ArrayList(); for (IASTPreprocessorStatement aktStatement : unit.getAllPreprocessorStatements()) { - if (aktStatement.getFileLocation() == null) { - continue; - } else if (aktStatement.getFileLocation().getFileName().equals(aktFileName)) { + if (aktStatement.getFileLocation() != null && aktStatement.getFileLocation().getFileName().equals(aktFileName)) { statements.add(aktStatement); } } @@ -134,9 +132,7 @@ public class ASTHelper { public static Collection getAllInFileDeclarations(IASTTranslationUnit unit, String aktFileName) { Collection decls = new ArrayList(); for (IASTDeclaration aktDecl: unit.getDeclarations()) { - if (aktDecl.getFileLocation() == null) { - continue; - } else if (aktDecl.getFileLocation().getFileName().equals(aktFileName)) { + if (aktDecl.getFileLocation() != null && aktDecl.getFileLocation().getFileName().equals(aktFileName)) { decls.add(aktDecl); } }