Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorThomas Corbat2018-06-20 09:45:09 -0400
committerThomas Corbat2018-06-21 03:34:13 -0400
commit512b73075f7f33be51a9fb016a5221662e14f7ce (patch)
treefc65b436e0172eaf8391fe8c7ea29424a58965f3 /core
parentbc4aa4597dc1c98b41f1ded9d2429115a4ff1268 (diff)
downloadorg.eclipse.cdt-512b73075f7f33be51a9fb016a5221662e14f7ce.tar.gz
org.eclipse.cdt-512b73075f7f33be51a9fb016a5221662e14f7ce.tar.xz
org.eclipse.cdt-512b73075f7f33be51a9fb016a5221662e14f7ce.zip
Bug 535274 Follow up cosmetics
Change-Id: I562bc0925e53a461bd9e6362dc14f2e1cd924582 Signed-off-by: Thomas Corbat <tcorbat@hsr.ch>
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java
index 6afe726bd4..b084a2db1b 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java
@@ -18,7 +18,6 @@ import java.util.Collections;
import java.util.EmptyStackException;
import java.util.List;
import java.util.Stack;
-import java.util.function.Predicate;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
@@ -158,6 +157,8 @@ import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterOptions;
import org.eclipse.cdt.core.parser.IToken;
+import org.eclipse.cdt.core.parser.util.IUnaryPredicate;
+import org.eclipse.cdt.core.parser.util.InstanceOfPredicate;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.formatter.align.Alignment;
@@ -1108,13 +1109,13 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
// namespace <name>
scribe.printNextToken(Token.t_namespace, false);
scribe.space();
- formatLeadingAttributes(node, ICPPASTAttributeList.class::isInstance);
+ formatLeadingAttributes(node, ICPPASTAttributeList.TYPE_FILTER);
boolean isNamedNamespace = !CPPVisitor.isAnonymousNamespace(node);
if (isNamedNamespace) {
IASTName name = node.getName();
name.accept(this);
}
- formatAttributes(node, isNamedNamespace, false, IGCCASTAttributeList.class::isInstance);
+ formatAttributes(node, isNamedNamespace, false, IGCCASTAttributeList.TYPE_FILTER);
// member declarations
IASTDeclaration[] memberDecls= node.getDeclarations();
@@ -1558,7 +1559,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
* @param owner Node containing attributes
* @param filter Filter predicate for specifying which attributes to print
*/
- private void formatLeadingAttributes(IASTAttributeOwner owner, Predicate<IASTAttributeSpecifier> predicate) {
+ private void formatLeadingAttributes(IASTAttributeOwner owner, InstanceOfPredicate<IASTAttributeSpecifier> predicate) {
formatAttributes(owner, false, true, predicate);
}
@@ -1575,7 +1576,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
* @param filter Filter predicate for specifying which attributes to print
*/
private void formatAttributes(IASTAttributeOwner owner, boolean printLeadingSpace,
- boolean printTrailingSpace, Predicate<IASTAttributeSpecifier> filter) {
+ boolean printTrailingSpace, IUnaryPredicate<IASTAttributeSpecifier> filter) {
if (owner == null) {
return;
}
@@ -1585,7 +1586,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
scribe.space();
}
for (IASTAttributeSpecifier attributeSpecifier : attributeSpecifiers) {
- if (filter.test(attributeSpecifier)) {
+ if (filter.apply(attributeSpecifier)) {
formatRaw(attributeSpecifier);
}
}

Back to the top