diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFunctionDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFunctionDefinition.java index 5bf76095342..58ac7bfaaa9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFunctionDefinition.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFunctionDefinition.java @@ -26,20 +26,18 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; /** * @author jcamelon */ -public class CASTFunctionDefinition extends ASTNode implements - IASTFunctionDefinition, IASTAmbiguityParent { +public class CASTFunctionDefinition extends ASTNode implements IASTFunctionDefinition, IASTAmbiguityParent { private IASTDeclSpecifier declSpecifier; private IASTFunctionDeclarator declarator; private IASTStatement bodyStatement; private ICFunctionScope scope; - public CASTFunctionDefinition() { } - public CASTFunctionDefinition(IASTDeclSpecifier declSpecifier, - IASTFunctionDeclarator declarator, IASTStatement bodyStatement) { + public CASTFunctionDefinition(IASTDeclSpecifier declSpecifier, IASTFunctionDeclarator declarator, + IASTStatement bodyStatement) { setDeclSpecifier(declSpecifier); setDeclarator(declarator); setBody(bodyStatement); @@ -49,10 +47,10 @@ public class CASTFunctionDefinition extends ASTNode implements CASTFunctionDefinition copy = new CASTFunctionDefinition(); copy.setDeclSpecifier(declSpecifier == null ? null : declSpecifier.copy()); - if(declarator != null) { + if (declarator != null) { IASTDeclarator outer = CVisitor.findOutermostDeclarator(declarator); outer = outer.copy(); - copy.setDeclarator((IASTFunctionDeclarator)CVisitor.findTypeRelevantDeclarator(outer)); + copy.setDeclarator((IASTFunctionDeclarator) CVisitor.findTypeRelevantDeclarator(outer)); } copy.setBody(bodyStatement == null ? null : bodyStatement.copy()); @@ -101,41 +99,40 @@ public class CASTFunctionDefinition extends ASTNode implements } public IScope getScope() { - if( scope == null ) - scope = new CFunctionScope( this ); + if (scope == null) + scope = new CFunctionScope(this); return scope; } @Override - public boolean accept( ASTVisitor action ){ - if( action.shouldVisitDeclarations ){ - 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.shouldVisitDeclarations) { + switch (action.visit(this)) { + case ASTVisitor.PROCESS_ABORT: return false; + case ASTVisitor.PROCESS_SKIP: return true; + default: break; } } - if( declSpecifier != null ) if( !declSpecifier.accept( action ) ) return false; + if (declSpecifier != null && !declSpecifier.accept(action)) return false; final IASTDeclarator outerDtor= CVisitor.findOutermostDeclarator(declarator); - if( outerDtor != null ) if( !outerDtor.accept( action ) ) return false; - if( bodyStatement != null ) if( !bodyStatement.accept( action ) ) return false; + if (outerDtor != null && !outerDtor.accept(action)) return false; + if (bodyStatement != null && !bodyStatement.accept(action)) return false; - if( action.shouldVisitDeclarations ){ - switch( action.leave( this ) ){ - case ASTVisitor.PROCESS_ABORT : return false; - case ASTVisitor.PROCESS_SKIP : return true; - default : break; + if (action.shouldVisitDeclarations) { + switch (action.leave(this)) { + case ASTVisitor.PROCESS_ABORT: return false; + case ASTVisitor.PROCESS_SKIP: return true; + default: break; } } return true; } public void replace(IASTNode child, IASTNode other) { - if( bodyStatement == child ) - { - other.setPropertyInParent( bodyStatement.getPropertyInParent() ); - other.setParent( bodyStatement.getParent() ); + if (bodyStatement == child) { + other.setPropertyInParent(bodyStatement.getPropertyInParent()); + other.setParent(bodyStatement.getParent()); bodyStatement = (IASTStatement) other; } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java index b0ab585f07e..d287adc1102 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java @@ -207,15 +207,15 @@ public class CPPASTFieldReference extends ASTNode implements public IBinding[] findBindings(IASTName n, boolean isPrefix) { IBinding[] bindings = CPPSemantics.findBindingsForContentAssist(n, isPrefix); List filtered = new ArrayList(); - - for (int i = 0; i < bindings.length; i++) { - if (bindings[i] instanceof ICPPMethod) { - ICPPMethod method = (ICPPMethod) bindings[i]; + + for (IBinding binding : bindings) { + if (binding instanceof ICPPMethod) { + ICPPMethod method = (ICPPMethod) binding; if (method.isImplicit()) { continue; } } - filtered.add(bindings[i]); + filtered.add(binding); } return filtered.toArray(new IBinding[filtered.size()]); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java index e355be20a01..907cb5e581a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java @@ -243,7 +243,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope { } IBinding[] result = null; if ((!prefixLookup && CharArrayUtils.equals(c, compName.getLookupKey())) - || (prefixLookup && CharArrayUtils.equals(compName.getLookupKey(), 0, c.length, c, true))) { + || (prefixLookup && CharArrayUtils.equals(compName.getLookupKey(), 0, c.length, c, true))) { if (isConstructorReference(name)) { result = (IBinding[]) ArrayUtil.addAll(IBinding.class, result, getConstructors(name, resolve)); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java index 374ac4289ff..a6e21efc89f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java @@ -217,8 +217,7 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt final IBinding binding= name.resolveBinding(); if (binding instanceof IParameter) { result[i]= (IParameter) binding; - } - else { + } else { result[i] = new CPPParameter.CPPParameterProblem(p, IProblemBinding.SEMANTIC_INVALID_TYPE, name.toCharArray()); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java index 59400a5398a..55c80de91fc 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java @@ -99,7 +99,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer List proposals = new ArrayList(); - if(inPreprocessorDirective(context)) { + if (inPreprocessorDirective(context)) { if (!inPreprocessorKeyword(context)) { // add only macros if (prefix.length() == 0) { @@ -278,12 +278,8 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer } } - protected void handleBinding(IBinding binding, - CContentAssistInvocationContext cContext, - String prefix, - IASTCompletionContext astContext, - List proposals) { - + protected void handleBinding(IBinding binding, CContentAssistInvocationContext cContext, String prefix, + IASTCompletionContext astContext, List proposals) { if ((binding instanceof CPPImplicitFunction || binding instanceof CPPImplicitFunctionTemplate || binding instanceof CPPImplicitTypedef