From 45bde88c5a6baa35feaf2a549c6b95f10385a69f Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 7 Dec 2018 17:27:53 +0100 Subject: [PATCH] a cheaper groovy stub element type holder --- .../groovy/lang/GroovyChangeUtilSupport.java | 2 +- .../lang/folding/GroovyFoldingBuilder.java | 4 +- .../plugins/groovy/lang/lexer/TokenSets.java | 12 +-- .../lang/parser/GroovyElementTypes.java | 75 +------------------ .../parser/GroovyEmptyStubElementTypes.java | 14 ++++ .../lang/parser/GroovyParserDefinition.java | 2 +- .../lang/parser/GroovyStubElementTypes.java | 46 ++++++++++++ .../parsing/toplevel/CompilationUnit.java | 4 +- .../lang/psi/impl/GroovyFileBaseImpl.java | 4 +- .../groovy/lang/psi/impl/GroovyFileImpl.java | 4 +- .../impl/auxiliary/GrThrowsClauseImpl.java | 2 +- .../GrAnnotationArgumentListImpl.java | 2 +- .../annotation/GrAnnotationImpl.java | 2 +- .../modifiers/GrModifierListImpl.java | 2 +- .../groovy/lang/psi/impl/psiImplUtil.kt | 4 +- .../statements/GrVariableDeclarationImpl.java | 4 +- .../statements/params/GrParameterImpl.java | 2 +- .../params/GrParameterListImpl.java | 2 +- .../GrAnnotationTypeDefinitionImpl.java | 2 +- .../GrAnonymousClassDefinitionImpl.java | 2 +- .../typedef/GrClassDefinitionImpl.java | 2 +- .../typedef/GrEnumTypeDefinitionImpl.java | 2 +- .../typedef/GrInterfaceDefinitionImpl.java | 2 +- .../typedef/GrTraitTypeDefinitionImpl.java | 2 +- .../typedef/GrTypeDefinitionBodyBase.java | 4 +- .../typedef/GrTypeDefinitionImpl.java | 2 +- .../typedef/members/GrConstructorImpl.java | 2 +- .../typedef/members/GrMethodBaseImpl.java | 6 +- .../typedef/members/GrMethodImpl.java | 2 +- .../imports/GrImportStatementImpl.java | 2 +- .../packaging/GrPackageDefinitionImpl.java | 2 +- .../psi/impl/types/GrTypeParameterImpl.java | 2 +- .../groovy/lang/psi/stubs/GrStubUtils.java | 2 +- .../psi/stubs/GrVariableDeclarationStub.java | 2 +- .../elements/GrModifierListElementType.java | 4 +- .../stubs/elements/GrStubFileElementType.java | 8 +- .../stubs/elements/GrVariableElementType.java | 4 +- plugins/groovy/src/META-INF/plugin.xml | 3 +- .../processors/GroovyIndentProcessor.java | 8 +- .../processors/GroovySpacingProcessor.java | 30 ++++---- .../GroovySpacingProcessorBasic.java | 2 +- .../processors/GroovyWrappingProcessor.java | 26 +++---- 42 files changed, 151 insertions(+), 159 deletions(-) create mode 100644 plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyEmptyStubElementTypes.java create mode 100644 plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyStubElementTypes.java diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyChangeUtilSupport.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyChangeUtilSupport.java index 7fec880b662a..2110f0ef2eaf 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyChangeUtilSupport.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyChangeUtilSupport.java @@ -86,6 +86,6 @@ public class GroovyChangeUtilSupport implements TreeCopyHandler { while (node != null && node.getElementType() == GroovyElementTypes.REFERENCE_ELEMENT) { node = node.getTreeParent(); } - return node != null && node.getElementType() == GroovyElementTypes.IMPORT_STATEMENT; + return node != null && node.getElementType() == GroovyElementTypes.IMPORT; } } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/folding/GroovyFoldingBuilder.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/folding/GroovyFoldingBuilder.java index 2a8bcdea9134..56b35b52b878 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/folding/GroovyFoldingBuilder.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/folding/GroovyFoldingBuilder.java @@ -122,7 +122,7 @@ public class GroovyFoldingBuilder extends CustomFoldingBuilder implements DumbAw IElementType type = node.getElementType(); JavaCodeFoldingSettings settings = JavaCodeFoldingSettings.getInstance(); if ((type == GroovyElementTypes.OPEN_BLOCK || type == GroovyElementTypes.CONSTRUCTOR_BODY) && node.getTreeParent().getElementType() == - GroovyElementTypes.METHOD_DEFINITION) { + GroovyElementTypes.METHOD) { return settings.isCollapseMethods(); } @@ -309,6 +309,6 @@ public class GroovyFoldingBuilder extends CustomFoldingBuilder implements DumbAw @Override protected boolean isCustomFoldingRoot(@NotNull ASTNode node) { IElementType nodeType = node.getElementType(); - return nodeType == GroovyElementTypes.CLASS_DEFINITION || nodeType == GroovyElementTypes.OPEN_BLOCK; + return nodeType == GroovyElementTypes.CLASS_TYPE_DEFINITION || nodeType == GroovyElementTypes.OPEN_BLOCK; } } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/lexer/TokenSets.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/lexer/TokenSets.java index 27e6b4804423..986de74eb1d9 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/lexer/TokenSets.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/lexer/TokenSets.java @@ -196,18 +196,18 @@ public interface TokenSets { TokenSet BLOCK_SET = TokenSet.create(CLOSABLE_BLOCK, BLOCK_STATEMENT, CONSTRUCTOR_BODY, OPEN_BLOCK, ENUM_BODY, CLASS_BODY); - TokenSet METHOD_DEFS = TokenSet.create(METHOD_DEFINITION, CONSTRUCTOR_DEFINITION, ANNOTATION_METHOD); + TokenSet METHOD_DEFS = TokenSet.create(METHOD, CONSTRUCTOR, ANNOTATION_METHOD); TokenSet VARIABLES = TokenSet.create(VARIABLE, FIELD); TokenSet TYPE_ELEMENTS = TokenSet.create(CLASS_TYPE_ELEMENT, ARRAY_TYPE, BUILT_IN_TYPE, TYPE_ARGUMENT, DISJUNCTION_TYPE_ELEMENT); TokenSet TYPE_DEFINITIONS = TokenSet.create( - CLASS_DEFINITION, - ENUM_DEFINITION, - INTERFACE_DEFINITION, - ANNOTATION_DEFINITION, - TRAIT_DEFINITION + CLASS_TYPE_DEFINITION, + ENUM_TYPE_DEFINITION, + INTERFACE_TYPE_DEFINITION, + ANNOTATION_TYPE_DEFINITION, + TRAIT_TYPE_DEFINITION ); TokenSet METHOD_IDENTIFIERS = TokenSet.orSet(GroovyTokenSets.STRING_LITERALS, TokenSet.create(mIDENT)); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyElementTypes.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyElementTypes.java index 7b1b05573a90..4b2863121d8c 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyElementTypes.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyElementTypes.java @@ -1,25 +1,9 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.parser; -import com.intellij.psi.stubs.EmptyStubElementType; -import com.intellij.psi.stubs.IStubElementType; import com.intellij.psi.tree.IElementType; -import com.intellij.psi.tree.IStubFileElementType; import org.jetbrains.plugins.groovy.lang.lexer.GroovyElementType; -import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrThrowsClause; -import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifierList; -import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotation; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameterList; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.*; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrEnumConstant; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrEnumConstantList; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod; -import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeParameter; -import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeParameterList; -import org.jetbrains.plugins.groovy.lang.psi.stubs.*; -import org.jetbrains.plugins.groovy.lang.psi.stubs.elements.*; +import org.jetbrains.plugins.groovy.lang.psi.stubs.elements.GrMethodElementType; import static org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.*; @@ -28,32 +12,12 @@ import static org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.*; * * @author Dmitry.Krasilschikov, ilyas */ -public interface GroovyElementTypes { +public interface GroovyElementTypes extends GroovyStubElementTypes, GroovyEmptyStubElementTypes { - /* - Stub elements - */ - GrStubElementType CLASS_DEFINITION = CLASS_TYPE_DEFINITION; - GrStubElementType INTERFACE_DEFINITION = INTERFACE_TYPE_DEFINITION; - GrStubElementType ENUM_DEFINITION = ENUM_TYPE_DEFINITION; - GrStubElementType ANNOTATION_DEFINITION = ANNOTATION_TYPE_DEFINITION; - GrStubElementType ANONYMOUS_CLASS_DEFINITION = ANONYMOUS_TYPE_DEFINITION; - GrStubElementType TRAIT_DEFINITION = TRAIT_TYPE_DEFINITION; - GrStubElementType ENUM_CONSTANT_INITIALIZER = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ENUM_CONSTANT_INITIALIZER; - - GrStubElementType ENUM_CONSTANT = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ENUM_CONSTANT; - GrStubElementType FIELD = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.FIELD; + @Deprecated GrMethodElementType METHOD_DEFINITION = METHOD; - GrStubElementType ANNOTATION_METHOD = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ANNOTATION_METHOD; - - GrReferenceListElementType IMPLEMENTS_CLAUSE = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.IMPLEMENTS_CLAUSE; - GrReferenceListElementType EXTENDS_CLAUSE = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.EXTENDS_CLAUSE; - - IElementType NONE = new GroovyElementType("no token"); //not a node GroovyElementType LITERAL = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.LITERAL; - //Packaging - GrPackageDefinitionElementType PACKAGE_DEFINITION = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.PACKAGE_DEFINITION; GrCodeBlockElementType CLOSABLE_BLOCK = CLOSURE; GrCodeBlockElementType OPEN_BLOCK = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.OPEN_BLOCK; @@ -61,9 +25,6 @@ public interface GroovyElementTypes { IElementType BLOCK_STATEMENT = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.BLOCK_STATEMENT; - EmptyStubElementType ENUM_CONSTANTS = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ENUM_CONSTANTS; - GrImportStatementElementType IMPORT_STATEMENT = IMPORT; - IElementType ASSERT_STATEMENT = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ASSERT_STATEMENT; // Expression statements IElementType LABELED_STATEMENT = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.LABELED_STATEMENT; @@ -123,28 +84,7 @@ public interface GroovyElementTypes { IElementType TYPE_ARGUMENTS = TYPE_ARGUMENT_LIST; IElementType TYPE_ARGUMENT = WILDCARD_TYPE_ELEMENT; - EmptyStubElementType TYPE_PARAMETER_LIST = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.TYPE_PARAMETER_LIST; - GrStubElementType TYPE_PARAMETER = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.TYPE_PARAMETER; - - IStubElementType TYPE_PARAMETER_EXTENDS_BOUND_LIST = TYPE_PARAMETER_BOUNDS_LIST; - - GrMethodElementType CONSTRUCTOR_DEFINITION = CONSTRUCTOR; - - GrReferenceListElementType THROW_CLAUSE = THROWS_CLAUSE; - //annotation - GrAnnotationArgumentListElementType ANNOTATION_ARGUMENTS = ANNOTATION_ARGUMENT_LIST; - GrNameValuePairElementType ANNOTATION_MEMBER_VALUE_PAIR = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ANNOTATION_MEMBER_VALUE_PAIR; - - GrStubElementType ANNOTATION = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ANNOTATION; - //parameters - EmptyStubElementType PARAMETERS_LIST = PARAMETER_LIST; - - GrStubElementType PARAMETER = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.PARAMETER; - - EmptyStubElementType CLASS_BODY = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.CLASS_BODY; - - EmptyStubElementType ENUM_BODY = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ENUM_BODY; //statements IElementType IF_STATEMENT = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.IF_STATEMENT; IElementType SWITCH_STATEMENT = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.SWITCH_STATEMENT; @@ -158,14 +98,5 @@ public interface GroovyElementTypes { IElementType FINALLY_CLAUSE = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.FINALLY_CLAUSE; IElementType CLASS_INITIALIZER = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.CLASS_INITIALIZER; - GrVariableDeclarationElementType VARIABLE_DEFINITION = VARIABLE_DECLARATION; - GrVariableElementType VARIABLE = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.VARIABLE; - - //modifiers - GrStubElementType MODIFIERS = MODIFIER_LIST; - - //types IElementType CLASS_TYPE_ELEMENT = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.CLASS_TYPE_ELEMENT; - - IStubFileElementType GROOVY_FILE = GroovyParserDefinition.GROOVY_FILE; } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyEmptyStubElementTypes.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyEmptyStubElementTypes.java new file mode 100644 index 000000000000..ddc1bfd55ec5 --- /dev/null +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyEmptyStubElementTypes.java @@ -0,0 +1,14 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package org.jetbrains.plugins.groovy.lang.parser; + +import org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes; +import org.jetbrains.plugins.groovy.lang.psi.stubs.elements.*; + +public interface GroovyEmptyStubElementTypes { + GrAnnotationArgumentListElementType ANNOTATION_ARGUMENT_LIST = GroovyElementTypes.ANNOTATION_ARGUMENT_LIST; + GrEnumConstantListElementType ENUM_CONSTANTS = GroovyElementTypes.ENUM_CONSTANTS; + GrTypeParameterListElementType TYPE_PARAMETER_LIST = GroovyElementTypes.TYPE_PARAMETER_LIST; + GrParameterListElementType PARAMETER_LIST = GroovyElementTypes.PARAMETER_LIST; + GrTypeDefinitionBodyElementType CLASS_BODY = GroovyElementTypes.CLASS_BODY; + GrEnumDefinitionBodyElementType ENUM_BODY = GroovyElementTypes.ENUM_BODY; +} diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyParserDefinition.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyParserDefinition.java index e8d860b66acf..cd56ac40b255 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyParserDefinition.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyParserDefinition.java @@ -102,7 +102,7 @@ public class GroovyParserDefinition implements ParserDefinition { if (rType == GroovyTokenTypes.kIMPORT && lType != TokenType.WHITE_SPACE) { return SpaceRequirements.MUST_LINE_BREAK; } - else if (lType == MODIFIERS && rType == MODIFIERS) { + else if (lType == MODIFIER_LIST && rType == MODIFIER_LIST) { return SpaceRequirements.MUST; } if (lType == GroovyTokenTypes.mSEMI) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyStubElementTypes.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyStubElementTypes.java new file mode 100644 index 000000000000..16a0fc8174d5 --- /dev/null +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/GroovyStubElementTypes.java @@ -0,0 +1,46 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package org.jetbrains.plugins.groovy.lang.parser; + +import org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes; +import org.jetbrains.plugins.groovy.lang.psi.stubs.elements.*; + +public interface GroovyStubElementTypes { + GrClassDefinitionElementType CLASS_TYPE_DEFINITION = GroovyElementTypes.CLASS_TYPE_DEFINITION; + GrInterfaceDefinitionElementType INTERFACE_TYPE_DEFINITION = GroovyElementTypes.INTERFACE_TYPE_DEFINITION; + GrEnumDefinitionElementType ENUM_TYPE_DEFINITION = GroovyElementTypes.ENUM_TYPE_DEFINITION; + GrAnnotationDefinitionElementType ANNOTATION_TYPE_DEFINITION = GroovyElementTypes.ANNOTATION_TYPE_DEFINITION; + GrAnonymousElementType ANONYMOUS_TYPE_DEFINITION = GroovyElementTypes.ANONYMOUS_TYPE_DEFINITION; + GrTraitElementType TRAIT_TYPE_DEFINITION = GroovyElementTypes.TRAIT_TYPE_DEFINITION; + GrEnumConstantInitializerElementType ENUM_CONSTANT_INITIALIZER = GroovyElementTypes.ENUM_CONSTANT_INITIALIZER; + + GrEnumConstantElementType ENUM_CONSTANT = GroovyElementTypes.ENUM_CONSTANT; + GrFieldElementType FIELD = GroovyElementTypes.FIELD; + GrMethodElementType METHOD = GroovyElementTypes.METHOD; + GrAnnotationMethodElementType ANNOTATION_METHOD = GroovyElementTypes.ANNOTATION_METHOD; + + GrImplementsClauseElementType IMPLEMENTS_CLAUSE = GroovyElementTypes.IMPLEMENTS_CLAUSE; + GrExtendsClauseElementType EXTENDS_CLAUSE = GroovyElementTypes.EXTENDS_CLAUSE; + + GrPackageDefinitionElementType PACKAGE_DEFINITION = GroovyElementTypes.PACKAGE_DEFINITION; + + GrImportStatementElementType IMPORT = GroovyElementTypes.IMPORT; + + GrTypeParameterElementType TYPE_PARAMETER = GroovyElementTypes.TYPE_PARAMETER; + + GrTypeParameterBoundsElementType TYPE_PARAMETER_BOUNDS_LIST = GroovyElementTypes.TYPE_PARAMETER_BOUNDS_LIST; + + GrMethodElementType CONSTRUCTOR = GroovyElementTypes.CONSTRUCTOR; + + GrThrowsClauseElementType THROWS_CLAUSE = GroovyElementTypes.THROWS_CLAUSE; + + GrNameValuePairElementType ANNOTATION_MEMBER_VALUE_PAIR = GroovyElementTypes.ANNOTATION_MEMBER_VALUE_PAIR; + + GrAnnotationElementType ANNOTATION = GroovyElementTypes.ANNOTATION; + + GrParameterElementType PARAMETER = GroovyElementTypes.PARAMETER; + + GrVariableDeclarationElementType VARIABLE_DECLARATION = GroovyElementTypes.VARIABLE_DECLARATION; + GrVariableElementType VARIABLE = GroovyElementTypes.VARIABLE; + + GrModifierListElementType MODIFIER_LIST = GroovyElementTypes.MODIFIER_LIST; +} diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/parsing/toplevel/CompilationUnit.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/parsing/toplevel/CompilationUnit.java index 4455934262bc..6358a8b30259 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/parsing/toplevel/CompilationUnit.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/parsing/toplevel/CompilationUnit.java @@ -2,14 +2,14 @@ package org.jetbrains.plugins.groovy.lang.parser.parsing.toplevel; import com.intellij.lang.PsiBuilder; -import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes; import org.jetbrains.plugins.groovy.lang.parser.GroovyParser; +import org.jetbrains.plugins.groovy.lang.parser.GroovyParserDefinition; @Deprecated public class CompilationUnit { @Deprecated public static void parseFile(PsiBuilder builder, GroovyParser parser) { - parser.parseLight(GroovyElementTypes.GROOVY_FILE, builder); + parser.parseLight(GroovyParserDefinition.GROOVY_FILE, builder); } } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileBaseImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileBaseImpl.java index 440a8883e510..33e454f83053 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileBaseImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileBaseImpl.java @@ -101,10 +101,10 @@ public abstract class GroovyFileBaseImpl extends PsiFileBase implements GroovyFi public GrMethod[] getMethods() { final StubElement stub = getGreenStub(); if (stub != null) { - return stub.getChildrenByType(GroovyElementTypes.METHOD_DEFINITION, GrMethod.ARRAY_FACTORY); + return stub.getChildrenByType(GroovyElementTypes.METHOD, GrMethod.ARRAY_FACTORY); } - return calcTreeElement().getChildrenAsPsiElements(GroovyElementTypes.METHOD_DEFINITION, GrMethod.ARRAY_FACTORY); + return calcTreeElement().getChildrenAsPsiElements(GroovyElementTypes.METHOD, GrMethod.ARRAY_FACTORY); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileImpl.java index e7309363db7e..ef09c7b2d12c 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileImpl.java @@ -141,10 +141,10 @@ public class GroovyFileImpl extends GroovyFileBaseImpl implements GroovyFile, Ps public GrImportStatement[] getImportStatements() { final StubElement stub = getStub(); if (stub != null) { - return stub.getChildrenByType(GroovyElementTypes.IMPORT_STATEMENT, GrImportStatement.ARRAY_FACTORY); + return stub.getChildrenByType(GroovyElementTypes.IMPORT, GrImportStatement.ARRAY_FACTORY); } - return calcTreeElement().getChildrenAsPsiElements(GroovyElementTypes.IMPORT_STATEMENT, GrImportStatement.ARRAY_FACTORY); + return calcTreeElement().getChildrenAsPsiElements(GroovyElementTypes.IMPORT, GrImportStatement.ARRAY_FACTORY); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrThrowsClauseImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrThrowsClauseImpl.java index 31f0d44a9186..69ddd3d97537 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrThrowsClauseImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrThrowsClauseImpl.java @@ -31,7 +31,7 @@ import java.util.List; */ public class GrThrowsClauseImpl extends GrReferenceListImpl implements GrThrowsClause { public GrThrowsClauseImpl(GrReferenceListStub stub) { - super(stub, GroovyElementTypes.THROW_CLAUSE); + super(stub, GroovyElementTypes.THROWS_CLAUSE); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/annotation/GrAnnotationArgumentListImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/annotation/GrAnnotationArgumentListImpl.java index 260c76b52224..ccf7495ee8a7 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/annotation/GrAnnotationArgumentListImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/annotation/GrAnnotationArgumentListImpl.java @@ -24,7 +24,7 @@ public class GrAnnotationArgumentListImpl extends GrStubElementBase private static final Logger LOG = Logger.getInstance(GrAnnotationArgumentListImpl.class); public GrAnnotationArgumentListImpl(@NotNull EmptyStub stub) { - super(stub, GroovyElementTypes.ANNOTATION_ARGUMENTS); + super(stub, GroovyElementTypes.ANNOTATION_ARGUMENT_LIST); } public GrAnnotationArgumentListImpl(@NotNull ASTNode node) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/annotation/GrAnnotationImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/annotation/GrAnnotationImpl.java index 8670e04f5b5a..cd63a087e8f7 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/annotation/GrAnnotationImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/annotation/GrAnnotationImpl.java @@ -65,7 +65,7 @@ public class GrAnnotationImpl extends GrStubElementBase implem @Override @NotNull public GrAnnotationArgumentList getParameterList() { - return getRequiredStubOrPsiChild(GroovyElementTypes.ANNOTATION_ARGUMENTS); + return getRequiredStubOrPsiChild(GroovyElementTypes.ANNOTATION_ARGUMENT_LIST); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/modifiers/GrModifierListImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/modifiers/GrModifierListImpl.java index e670b4e098fb..548173981e9e 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/modifiers/GrModifierListImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/modifiers/GrModifierListImpl.java @@ -100,7 +100,7 @@ public class GrModifierListImpl extends GrStubElementBase } public GrModifierListImpl(GrModifierListStub stub) { - this(stub, GroovyElementTypes.MODIFIERS); + this(stub, GroovyElementTypes.MODIFIER_LIST); } public GrModifierListImpl(GrModifierListStub stub, IStubElementType nodeType) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/psiImplUtil.kt b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/psiImplUtil.kt index c7786311f536..671eb63c7c8a 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/psiImplUtil.kt +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/psiImplUtil.kt @@ -36,11 +36,11 @@ internal fun getScriptDeclarations(fileImpl: GroovyFileImpl, topLevelOnly: Boole val tree = fileImpl.stubTree ?: return fileImpl.collectScriptDeclarations(topLevelOnly) return if (topLevelOnly) { val root: StubElement<*> = tree.root - root.getChildrenByType(GroovyElementTypes.VARIABLE_DEFINITION, GrVariableDeclaration.EMPTY_ARRAY) + root.getChildrenByType(GroovyElementTypes.VARIABLE_DECLARATION, GrVariableDeclaration.EMPTY_ARRAY) } else { tree.plainList.filter { - it.stubType === GroovyElementTypes.VARIABLE_DEFINITION + it.stubType === GroovyElementTypes.VARIABLE_DECLARATION }.map { it.psi as GrVariableDeclaration }.toTypedArray() diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrVariableDeclarationImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrVariableDeclarationImpl.java index 6df0ea1550bb..f5b208fd3753 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrVariableDeclarationImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrVariableDeclarationImpl.java @@ -52,7 +52,7 @@ public class GrVariableDeclarationImpl extends GrStubElementBase impleme @Override @NotNull public GrModifierList getModifierList() { - return getRequiredStubOrPsiChild(GroovyElementTypes.MODIFIERS); + return getRequiredStubOrPsiChild(GroovyElementTypes.MODIFIER_LIST); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/params/GrParameterListImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/params/GrParameterListImpl.java index 78a397afa8c3..ba65d6579958 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/params/GrParameterListImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/params/GrParameterListImpl.java @@ -38,7 +38,7 @@ public class GrParameterListImpl extends GrStubElementBase } public GrParameterListImpl(EmptyStub stub) { - super(stub, GroovyElementTypes.PARAMETERS_LIST); + super(stub, GroovyElementTypes.PARAMETER_LIST); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrAnnotationTypeDefinitionImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrAnnotationTypeDefinitionImpl.java index dedbd41744eb..2da507ca74ce 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrAnnotationTypeDefinitionImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrAnnotationTypeDefinitionImpl.java @@ -22,7 +22,7 @@ public class GrAnnotationTypeDefinitionImpl extends GrTypeDefinitionImpl impleme } public GrAnnotationTypeDefinitionImpl(GrTypeDefinitionStub stub) { - super(stub, GroovyElementTypes.ANNOTATION_DEFINITION); + super(stub, GroovyElementTypes.ANNOTATION_TYPE_DEFINITION); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrAnonymousClassDefinitionImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrAnonymousClassDefinitionImpl.java index 55321a0e78bb..5fa22f3778f2 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrAnonymousClassDefinitionImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrAnonymousClassDefinitionImpl.java @@ -32,7 +32,7 @@ public class GrAnonymousClassDefinitionImpl extends GrTypeDefinitionImpl impleme } public GrAnonymousClassDefinitionImpl(GrTypeDefinitionStub stub) { - this(stub, GroovyElementTypes.ANONYMOUS_CLASS_DEFINITION); + this(stub, GroovyElementTypes.ANONYMOUS_TYPE_DEFINITION); } public GrAnonymousClassDefinitionImpl(GrTypeDefinitionStub stub, final GrStubElementType nodeType) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrClassDefinitionImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrClassDefinitionImpl.java index 1b9e37f554d1..fdb417abcd43 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrClassDefinitionImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrClassDefinitionImpl.java @@ -20,7 +20,7 @@ public class GrClassDefinitionImpl extends GrTypeDefinitionImpl implements GrCla } public GrClassDefinitionImpl(final GrTypeDefinitionStub stub) { - super(stub, GroovyElementTypes.CLASS_DEFINITION); + super(stub, GroovyElementTypes.CLASS_TYPE_DEFINITION); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrEnumTypeDefinitionImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrEnumTypeDefinitionImpl.java index f9717a5dbe6a..2b8a58efee88 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrEnumTypeDefinitionImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrEnumTypeDefinitionImpl.java @@ -40,7 +40,7 @@ public class GrEnumTypeDefinitionImpl extends GrTypeDefinitionImpl implements Gr } public GrEnumTypeDefinitionImpl(GrTypeDefinitionStub stub) { - super(stub, GroovyElementTypes.ENUM_DEFINITION); + super(stub, GroovyElementTypes.ENUM_TYPE_DEFINITION); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrInterfaceDefinitionImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrInterfaceDefinitionImpl.java index 518514a5caec..00f8c7f2e70a 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrInterfaceDefinitionImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrInterfaceDefinitionImpl.java @@ -16,7 +16,7 @@ import org.jetbrains.plugins.groovy.lang.psi.stubs.GrTypeDefinitionStub; public class GrInterfaceDefinitionImpl extends GrTypeDefinitionImpl implements GrInterfaceDefinition { public GrInterfaceDefinitionImpl(GrTypeDefinitionStub stub) { - super(stub, GroovyElementTypes.INTERFACE_DEFINITION); + super(stub, GroovyElementTypes.INTERFACE_TYPE_DEFINITION); } public GrInterfaceDefinitionImpl(@NotNull ASTNode node) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTraitTypeDefinitionImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTraitTypeDefinitionImpl.java index 1ec542c612cf..6d0d8ee2ddc8 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTraitTypeDefinitionImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTraitTypeDefinitionImpl.java @@ -21,7 +21,7 @@ import java.util.List; public class GrTraitTypeDefinitionImpl extends GrTypeDefinitionImpl implements GrTraitTypeDefinition { public GrTraitTypeDefinitionImpl(GrTypeDefinitionStub stub) { - super(stub, GroovyElementTypes.TRAIT_DEFINITION); + super(stub, GroovyElementTypes.TRAIT_TYPE_DEFINITION); } public GrTraitTypeDefinitionImpl(@NotNull ASTNode node) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionBodyBase.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionBodyBase.java index fe55c8215f44..523f4460616b 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionBodyBase.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionBodyBase.java @@ -52,7 +52,7 @@ public abstract class GrTypeDefinitionBodyBase extends GrStubElementBase result = ContainerUtil.newArrayList(); for (GrVariableDeclaration declaration : declarations) { GrVariable[] variables = declaration.getVariables(); @@ -204,7 +204,7 @@ public abstract class GrTypeDefinitionBodyBase extends GrStubElementBase i @Override @NotNull public GrParameterList getParameterList() { - final GrParameterList parameterList = getStubOrPsiChild(GroovyElementTypes.PARAMETERS_LIST); + final GrParameterList parameterList = getStubOrPsiChild(GroovyElementTypes.PARAMETER_LIST); LOG.assertTrue(parameterList != null); return parameterList; } @@ -317,7 +317,7 @@ public abstract class GrMethodBaseImpl extends GrStubElementBase i @Override @NotNull public PsiReferenceList getThrowsList() { - return ObjectUtils.assertNotNull(getStubOrPsiChild(GroovyElementTypes.THROW_CLAUSE)); + return ObjectUtils.assertNotNull(getStubOrPsiChild(GroovyElementTypes.THROWS_CLAUSE)); } @Override @@ -397,7 +397,7 @@ public abstract class GrMethodBaseImpl extends GrStubElementBase i @Override @NotNull public GrModifierList getModifierList() { - return ObjectUtils.assertNotNull(getStubOrPsiChild(GroovyElementTypes.MODIFIERS)); + return ObjectUtils.assertNotNull(getStubOrPsiChild(GroovyElementTypes.MODIFIER_LIST)); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/members/GrMethodImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/members/GrMethodImpl.java index 566e6d3e2d5c..f35f07aa68f7 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/members/GrMethodImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/members/GrMethodImpl.java @@ -35,7 +35,7 @@ public class GrMethodImpl extends GrMethodBaseImpl implements GrMethod { } public GrMethodImpl(GrMethodStub stub) { - super(stub, GroovyElementTypes.METHOD_DEFINITION); + super(stub, GroovyElementTypes.METHOD); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/toplevel/imports/GrImportStatementImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/toplevel/imports/GrImportStatementImpl.java index 1b7b5c18517c..77b99effa80f 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/toplevel/imports/GrImportStatementImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/toplevel/imports/GrImportStatementImpl.java @@ -150,7 +150,7 @@ public class GrImportStatementImpl extends GrStubElementBase @Override @NotNull public PsiReferenceList getExtendsList() { - return getRequiredStubOrPsiChild(GroovyElementTypes.TYPE_PARAMETER_EXTENDS_BOUND_LIST); + return getRequiredStubOrPsiChild(GroovyElementTypes.TYPE_PARAMETER_BOUNDS_LIST); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrStubUtils.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrStubUtils.java index 678dcbf15f41..e1861125b309 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrStubUtils.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrStubUtils.java @@ -112,7 +112,7 @@ public class GrStubUtils { public static boolean isGroovyStaticMemberStub(StubElement stub) { StubElement modifierOwner = stub instanceof GrMethodStub ? stub : stub.getParentStub(); - GrModifierListStub type = modifierOwner.findChildStubByType(GroovyElementTypes.MODIFIERS); + GrModifierListStub type = modifierOwner.findChildStubByType(GroovyElementTypes.MODIFIER_LIST); if (type == null) { return false; } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrVariableDeclarationStub.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrVariableDeclarationStub.java index 3c425812411c..dece9b147ef8 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrVariableDeclarationStub.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrVariableDeclarationStub.java @@ -31,7 +31,7 @@ public class GrVariableDeclarationStub extends StubBase { private volatile SoftReference myTypeElement; public GrVariableDeclarationStub(StubElement parent, @Nullable String typeString) { - super(parent, GroovyElementTypes.VARIABLE_DEFINITION); + super(parent, GroovyElementTypes.VARIABLE_DECLARATION); myTypeString = typeString; } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrModifierListElementType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrModifierListElementType.java index 078308d8f259..899cec472bca 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrModifierListElementType.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrModifierListElementType.java @@ -42,7 +42,7 @@ public class GrModifierListElementType extends GrStubElementType { public boolean skipChildProcessingWhenBuildingStubs(@NotNull ASTNode parent, @NotNull ASTNode node) { IElementType childType = node.getElementType(); IElementType parentType = parent.getElementType(); - if (childType == GroovyElementTypes.PARAMETER && parentType != GroovyElementTypes.PARAMETERS_LIST) { + if (childType == GroovyElementTypes.PARAMETER && parentType != GroovyElementTypes.PARAMETER_LIST) { return true; } - if (childType == GroovyElementTypes.PARAMETERS_LIST && !(parent.getPsi() instanceof GrMethod)) { + if (childType == GroovyElementTypes.PARAMETER_LIST && !(parent.getPsi() instanceof GrMethod)) { return true; } - if (childType == GroovyElementTypes.MODIFIERS) { + if (childType == GroovyElementTypes.MODIFIER_LIST) { if (parentType == GroovyElementTypes.CLASS_INITIALIZER) { return true; } - if (parentType == GroovyElementTypes.VARIABLE_DEFINITION && !GroovyElementTypes.VARIABLE_DEFINITION.shouldCreateStub(parent)) { + if (parentType == GroovyElementTypes.VARIABLE_DECLARATION && !GroovyElementTypes.VARIABLE_DECLARATION.shouldCreateStub(parent)) { return true; } } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrVariableElementType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrVariableElementType.java index 85bcb4b2dcf2..77f1594d3781 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrVariableElementType.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrVariableElementType.java @@ -58,7 +58,7 @@ public final class GrVariableElementType extends GrStubElementType - + + diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovyIndentProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovyIndentProcessor.java index 3698d1a65ec5..87ba338c63c6 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovyIndentProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovyIndentProcessor.java @@ -79,7 +79,7 @@ public class GroovyIndentProcessor extends GroovyElementVisitor { public Indent getChildIndent(@NotNull final GroovyBlock parentBlock, @NotNull final ASTNode child) { myChildType = child.getElementType(); if (parentBlock instanceof ClosureBodyBlock) { - if (myChildType == GroovyElementTypes.PARAMETERS_LIST) { + if (myChildType == GroovyElementTypes.PARAMETER_LIST) { return getNoneIndent(); } else if (myChildType != GroovyTokenTypes.mLCURLY && myChildType != GroovyTokenTypes.mRCURLY) { @@ -157,7 +157,7 @@ public class GroovyIndentProcessor extends GroovyElementVisitor { @Override public void visitAnnotation(@NotNull GrAnnotation annotation) { - if (myChildType == GroovyElementTypes.ANNOTATION_ARGUMENTS) { + if (myChildType == GroovyElementTypes.ANNOTATION_ARGUMENT_LIST) { myResult = getContinuationIndent(); } else { @@ -280,10 +280,10 @@ public class GroovyIndentProcessor extends GroovyElementVisitor { @Override public void visitMethod(@NotNull GrMethod method) { - if (myChildType == GroovyElementTypes.PARAMETERS_LIST) { + if (myChildType == GroovyElementTypes.PARAMETER_LIST) { myResult = getContinuationIndent(); } - else if (myChildType == GroovyElementTypes.THROW_CLAUSE) { + else if (myChildType == GroovyElementTypes.THROWS_CLAUSE) { myResult = getGroovySettings().ALIGN_THROWS_KEYWORD ? getNoneIndent() : getContinuationIndent(); } else if (myChildType == GroovyElementTypes.OPEN_BLOCK) { myResult = getBlockIndent(getGroovySettings().METHOD_BRACE_STYLE); 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 62b884ba5ffa..dbc2e87f3069 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 @@ -139,7 +139,7 @@ public class GroovySpacingProcessor extends GroovyElementVisitor { private boolean manageComments() { if (mySettings.KEEP_FIRST_COLUMN_COMMENT && TokenSets.COMMENT_SET.contains(myType2)) { - if (!isAfterElementOrSemi(GroovyElementTypes.IMPORT_STATEMENT)) { + if (!isAfterElementOrSemi(GroovyElementTypes.IMPORT)) { myResult = Spacing.createKeepingFirstColumnSpacing(0, Integer.MAX_VALUE, mySettings.KEEP_LINE_BREAKS, keepBlankLines()); return true; } @@ -181,7 +181,7 @@ public class GroovySpacingProcessor extends GroovyElementVisitor { @Override public void visitAnnotation(@NotNull GrAnnotation annotation) { - if (myType2 == GroovyElementTypes.ANNOTATION_ARGUMENTS) { + if (myType2 == GroovyElementTypes.ANNOTATION_ARGUMENT_LIST) { createSpaceInCode(mySettings.SPACE_BEFORE_ANOTATION_PARAMETER_LIST); } } @@ -311,7 +311,7 @@ public class GroovySpacingProcessor extends GroovyElementVisitor { @Override public void visitEnumConstant(@NotNull GrEnumConstant enumConstant) { - if (myType1 == GroovyElementTypes.MODIFIERS) { + if (myType1 == GroovyElementTypes.MODIFIER_LIST) { createSpaceInCode(true); } else { manageSpaceBeforeCallLParenth(); @@ -352,14 +352,14 @@ public class GroovySpacingProcessor extends GroovyElementVisitor { myResult = Spacing.createSpacing(0, 0, mySettings.BLANK_LINES_AROUND_CLASS + 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines()); } } - else if (isAfterElementOrSemi(GroovyElementTypes.IMPORT_STATEMENT) && myType2 != GroovyElementTypes.IMPORT_STATEMENT) { //after imports + else if (isAfterElementOrSemi(GroovyElementTypes.IMPORT) && myType2 != GroovyElementTypes.IMPORT) { //after imports myResult = Spacing.createSpacing(0, 0, mySettings.BLANK_LINES_AFTER_IMPORTS + 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines()); } - else if (myType1 != GroovyElementTypes.IMPORT_STATEMENT && !isSemiAfter(GroovyElementTypes.IMPORT_STATEMENT) && myType2 == - GroovyElementTypes.IMPORT_STATEMENT) { //before imports + else if (myType1 != GroovyElementTypes.IMPORT && !isSemiAfter(GroovyElementTypes.IMPORT) && myType2 == + GroovyElementTypes.IMPORT) { //before imports myResult = Spacing.createSpacing(0, 0, mySettings.BLANK_LINES_BEFORE_IMPORTS, mySettings.KEEP_LINE_BREAKS, keepBlankLines()); } - else if (isAfterElementOrSemi(GroovyElementTypes.IMPORT_STATEMENT) && myType2 == GroovyElementTypes.IMPORT_STATEMENT) { + else if (isAfterElementOrSemi(GroovyElementTypes.IMPORT) && myType2 == GroovyElementTypes.IMPORT) { myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines()); } else { @@ -418,8 +418,8 @@ public class GroovySpacingProcessor extends GroovyElementVisitor { else if (myType1 == GroovyTokenTypes.mLCURLY && myType2 == GroovyTokenTypes.mRCURLY) { //empty closure createSpaceInCode(false); } - else if (myType1 == GroovyTokenTypes.mLCURLY && myType2 != GroovyElementTypes.PARAMETERS_LIST && myType2 != - GroovyTokenTypes.mCLOSABLE_BLOCK_OP || myType2 == + else if (myType1 == GroovyTokenTypes.mLCURLY && myType2 != GroovyElementTypes.PARAMETER_LIST && myType2 != + GroovyTokenTypes.mCLOSABLE_BLOCK_OP || myType2 == GroovyTokenTypes.mRCURLY) { //spaces between statements boolean spacesWithinBraces = closure.getParent() instanceof GrStringInjection ? myGroovySettings.SPACE_WITHIN_GSTRING_INJECTION_BRACES @@ -429,8 +429,8 @@ public class GroovySpacingProcessor extends GroovyElementVisitor { else if (myType1 == GroovyTokenTypes.mCLOSABLE_BLOCK_OP) { myResult = GroovySpacingProcessorBasic.createDependentSpacingForClosure(mySettings, myGroovySettings, closure, true); } - else if (myType1 == GroovyTokenTypes.mLCURLY && (myType2 == GroovyElementTypes.PARAMETERS_LIST || myType2 == - GroovyTokenTypes.mCLOSABLE_BLOCK_OP)) { + else if (myType1 == GroovyTokenTypes.mLCURLY && (myType2 == GroovyElementTypes.PARAMETER_LIST || myType2 == + GroovyTokenTypes.mCLOSABLE_BLOCK_OP)) { boolean spacesWithinBraces = closure.getParent() instanceof GrStringInjection ? myGroovySettings.SPACE_WITHIN_GSTRING_INJECTION_BRACES : mySettings.SPACE_WITHIN_BRACES; @@ -514,7 +514,7 @@ public class GroovySpacingProcessor extends GroovyElementVisitor { if (myType2 == GroovyTokenTypes.mSEMI) return; if (typeDefinitionBody != null) { //check variable definitions only inside class body - if ((myType1 == GroovyElementTypes.VARIABLE_DEFINITION || isSemiAfter(GroovyElementTypes.VARIABLE_DEFINITION)) && TokenSets.METHOD_DEFS.contains(myType2)) { + if ((myType1 == GroovyElementTypes.VARIABLE_DECLARATION || isSemiAfter(GroovyElementTypes.VARIABLE_DECLARATION)) && TokenSets.METHOD_DEFS.contains(myType2)) { final int minBlankLines = Math.max( isInterface ? mySettings.BLANK_LINES_AROUND_METHOD_IN_INTERFACE : mySettings.BLANK_LINES_AROUND_METHOD, isInterface ? mySettings.BLANK_LINES_AROUND_FIELD_IN_INTERFACE : mySettings.BLANK_LINES_AROUND_FIELD @@ -522,8 +522,8 @@ public class GroovySpacingProcessor extends GroovyElementVisitor { myResult = Spacing.createSpacing(0, 0, minBlankLines + 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines()); return; } - else if (myType1 == GroovyElementTypes.VARIABLE_DEFINITION || isSemiAfter(GroovyElementTypes.VARIABLE_DEFINITION) || myType2 == - GroovyElementTypes.VARIABLE_DEFINITION) { + else if (myType1 == GroovyElementTypes.VARIABLE_DECLARATION || isSemiAfter(GroovyElementTypes.VARIABLE_DECLARATION) || myType2 == + GroovyElementTypes.VARIABLE_DECLARATION) { final int minBlankLines = isInterface ? mySettings.BLANK_LINES_AROUND_FIELD_IN_INTERFACE : mySettings.BLANK_LINES_AROUND_FIELD; myResult = Spacing.createSpacing(0, 0, minBlankLines + 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines()); @@ -594,7 +594,7 @@ public class GroovySpacingProcessor extends GroovyElementVisitor { if (myType2 == PARAMETER_LIST) { createSpaceInCode(mySettings.SPACE_BEFORE_METHOD_PARENTHESES); } - else if (myType1 == PARAMETER_LIST && myType2 == GroovyElementTypes.THROW_CLAUSE) { + else if (myType1 == PARAMETER_LIST && myType2 == GroovyElementTypes.THROWS_CLAUSE) { if (mySettings.THROWS_KEYWORD_WRAP == CommonCodeStyleSettings.WRAP_ALWAYS) { createLF(true); } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessorBasic.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessorBasic.java index 67ea6cd1a1b3..0cdd0ca3af71 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessorBasic.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessorBasic.java @@ -105,7 +105,7 @@ public abstract class GroovySpacingProcessorBasic { } //todo:check it for multiple assignments - if ((GroovyElementTypes.VARIABLE_DEFINITION.equals(leftType) || GroovyElementTypes.VARIABLE_DEFINITION.equals(rightType)) && + if ((GroovyElementTypes.VARIABLE_DECLARATION.equals(leftType) || GroovyElementTypes.VARIABLE_DECLARATION.equals(rightType)) && !(leftNode.getTreeNext() instanceof PsiErrorElement)) { return getStatementSpacing(context); } 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 18f270ba52d3..8741207b26ff 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 @@ -117,11 +117,11 @@ public class GroovyWrappingProcessor { } } - if (myParentType == GroovyElementTypes.THROW_CLAUSE && childType == GroovyTokenTypes.kTHROWS) { + if (myParentType == GroovyElementTypes.THROWS_CLAUSE && childType == GroovyTokenTypes.kTHROWS) { return Wrap.createWrap(mySettings.THROWS_KEYWORD_WRAP, true); } - if (myParentType == GroovyElementTypes.MODIFIERS) { + if (myParentType == GroovyElementTypes.MODIFIER_LIST) { if (getLeftSiblingType(childNode) == GroovyElementTypes.ANNOTATION) { return getCommonWrap(); } @@ -138,7 +138,7 @@ public class GroovyWrappingProcessor { if (ANNOTATION_CONTAINERS.contains(myParentType)) { final ASTNode leftSibling = getLeftSibling(childNode); - if (leftSibling != null && leftSibling.getElementType() == GroovyElementTypes.MODIFIERS && endsWithAnnotation(leftSibling)) { + if (leftSibling != null && leftSibling.getElementType() == GroovyElementTypes.MODIFIER_LIST && endsWithAnnotation(leftSibling)) { final int wrapType = getAnnotationsWrapType(childNode); if (wrapType != -1) { return Wrap.createWrap(wrapType, true); @@ -200,13 +200,13 @@ public class GroovyWrappingProcessor { } - if (myParentType == GroovyElementTypes.THROW_CLAUSE) { + if (myParentType == GroovyElementTypes.THROWS_CLAUSE) { myUsedDefaultWrap = true; return Wrap.createWrap(mySettings.THROWS_LIST_WRAP, true); } - if (myParentType == GroovyElementTypes.PARAMETERS_LIST) { + if (myParentType == GroovyElementTypes.PARAMETER_LIST) { myUsedDefaultWrap = true; return Wrap.createWrap(mySettings.METHOD_PARAMETERS_WRAP, false); } @@ -253,7 +253,7 @@ public class GroovyWrappingProcessor { return createNormalWrap(); } - if (myParentType == GroovyElementTypes.MODIFIERS) { + if (myParentType == GroovyElementTypes.MODIFIER_LIST) { final int wrapType = getAnnotationsWrapType(myNode); if (wrapType != -1) { myUsedDefaultWrap = true; @@ -270,13 +270,13 @@ public class GroovyWrappingProcessor { } private final TokenSet ANNOTATION_CONTAINERS = TokenSet.create( - GroovyElementTypes.CLASS_DEFINITION, GroovyElementTypes.INTERFACE_DEFINITION, GroovyElementTypes.ENUM_DEFINITION, GroovyElementTypes.TRAIT_DEFINITION, - GroovyElementTypes.ANNOTATION_DEFINITION, - GroovyElementTypes.METHOD_DEFINITION, GroovyElementTypes.CONSTRUCTOR_DEFINITION, - GroovyElementTypes.VARIABLE_DEFINITION, + GroovyElementTypes.CLASS_TYPE_DEFINITION, GroovyElementTypes.INTERFACE_TYPE_DEFINITION, GroovyElementTypes.ENUM_TYPE_DEFINITION, GroovyElementTypes.TRAIT_TYPE_DEFINITION, + GroovyElementTypes.ANNOTATION_TYPE_DEFINITION, + GroovyElementTypes.METHOD, GroovyElementTypes.CONSTRUCTOR, + GroovyElementTypes.VARIABLE_DECLARATION, GroovyElementTypes.PARAMETER, GroovyElementTypes.ENUM_CONSTANT, - GroovyElementTypes.IMPORT_STATEMENT + GroovyElementTypes.IMPORT ); private int getAnnotationsWrapType(ASTNode modifierList) { @@ -289,7 +289,7 @@ public class GroovyWrappingProcessor { return mySettings.METHOD_ANNOTATION_WRAP; } - if (GroovyElementTypes.VARIABLE_DEFINITION == containerType) { + if (GroovyElementTypes.VARIABLE_DECLARATION == containerType) { final IElementType pparentType = modifierList.getTreeParent().getTreeParent().getElementType(); if (pparentType == GroovyElementTypes.CLASS_BODY || pparentType == GroovyElementTypes.ENUM_BODY) { return mySettings.FIELD_ANNOTATION_WRAP; @@ -307,7 +307,7 @@ public class GroovyWrappingProcessor { return mySettings.ENUM_CONSTANTS_WRAP; } - if (GroovyElementTypes.IMPORT_STATEMENT == containerType) { + if (GroovyElementTypes.IMPORT == containerType) { return myContext.getGroovySettings().IMPORT_ANNOTATION_WRAP; }