From 06bcfad23826c4180e650ef910514ce1c62cd26b Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Wed, 15 May 2013 17:49:42 -0700 Subject: [PATCH] Cosmetics. --- .../dom/parser/cpp/CPPImplicitFunction.java | 38 ++++++++----------- .../dom/parser/cpp/CPPImplicitMethod.java | 17 +++++---- .../core/dom/parser/cpp/CPPMethod.java | 19 +--------- .../internal/core/pdom/dom/PDOMBinding.java | 16 ++++---- 4 files changed, 33 insertions(+), 57 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitFunction.java index 5e50718b1fd..4e6f3770893 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitFunction.java @@ -6,8 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM - Initial API and implementation - * Markus Schorn (Wind River Systems) + * IBM - Initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -23,25 +23,25 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter; * An example is GCC built-in functions. */ public class CPPImplicitFunction extends CPPFunction { - - private ICPPParameter[] parms=null; - private IScope scope=null; - private ICPPFunctionType functionType=null; + private ICPPParameter[] parms; + private IScope scope; + private ICPPFunctionType functionType; private final boolean takesVarArgs; private boolean isDeleted; private final char[] name; - public CPPImplicitFunction(char[] name, IScope scope, ICPPFunctionType type, ICPPParameter[] parms, boolean takesVarArgs) { - super( null ); - this.name=name; - this.scope=scope; + public CPPImplicitFunction(char[] name, IScope scope, ICPPFunctionType type, + ICPPParameter[] parms, boolean takesVarArgs) { + super(null); + this.name= name; + this.scope= scope; this.functionType= type; - this.parms=parms; - this.takesVarArgs=takesVarArgs; + this.parms= parms; + this.takesVarArgs= takesVarArgs; } @Override - public ICPPParameter [] getParameters() { + public ICPPParameter[] getParameters() { return parms; } @@ -52,27 +52,19 @@ public class CPPImplicitFunction extends CPPFunction { @Override public String getName() { - return String.valueOf( name ); + return String.valueOf(name); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.IBinding#getNameCharArray() - */ @Override public char[] getNameCharArray() { return name; } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.IBinding#getScope() - */ + @Override public IScope getScope() { return scope; } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.IFunction#getFunctionScope() - */ @Override public IScope getFunctionScope() { return null; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java index 3425de5f07b..0a5f54b54d4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java @@ -61,17 +61,18 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod } if (parent instanceof IASTCompositeTypeSpecifier) { IASTCompositeTypeSpecifier cls = (IASTCompositeTypeSpecifier) decl.getParent(); - IASTDeclaration [] members = cls.getMembers(); + IASTDeclaration[] members = cls.getMembers(); ICPPASTVisibilityLabel vis = null; for (IASTDeclaration member : members) { - if( member instanceof ICPPASTVisibilityLabel ) + if (member instanceof ICPPASTVisibilityLabel) { vis = (ICPPASTVisibilityLabel) member; - else if( member == decl ) + } else if (member == decl) { break; + } } - if( vis != null ){ + if (vis != null) { return vis.getVisibility(); - } else if( cls.getKey() == ICPPASTCompositeTypeSpecifier.k_class ){ + } else if (cls.getKey() == ICPPASTCompositeTypeSpecifier.k_class) { return ICPPASTVisibilityLabel.v_private; } } @@ -80,7 +81,7 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod @Override public ICPPClassType getClassOwner() { - ICPPClassScope scope = (ICPPClassScope)getScope(); + ICPPClassScope scope = (ICPPClassScope) getScope(); return scope.getClassType(); } @@ -167,8 +168,8 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod @Override public boolean isDestructor() { - char [] n = getNameCharArray(); - if( n != null && n.length > 0 ) + char[] n = getNameCharArray(); + if (n != null && n.length > 0) return n[0] == '~'; return false; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java index 0a673b62c1a..d7c48d63df8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java @@ -131,8 +131,8 @@ public class CPPMethod extends CPPFunction implements ICPPMethod { dtor= ASTQueries.findInnermostDeclarator(dtor); IASTName name= dtor.getName(); if (name instanceof ICPPASTQualifiedName) { - IASTName[] ns = ((ICPPASTQualifiedName)name).getNames(); - name = ns[ ns.length - 1 ]; + IASTName[] ns = ((ICPPASTQualifiedName) name).getNames(); + name = ns[ns.length - 1]; } return name; } @@ -142,9 +142,6 @@ public class CPPMethod extends CPPFunction implements ICPPMethod { return CPPVisitor.getContainingScope(getASTName()); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual() - */ @Override public boolean isVirtual() { IASTDeclaration decl = getPrimaryDeclaration(); @@ -167,9 +164,6 @@ public class CPPMethod extends CPPFunction implements ICPPMethod { return declSpec; } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction#isInline() - */ @Override public boolean isInline() { IASTDeclaration decl = getPrimaryDeclaration(); @@ -182,9 +176,6 @@ public class CPPMethod extends CPPFunction implements ICPPMethod { return declSpec.isInline(); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction#isMutable() - */ @Override public boolean isMutable() { return hasStorageClass(this, IASTDeclSpecifier.sc_mutable); @@ -202,9 +193,6 @@ public class CPPMethod extends CPPFunction implements ICPPMethod { return false; } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor() - */ @Override public boolean isDestructor() { char[] name = getNameCharArray(); @@ -219,9 +207,6 @@ public class CPPMethod extends CPPFunction implements ICPPMethod { return false; } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isPureVirtual() - */ @Override public boolean isPureVirtual() { ICPPASTFunctionDeclarator declarator = findFunctionDeclarator(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java index bbe90bf06f2..0059f608028 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java @@ -12,9 +12,6 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.dom; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; - import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; import org.eclipse.cdt.core.dom.ast.DOMException; @@ -40,6 +37,9 @@ import org.eclipse.cdt.internal.core.pdom.db.IString; import org.eclipse.cdt.internal.core.pdom.tag.PDOMTaggable; import org.eclipse.core.runtime.CoreException; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + /** * Base class for bindings in the PDOM. */ @@ -255,11 +255,9 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding } @Override - abstract protected int getRecordSize(); // superclass's implementation is no longer valid + abstract protected int getRecordSize(); // Superclass's implementation is no longer valid - /* For debug purposes only. - * @see java.lang.Object#toString() - */ + /** For debug purposes only. */ @Override public final String toString() { String name = toStringBase(); @@ -300,9 +298,9 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding return field.getName(); } } - } catch (IllegalAccessException iae) { + } catch (IllegalAccessException e) { continue; - } catch (IllegalArgumentException iae) { + } catch (IllegalArgumentException e) { continue; } }