From 1f6e60a707cb4f044ffa583f08970ca1bfa37f13 Mon Sep 17 00:00:00 2001 From: Max Medvedev Date: Fri, 16 May 2014 16:08:26 +0400 Subject: [PATCH] IDEA-123484: trait -> type_definitions token set --- .../groovy/formatter/processors/GroovySpacingProcessor.java | 2 +- .../formatter/processors/GroovyWrappingProcessor.java | 4 ++-- .../org/jetbrains/plugins/groovy/lang/lexer/TokenSets.java | 6 ++++-- .../plugins/groovy/lang/parser/GroovyElementTypes.java | 3 --- .../plugins/groovy/lang/psi/impl/GroovyFileBaseImpl.java | 5 +++-- .../impl/statements/typedef/GrTypeDefinitionBodyBase.java | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessor.java index 19ba1847d0dc..a64ecd0bd4ea 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessor.java @@ -353,7 +353,7 @@ public class GroovySpacingProcessor extends GroovyElementVisitor { else if (myType2 == GroovyElementTypes.PACKAGE_DEFINITION) { myResult = Spacing.createSpacing(0, 0, mySettings.BLANK_LINES_BEFORE_PACKAGE + 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines()); } - else if (isLeftOrRight(GroovyElementTypes.TYPE_DEFINITION_TYPES)) { + else if (isLeftOrRight(TokenSets.TYPE_DEFINITIONS)) { if (myType1 == GROOVY_DOC_COMMENT) { createLF(true); } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovyWrappingProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovyWrappingProcessor.java index 60e633e72206..647f20da55aa 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovyWrappingProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovyWrappingProcessor.java @@ -253,7 +253,7 @@ public class GroovyWrappingProcessor { } private final TokenSet ANNOTATION_CONTAINERS = TokenSet.create( - GroovyElementTypes.CLASS_DEFINITION, GroovyElementTypes.INTERFACE_DEFINITION, GroovyElementTypes.ENUM_DEFINITION, + GroovyElementTypes.CLASS_DEFINITION, GroovyElementTypes.INTERFACE_DEFINITION, GroovyElementTypes.ENUM_DEFINITION, GroovyElementTypes.TRAIT_DEFINITION, GroovyElementTypes.ANNOTATION_DEFINITION, GroovyElementTypes.METHOD_DEFINITION, GroovyElementTypes.CONSTRUCTOR_DEFINITION, GroovyElementTypes.VARIABLE_DEFINITION, @@ -264,7 +264,7 @@ public class GroovyWrappingProcessor { private int getAnnotationsWrapType(ASTNode modifierList) { final IElementType containerType = modifierList.getTreeParent().getElementType(); - if (GroovyElementTypes.TYPE_DEFINITION_TYPES.contains(containerType)) { + if (TokenSets.TYPE_DEFINITIONS.contains(containerType)) { return mySettings.CLASS_ANNOTATION_WRAP; } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/TokenSets.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/TokenSets.java index 34ad7b05ae6f..e9d334198210 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/TokenSets.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/TokenSets.java @@ -300,7 +300,9 @@ public abstract class TokenSets { GroovyElementTypes.DISJUNCTION_TYPE_ELEMENT); - public static final TokenSet TYPE_DEFINITIONS = TokenSet.create(GroovyElementTypes.CLASS_DEFINITION, GroovyElementTypes.ENUM_DEFINITION, + public static final TokenSet TYPE_DEFINITIONS = TokenSet.create(GroovyElementTypes.CLASS_DEFINITION, + GroovyElementTypes.ENUM_DEFINITION, GroovyElementTypes.INTERFACE_DEFINITION, - GroovyElementTypes.ANNOTATION_DEFINITION); + GroovyElementTypes.ANNOTATION_DEFINITION, + GroovyElementTypes.TRAIT_DEFINITION); } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/GroovyElementTypes.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/GroovyElementTypes.java index 624366e6b64d..f3d3ec9cae02 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/GroovyElementTypes.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/GroovyElementTypes.java @@ -18,7 +18,6 @@ package org.jetbrains.plugins.groovy.lang.parser; import com.intellij.lang.ASTNode; import com.intellij.psi.stubs.*; -import com.intellij.psi.tree.TokenSet; import com.intellij.util.io.StringRef; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.GroovyFileType; @@ -117,8 +116,6 @@ public interface GroovyElementTypes extends GroovyTokenTypes, GroovyDocElementTy } }; - TokenSet TYPE_DEFINITION_TYPES = TokenSet.create(CLASS_DEFINITION, INTERFACE_DEFINITION, ENUM_DEFINITION, ANNOTATION_DEFINITION); - GrStubElementType ENUM_CONSTANT = new GrEnumConstantElementType(); GrStubElementType FIELD = new GrFieldElementType(); GrMethodElementType METHOD_DEFINITION = new GrMethodElementType("method definition") { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileBaseImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileBaseImpl.java index 056427a8a23d..9e10edd43879 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileBaseImpl.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileBaseImpl.java @@ -30,6 +30,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.GroovyFileType; import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes; +import org.jetbrains.plugins.groovy.lang.lexer.TokenSets; import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes; import org.jetbrains.plugins.groovy.lang.psi.GrControlFlowOwner; import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor; @@ -91,10 +92,10 @@ public abstract class GroovyFileBaseImpl extends PsiFileBase implements GroovyFi public GrTypeDefinition[] getTypeDefinitions() { final StubElement stub = getStub(); if (stub != null) { - return stub.getChildrenByType(GroovyElementTypes.TYPE_DEFINITION_TYPES, GrTypeDefinition.ARRAY_FACTORY); + return stub.getChildrenByType(TokenSets.TYPE_DEFINITIONS, GrTypeDefinition.ARRAY_FACTORY); } - return calcTreeElement().getChildrenAsPsiElements(GroovyElementTypes.TYPE_DEFINITION_TYPES, GrTypeDefinition.ARRAY_FACTORY); + return calcTreeElement().getChildrenAsPsiElements(TokenSets.TYPE_DEFINITIONS, GrTypeDefinition.ARRAY_FACTORY); } @Override diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionBodyBase.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionBodyBase.java index 42ab4b3d0b0a..ce616bb693e5 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionBodyBase.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionBodyBase.java @@ -112,7 +112,7 @@ public abstract class GrTypeDefinitionBodyBase extends GrStubElementBase