From 2d3eb9a23ff3efc18c2de732bd5126f85c1c002f Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Thu, 19 Apr 2018 13:38:05 +0300 Subject: [PATCH] [groovy] extract 'debugName' constructor parameter in element types This way they can be used from GrammarKit-generated parser. --- .../lang/parser/GroovyElementTypes.java | 14 ++++++------- .../GrAnnotationArgumentListElementType.java | 20 +++--------------- .../elements/GrEnumConstantElementType.java | 20 +++--------------- .../stubs/elements/GrFieldElementType.java | 20 +++--------------- .../elements/GrNameValuePairElementType.java | 21 +++---------------- .../GrTypeParameterBoundsElementType.java | 4 ++-- .../GrVariableDeclarationElementType.java | 20 +++--------------- .../stubs/elements/GrVariableElementType.java | 20 +++--------------- 8 files changed, 27 insertions(+), 112 deletions(-) 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 ee00a104f59a..82afafbc5e9a 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 @@ -42,8 +42,8 @@ public interface GroovyElementTypes { GrStubElementType TRAIT_DEFINITION = new GrTraitElementType("Trait definition"); GrStubElementType ENUM_CONSTANT_INITIALIZER = new GrEnumConstantInitializerElementType("Enum constant initializer"); - GrStubElementType ENUM_CONSTANT = new GrEnumConstantElementType(); - GrStubElementType FIELD = new GrFieldElementType(); + GrStubElementType ENUM_CONSTANT = new GrEnumConstantElementType("Enumeration constant"); + GrStubElementType FIELD = new GrFieldElementType("field"); GrMethodElementType METHOD_DEFINITION = new GrMethodElementType("method definition"); GrStubElementType ANNOTATION_METHOD = new GrAnnotationMethodElementType("annotation method"); @@ -150,7 +150,7 @@ public interface GroovyElementTypes { GrStubElementType TYPE_PARAMETER = new GrTypeParameterElementType("type parameter"); - IStubElementType TYPE_PARAMETER_EXTENDS_BOUND_LIST = new GrTypeParameterBoundsElementType(); + IStubElementType TYPE_PARAMETER_EXTENDS_BOUND_LIST = new GrTypeParameterBoundsElementType("type extends list"); GroovyElementType DEFAULT_ANNOTATION_VALUE = new GroovyElementType("default annotation value"); @@ -161,8 +161,8 @@ public interface GroovyElementTypes { GrReferenceListElementType THROW_CLAUSE = new GrThrowsClauseElementType("throw clause"); //annotation GroovyElementType ANNOTATION_ARRAY_INITIALIZER = new GroovyElementType("annotation array initializer"); - GrAnnotationArgumentListElementType ANNOTATION_ARGUMENTS = new GrAnnotationArgumentListElementType(); - GrNameValuePairElementType ANNOTATION_MEMBER_VALUE_PAIR = new GrNameValuePairElementType(); + GrAnnotationArgumentListElementType ANNOTATION_ARGUMENTS = new GrAnnotationArgumentListElementType("annotation arguments"); + GrNameValuePairElementType ANNOTATION_MEMBER_VALUE_PAIR = new GrNameValuePairElementType("Annotation name value pair"); GrStubElementType ANNOTATION = new GrAnnotationElementType("annotation"); //parameters @@ -194,11 +194,11 @@ public interface GroovyElementTypes { GroovyElementType CLASS_INITIALIZER = new GroovyElementType("static compound statement"); EmptyStubElementType VARIABLE_DEFINITION_ERROR = new GrErrorVariableDeclarationElementType("variable definitions with errors"); - GrVariableDeclarationElementType VARIABLE_DEFINITION = new GrVariableDeclarationElementType(); + GrVariableDeclarationElementType VARIABLE_DEFINITION = new GrVariableDeclarationElementType("variable definitions"); GroovyElementType TUPLE_DECLARATION = new GroovyElementType("tuple declaration"); GroovyElementType TUPLE = new GroovyElementType("tuple"); - GrVariableElementType VARIABLE = new GrVariableElementType(); + GrVariableElementType VARIABLE = new GrVariableElementType("assigned variable"); //modifiers GrStubElementType MODIFIERS = new GrModifierListElementType("modifier list"); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrAnnotationArgumentListElementType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrAnnotationArgumentListElementType.java index f5231c5fec57..bed59c58694c 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrAnnotationArgumentListElementType.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrAnnotationArgumentListElementType.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// 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.psi.stubs.elements; import com.intellij.psi.stubs.EmptyStub; @@ -24,8 +10,8 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.auxiliary.annotation.GrAnnotat public class GrAnnotationArgumentListElementType extends EmptyStubElementType { - public GrAnnotationArgumentListElementType() { - super("annotation arguments", GroovyLanguage.INSTANCE); + public GrAnnotationArgumentListElementType(String debugName) { + super(debugName, GroovyLanguage.INSTANCE); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrEnumConstantElementType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrEnumConstantElementType.java index 006dd1d395fa..c70bfdcc6fbf 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrEnumConstantElementType.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrEnumConstantElementType.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// 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.psi.stubs.elements; import com.intellij.psi.stubs.IndexSink; @@ -35,8 +21,8 @@ import java.io.IOException; */ public class GrEnumConstantElementType extends GrStubElementType { - public GrEnumConstantElementType() { - super("Enumeration constant"); + public GrEnumConstantElementType(String debugName) { + super(debugName); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrFieldElementType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrFieldElementType.java index 9f11a4d9e169..bc431bc6dfb0 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrFieldElementType.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrFieldElementType.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// 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.psi.stubs.elements; import com.intellij.psi.impl.java.stubs.index.JavaStubIndexKeys; @@ -40,8 +26,8 @@ import java.util.Set; */ public class GrFieldElementType extends GrStubElementType { - public GrFieldElementType() { - super("field"); + public GrFieldElementType(String debugName) { + super(debugName); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrNameValuePairElementType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrNameValuePairElementType.java index fe43b17a34b7..3aeadc2f847b 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrNameValuePairElementType.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrNameValuePairElementType.java @@ -1,24 +1,9 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// 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.psi.stubs.elements; import com.intellij.psi.stubs.StubElement; import com.intellij.psi.stubs.StubInputStream; import com.intellij.psi.stubs.StubOutputStream; -import com.intellij.util.io.StringRef; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotationMemberValue; import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotationNameValuePair; @@ -30,8 +15,8 @@ import java.io.IOException; @SuppressWarnings("Duplicates") public class GrNameValuePairElementType extends GrStubElementType { - public GrNameValuePairElementType() { - super("Annotation name value pair"); + public GrNameValuePairElementType(String debugName) { + super(debugName); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrTypeParameterBoundsElementType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrTypeParameterBoundsElementType.java index 404a2051a73a..7f35ebae1d3c 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrTypeParameterBoundsElementType.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrTypeParameterBoundsElementType.java @@ -8,8 +8,8 @@ import org.jetbrains.plugins.groovy.lang.psi.stubs.GrReferenceListStub; public final class GrTypeParameterBoundsElementType extends GrReferenceListElementType { - public GrTypeParameterBoundsElementType() { - super("type extends list"); + public GrTypeParameterBoundsElementType(String debugName) { + super(debugName); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrVariableDeclarationElementType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrVariableDeclarationElementType.java index c1edcb9a99ae..ffc8e44a2da7 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrVariableDeclarationElementType.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrVariableDeclarationElementType.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// 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.psi.stubs.elements; import com.intellij.lang.ASTNode; @@ -36,8 +22,8 @@ import java.io.IOException; public class GrVariableDeclarationElementType extends GrStubElementType { - public GrVariableDeclarationElementType() { - super("variable definitions"); + public GrVariableDeclarationElementType(String debugName) { + super(debugName); } @Override 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 6c7948fd750e..85bcb4b2dcf2 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 @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// 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.psi.stubs.elements; import com.intellij.lang.ASTNode; @@ -31,8 +17,8 @@ import java.io.IOException; public final class GrVariableElementType extends GrStubElementType { - public GrVariableElementType() { - super("assigned variable"); + public GrVariableElementType(String debugName) { + super(debugName); } @Override