From eb27020340c44beec572163e647eac74de700cf0 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Mon, 24 Mar 2014 19:57:18 +0400 Subject: [PATCH] Stubs: reduce the amount of boilerplate code Extract a common type for placeholder stub elements --- .../jetbrains/jet/lang/psi/JetClassBody.java | 6 +- .../jetbrains/jet/lang/psi/JetImportList.java | 6 +- .../jet/lang/psi/JetModifierList.java | 7 +- .../jet/lang/psi/JetParameterList.java | 6 +- .../jet/lang/psi/JetTypeConstraintList.java | 7 +- .../jet/lang/psi/JetTypeParameterList.java | 6 +- .../lang/psi/stubs/PsiJetClassBodyStub.java | 23 ------ .../psi/stubs/PsiJetModifiedListStub.java | 23 ------ .../psi/stubs/PsiJetParameterListStub.java | 23 ------ ...stStub.java => PsiJetPlaceHolderStub.java} | 4 +- .../stubs/PsiJetTypeConstraintListStub.java | 23 ------ .../stubs/PsiJetTypeParameterListStub.java | 23 ------ .../elements/JetAnnotationElementType.java | 13 +--- .../elements/JetClassBodyElementType.java | 67 ----------------- .../stubs/elements/JetClassElementType.java | 4 +- .../elements/JetFunctionElementType.java | 12 +-- .../JetImportDirectiveElementType.java | 33 +------- .../elements/JetImportListElementType.java | 69 ----------------- .../elements/JetModifierListElementType.java | 53 +------------ .../stubs/elements/JetObjectElementType.java | 12 +-- .../elements/JetParameterElementType.java | 18 +---- .../elements/JetParameterListElementType.java | 68 ----------------- .../JetPlaceHolderStubElementType.java | 51 +++++++++++++ .../elements/JetPropertyElementType.java | 12 +-- .../stubs/elements/JetStubElementType.java | 36 ++++++++- .../stubs/elements/JetStubElementTypes.java | 21 ++++-- .../JetTypeConstraintListElementType.java | 75 ------------------- .../elements/JetTypeParameterElementType.java | 19 +---- .../JetTypeParameterListElementType.java | 68 ----------------- .../stubs/impl/PsiJetClassBodyStubImpl.java | 29 ------- .../impl/PsiJetModifiedListStubImpl.java | 29 ------- .../impl/PsiJetParameterListStubImpl.java | 29 ------- ...pl.java => PsiJetPlaceHolderStubImpl.java} | 13 ++-- .../PsiJetTypeConstraintListStubImpl.java | 29 ------- .../impl/PsiJetTypeParameterListStubImpl.java | 34 --------- .../stubs/AnnotationOnFunction.expected | 4 +- .../stubs/AnnotationOnLocalFunction.expected | 2 +- idea/testData/stubs/ClassObject.expected | 6 +- idea/testData/stubs/ClassProperty.expected | 2 +- .../stubs/ClassTypeParameters.expected | 4 +- .../stubs/FunctionInNotNamedObject.expected | 4 +- .../stubs/FunctionParameters.expected | 2 +- idea/testData/stubs/InnerClass.expected | 4 +- idea/testData/stubs/LocalClass.expected | 2 +- .../stubs/LocalClassInLocalFunction.expected | 2 +- idea/testData/stubs/LocalNamedObject.expected | 2 +- idea/testData/stubs/NamedObject.expected | 2 +- .../stubs/NotStorePropertiesFrom.expected | 6 +- .../NotStorePropertyFromInitializer.expected | 2 +- .../stubs/ParametersWithFqName.expected | 4 +- .../QualifiedAnnotationOnFunction.expected | 2 +- idea/testData/stubs/SimpleEnumBuild.expected | 2 +- .../plugin/stubs/AbstractStubBuilderTest.java | 5 +- 53 files changed, 171 insertions(+), 837 deletions(-) delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetClassBodyStub.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetModifiedListStub.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetParameterListStub.java rename compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/{PsiJetImportListStub.java => PsiJetPlaceHolderStub.java} (83%) delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetTypeConstraintListStub.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetTypeParameterListStub.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetClassBodyElementType.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetImportListElementType.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetParameterListElementType.java create mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetPlaceHolderStubElementType.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetTypeConstraintListElementType.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetTypeParameterListElementType.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetClassBodyStubImpl.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetModifiedListStubImpl.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetParameterListStubImpl.java rename compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/{PsiJetImportListStubImpl.java => PsiJetPlaceHolderStubImpl.java} (64%) delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetTypeConstraintListStubImpl.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetTypeParameterListStubImpl.java diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClassBody.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClassBody.java index 7d64dd77d4c..f1983adb012 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClassBody.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClassBody.java @@ -23,18 +23,18 @@ import com.intellij.psi.util.PsiTreeUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.JetNodeTypes; -import org.jetbrains.jet.lang.psi.stubs.PsiJetClassBodyStub; +import org.jetbrains.jet.lang.psi.stubs.PsiJetPlaceHolderStub; import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import org.jetbrains.jet.lexer.JetTokens; import java.util.List; -public class JetClassBody extends JetElementImplStub implements JetDeclarationContainer { +public class JetClassBody extends JetElementImplStub> implements JetDeclarationContainer { public JetClassBody(@NotNull ASTNode node) { super(node); } - public JetClassBody(@NotNull PsiJetClassBodyStub stub) { + public JetClassBody(@NotNull PsiJetPlaceHolderStub stub) { super(stub, JetStubElementTypes.CLASS_BODY); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetImportList.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetImportList.java index 963406a7716..b1e16bd18f9 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetImportList.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetImportList.java @@ -18,19 +18,19 @@ package org.jetbrains.jet.lang.psi; import com.intellij.lang.ASTNode; import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.lang.psi.stubs.PsiJetImportListStub; +import org.jetbrains.jet.lang.psi.stubs.PsiJetPlaceHolderStub; import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import java.util.Arrays; import java.util.List; -public class JetImportList extends JetElementImplStub { +public class JetImportList extends JetElementImplStub> { public JetImportList(@NotNull ASTNode node) { super(node); } - public JetImportList(@NotNull PsiJetImportListStub stub) { + public JetImportList(@NotNull PsiJetPlaceHolderStub stub) { super(stub, JetStubElementTypes.IMPORT_LIST); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetModifierList.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetModifierList.java index 5d9ea5a2586..2ef8b38f2d3 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetModifierList.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetModifierList.java @@ -19,11 +19,10 @@ package org.jetbrains.jet.lang.psi; import com.google.common.collect.Lists; import com.intellij.lang.ASTNode; import com.intellij.psi.PsiElement; -import com.intellij.psi.stubs.IStubElementType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.JetNodeTypes; -import org.jetbrains.jet.lang.psi.stubs.PsiJetModifiedListStub; +import org.jetbrains.jet.lang.psi.stubs.PsiJetPlaceHolderStub; import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import org.jetbrains.jet.lexer.JetKeywordToken; import org.jetbrains.jet.lexer.JetModifierKeywordToken; @@ -33,12 +32,12 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class JetModifierList extends JetElementImplStub { +public class JetModifierList extends JetElementImplStub { public JetModifierList(@NotNull ASTNode node) { super(node); } - public JetModifierList(@NotNull PsiJetModifiedListStub stub) { + public JetModifierList(@NotNull PsiJetPlaceHolderStub stub) { super(stub, JetStubElementTypes.MODIFIER_LIST); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetParameterList.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetParameterList.java index b7ae2299a74..2c157fca3de 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetParameterList.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetParameterList.java @@ -18,18 +18,18 @@ package org.jetbrains.jet.lang.psi; import com.intellij.lang.ASTNode; import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.lang.psi.stubs.PsiJetParameterListStub; +import org.jetbrains.jet.lang.psi.stubs.PsiJetPlaceHolderStub; import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import java.util.Arrays; import java.util.List; -public class JetParameterList extends JetElementImplStub { +public class JetParameterList extends JetElementImplStub> { public JetParameterList(@NotNull ASTNode node) { super(node); } - public JetParameterList(@NotNull PsiJetParameterListStub stub) { + public JetParameterList(@NotNull PsiJetPlaceHolderStub stub) { super(stub, JetStubElementTypes.VALUE_PARAMETER_LIST); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypeConstraintList.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypeConstraintList.java index cd2515019d7..e087ac90458 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypeConstraintList.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypeConstraintList.java @@ -17,20 +17,19 @@ package org.jetbrains.jet.lang.psi; import com.intellij.lang.ASTNode; -import com.intellij.psi.stubs.IStubElementType; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.JetNodeTypes; -import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeConstraintListStub; +import org.jetbrains.jet.lang.psi.stubs.PsiJetPlaceHolderStub; import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import java.util.List; -public class JetTypeConstraintList extends JetElementImplStub { +public class JetTypeConstraintList extends JetElementImplStub> { public JetTypeConstraintList(@NotNull ASTNode node) { super(node); } - public JetTypeConstraintList(@NotNull PsiJetTypeConstraintListStub stub) { + public JetTypeConstraintList(@NotNull PsiJetPlaceHolderStub stub) { super(stub, JetStubElementTypes.TYPE_CONSTRAINT_LIST); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypeParameterList.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypeParameterList.java index 73bc167485a..00d21993038 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypeParameterList.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypeParameterList.java @@ -18,18 +18,18 @@ package org.jetbrains.jet.lang.psi; import com.intellij.lang.ASTNode; import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeParameterListStub; +import org.jetbrains.jet.lang.psi.stubs.PsiJetPlaceHolderStub; import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import java.util.Arrays; import java.util.List; -public class JetTypeParameterList extends JetElementImplStub { +public class JetTypeParameterList extends JetElementImplStub> { public JetTypeParameterList(@NotNull ASTNode node) { super(node); } - public JetTypeParameterList(@NotNull PsiJetTypeParameterListStub stub) { + public JetTypeParameterList(@NotNull PsiJetPlaceHolderStub stub) { super(stub, JetStubElementTypes.TYPE_PARAMETER_LIST); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetClassBodyStub.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetClassBodyStub.java deleted file mode 100644 index 43a81d4d0d5..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetClassBodyStub.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.lang.psi.stubs; - -import com.intellij.psi.stubs.StubElement; -import org.jetbrains.jet.lang.psi.JetClassBody; - -public interface PsiJetClassBodyStub extends StubElement { -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetModifiedListStub.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetModifiedListStub.java deleted file mode 100644 index b503198e898..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetModifiedListStub.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2010-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. - */ - -package org.jetbrains.jet.lang.psi.stubs; - -import com.intellij.psi.stubs.StubElement; -import org.jetbrains.jet.lang.psi.JetModifierList; - -public interface PsiJetModifiedListStub extends StubElement { -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetParameterListStub.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetParameterListStub.java deleted file mode 100644 index 069dc50b764..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetParameterListStub.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.lang.psi.stubs; - -import com.intellij.psi.stubs.StubElement; -import org.jetbrains.jet.lang.psi.JetParameterList; - -public interface PsiJetParameterListStub extends StubElement { -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetImportListStub.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetPlaceHolderStub.java similarity index 83% rename from compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetImportListStub.java rename to compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetPlaceHolderStub.java index 027f5e6b87f..923885025ac 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetImportListStub.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetPlaceHolderStub.java @@ -17,7 +17,7 @@ package org.jetbrains.jet.lang.psi.stubs; import com.intellij.psi.stubs.StubElement; -import org.jetbrains.jet.lang.psi.JetImportList; +import org.jetbrains.jet.lang.psi.JetElement; -public interface PsiJetImportListStub extends StubElement { +public interface PsiJetPlaceHolderStub extends StubElement { } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetTypeConstraintListStub.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetTypeConstraintListStub.java deleted file mode 100644 index a2e11078715..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetTypeConstraintListStub.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2010-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. - */ - -package org.jetbrains.jet.lang.psi.stubs; - -import com.intellij.psi.stubs.StubElement; -import org.jetbrains.jet.lang.psi.JetTypeConstraintList; - -public interface PsiJetTypeConstraintListStub extends StubElement { -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetTypeParameterListStub.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetTypeParameterListStub.java deleted file mode 100644 index d688495e23c..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetTypeParameterListStub.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.lang.psi.stubs; - -import com.intellij.psi.stubs.StubElement; -import org.jetbrains.jet.lang.psi.JetTypeParameterList; - -public interface PsiJetTypeParameterListStub extends StubElement { -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetAnnotationElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetAnnotationElementType.java index 1156126c2b3..5503d240d5e 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetAnnotationElementType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetAnnotationElementType.java @@ -16,7 +16,6 @@ package org.jetbrains.jet.lang.psi.stubs.elements; -import com.intellij.lang.ASTNode; import com.intellij.psi.stubs.IndexSink; import com.intellij.psi.stubs.StubElement; import com.intellij.psi.stubs.StubInputStream; @@ -35,17 +34,7 @@ import java.io.IOException; public class JetAnnotationElementType extends JetStubElementType { public JetAnnotationElementType(@NotNull @NonNls String debugName) { - super(debugName); - } - - @Override - public JetAnnotationEntry createPsiFromAst(@NotNull ASTNode node) { - return new JetAnnotationEntry(node); - } - - @Override - public JetAnnotationEntry createPsi(@NotNull PsiJetAnnotationStub stub) { - return new JetAnnotationEntry(stub); + super(debugName, JetAnnotationEntry.class, PsiJetAnnotationStub.class); } @Override diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetClassBodyElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetClassBodyElementType.java deleted file mode 100644 index 279c452c94e..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetClassBodyElementType.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.lang.psi.stubs.elements; - -import com.intellij.lang.ASTNode; -import com.intellij.psi.stubs.IndexSink; -import com.intellij.psi.stubs.StubElement; -import com.intellij.psi.stubs.StubInputStream; -import com.intellij.psi.stubs.StubOutputStream; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.lang.psi.JetClassBody; -import org.jetbrains.jet.lang.psi.stubs.PsiJetClassBodyStub; -import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetClassBodyStubImpl; - -import java.io.IOException; - -public class JetClassBodyElementType extends JetStubElementType { - public JetClassBodyElementType(@NotNull @NonNls String debugName) { - super(debugName); - } - - @Override - public JetClassBody createPsiFromAst(@NotNull ASTNode node) { - return new JetClassBody(node); - } - - @Override - public JetClassBody createPsi(@NotNull PsiJetClassBodyStub stub) { - return new JetClassBody(stub); - } - - @Override - public PsiJetClassBodyStub createStub(@NotNull JetClassBody psi, StubElement parentStub) { - return new PsiJetClassBodyStubImpl(parentStub); - } - - @Override - public void serialize(@NotNull PsiJetClassBodyStub stub, @NotNull StubOutputStream dataStream) throws IOException { - //do nothing; - } - - @NotNull - @Override - public PsiJetClassBodyStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException { - return new PsiJetClassBodyStubImpl(parentStub); - } - - @Override - public void indexStub(@NotNull PsiJetClassBodyStub stub, @NotNull IndexSink sink) { - //do nothing - } -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetClassElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetClassElementType.java index e14dee57123..59b0386239d 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetClassElementType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetClassElementType.java @@ -38,14 +38,16 @@ import java.util.List; public class JetClassElementType extends JetStubElementType { public JetClassElementType(@NotNull @NonNls String debugName) { - super(debugName); + super(debugName, JetClass.class, PsiJetClassStub.class); } + @NotNull @Override public JetClass createPsi(@NotNull PsiJetClassStub stub) { return !stub.isEnumEntry() ? new JetClass(stub) : new JetEnumEntry(stub); } + @NotNull @Override public JetClass createPsiFromAst(@NotNull ASTNode node) { return node.getElementType() != JetStubElementTypes.ENUM_ENTRY ? new JetClass(node) : new JetEnumEntry(node); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetFunctionElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetFunctionElementType.java index 8bbd8cf8c06..e6422861299 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetFunctionElementType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetFunctionElementType.java @@ -37,17 +37,7 @@ import java.io.IOException; public class JetFunctionElementType extends JetStubElementType { public JetFunctionElementType(@NotNull @NonNls String debugName) { - super(debugName); - } - - @Override - public JetNamedFunction createPsiFromAst(@NotNull ASTNode node) { - return new JetNamedFunction(node); - } - - @Override - public JetNamedFunction createPsi(@NotNull PsiJetFunctionStub stub) { - return new JetNamedFunction(stub); + super(debugName, JetNamedFunction.class, PsiJetFunctionStub.class); } @Override diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetImportDirectiveElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetImportDirectiveElementType.java index 0615708a791..c4c0fca3bfd 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetImportDirectiveElementType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetImportDirectiveElementType.java @@ -16,8 +16,6 @@ package org.jetbrains.jet.lang.psi.stubs.elements; -import com.intellij.lang.ASTNode; -import com.intellij.psi.stubs.IndexSink; import com.intellij.psi.stubs.StubElement; import com.intellij.psi.stubs.StubInputStream; import com.intellij.psi.stubs.StubOutputStream; @@ -31,46 +29,23 @@ import java.io.IOException; public class JetImportDirectiveElementType extends JetStubElementType { public JetImportDirectiveElementType(@NotNull @NonNls String debugName) { - super(debugName); + super(debugName, JetImportDirective.class, PsiJetImportDirectiveStub.class); } @Override - public JetImportDirective createPsiFromAst(@NotNull ASTNode node) { - return new JetImportDirective(node); - } - - @Override - public JetImportDirective createPsi(@NotNull PsiJetImportDirectiveStub stub) { - return new JetImportDirective(stub); - } - - @Override - public PsiJetImportDirectiveStub createStub( - @NotNull JetImportDirective psi, StubElement parentStub - ) { + public PsiJetImportDirectiveStub createStub(@NotNull JetImportDirective psi, StubElement parentStub) { return new PsiJetImportDirectiveStubImpl(parentStub); } @Override - public void serialize( - @NotNull PsiJetImportDirectiveStub stub, @NotNull StubOutputStream dataStream - ) throws IOException { + public void serialize(@NotNull PsiJetImportDirectiveStub stub, @NotNull StubOutputStream dataStream) throws IOException { //TODO: } @NotNull @Override - public PsiJetImportDirectiveStub deserialize( - @NotNull StubInputStream dataStream, StubElement parentStub - ) throws IOException { + public PsiJetImportDirectiveStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException { //TODO return new PsiJetImportDirectiveStubImpl(parentStub); } - - @Override - public void indexStub( - @NotNull PsiJetImportDirectiveStub stub, @NotNull IndexSink sink - ) { - // do nothing - } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetImportListElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetImportListElementType.java deleted file mode 100644 index e8d6072d692..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetImportListElementType.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2010-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. - */ - -package org.jetbrains.jet.lang.psi.stubs.elements; - -import com.intellij.lang.ASTNode; -import com.intellij.psi.stubs.IndexSink; -import com.intellij.psi.stubs.StubElement; -import com.intellij.psi.stubs.StubInputStream; -import com.intellij.psi.stubs.StubOutputStream; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.lang.psi.JetImportList; -import org.jetbrains.jet.lang.psi.stubs.PsiJetImportListStub; -import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetImportListStubImpl; - -import java.io.IOException; - -public class JetImportListElementType extends JetStubElementType { - public JetImportListElementType(@NotNull @NonNls String debugName) { - super(debugName); - } - - @Override - public JetImportList createPsiFromAst(@NotNull ASTNode node) { - return new JetImportList(node); - } - - @Override - public JetImportList createPsi(@NotNull PsiJetImportListStub stub) { - return new JetImportList(stub); - } - - @Override - public PsiJetImportListStub createStub( - @NotNull JetImportList psi, StubElement parentStub - ) { - return new PsiJetImportListStubImpl(parentStub); - } - - @Override - public void serialize(@NotNull PsiJetImportListStub stub, @NotNull StubOutputStream dataStream) throws IOException { - //do nothing; - } - - @NotNull - @Override - public PsiJetImportListStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException { - return new PsiJetImportListStubImpl(parentStub); - } - - @Override - public void indexStub(@NotNull PsiJetImportListStub stub, @NotNull IndexSink sink) { - //do nothing - } -} \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetModifierListElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetModifierListElementType.java index 98e194ffb09..5c89b91696f 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetModifierListElementType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetModifierListElementType.java @@ -16,61 +16,12 @@ package org.jetbrains.jet.lang.psi.stubs.elements; -import com.intellij.lang.ASTNode; -import com.intellij.psi.stubs.IndexSink; -import com.intellij.psi.stubs.StubElement; -import com.intellij.psi.stubs.StubInputStream; -import com.intellij.psi.stubs.StubOutputStream; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.psi.JetModifierList; -import org.jetbrains.jet.lang.psi.stubs.PsiJetModifiedListStub; -import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetModifiedListStubImpl; -import java.io.IOException; - -public class JetModifierListElementType extends JetStubElementType { +public class JetModifierListElementType extends JetPlaceHolderStubElementType { public JetModifierListElementType(@NotNull @NonNls String debugName) { - super(debugName); - } - - @Override - public JetModifierList createPsiFromAst(@NotNull ASTNode node) { - return new JetModifierList(node); - } - - @Override - public JetModifierList createPsi(@NotNull PsiJetModifiedListStub stub) { - return new JetModifierList(stub); - } - - @Override - public PsiJetModifiedListStub createStub( - @NotNull JetModifierList psi, StubElement parentStub - ) { - return new PsiJetModifiedListStubImpl(parentStub); - } - - @Override - public void serialize( - @NotNull PsiJetModifiedListStub stub, @NotNull StubOutputStream dataStream - ) throws IOException { - //TODO: - } - - @NotNull - @Override - public PsiJetModifiedListStub deserialize( - @NotNull StubInputStream dataStream, StubElement parentStub - ) throws IOException { - //TODO: - return new PsiJetModifiedListStubImpl(parentStub); - } - - @Override - public void indexStub( - @NotNull PsiJetModifiedListStub stub, @NotNull IndexSink sink - ) { - // do nothing + super(debugName, JetModifierList.class); } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetObjectElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetObjectElementType.java index 0e233894426..5b9764811e5 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetObjectElementType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetObjectElementType.java @@ -38,17 +38,7 @@ import java.util.List; public class JetObjectElementType extends JetStubElementType { public JetObjectElementType(@NotNull @NonNls String debugName) { - super(debugName); - } - - @Override - public JetObjectDeclaration createPsiFromAst(@NotNull ASTNode node) { - return new JetObjectDeclaration(node); - } - - @Override - public JetObjectDeclaration createPsi(@NotNull PsiJetObjectStub stub) { - return new JetObjectDeclaration(stub); + super(debugName, JetObjectDeclaration.class, PsiJetObjectStub.class); } @Override diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetParameterElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetParameterElementType.java index af50865d523..63f0d4ab737 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetParameterElementType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetParameterElementType.java @@ -18,7 +18,6 @@ package org.jetbrains.jet.lang.psi.stubs.elements; import com.intellij.lang.ASTNode; import com.intellij.psi.PsiElement; -import com.intellij.psi.stubs.IndexSink; import com.intellij.psi.stubs.StubElement; import com.intellij.psi.stubs.StubInputStream; import com.intellij.psi.stubs.StubOutputStream; @@ -36,17 +35,7 @@ import java.io.IOException; public class JetParameterElementType extends JetStubElementType { public JetParameterElementType(@NotNull @NonNls String debugName) { - super(debugName); - } - - @Override - public JetParameter createPsiFromAst(@NotNull ASTNode node) { - return new JetParameter(node); - } - - @Override - public JetParameter createPsi(@NotNull PsiJetParameterStub stub) { - return new JetParameter(stub); + super(debugName, JetParameter.class, PsiJetParameterStub.class); } @Override @@ -94,9 +83,4 @@ public class JetParameterElementType extends JetStubElementType { - public JetParameterListElementType(@NotNull @NonNls String debugName) { - super(debugName); - } - - @Override - public JetParameterList createPsiFromAst(@NotNull ASTNode node) { - return new JetParameterList(node); - } - - @Override - public JetParameterList createPsi(@NotNull PsiJetParameterListStub stub) { - return new JetParameterList(stub); - } - - @Override - public PsiJetParameterListStub createStub(@NotNull JetParameterList psi, StubElement parentStub) { - return new PsiJetParameterListStubImpl(parentStub); - } - - @Override - public void serialize(@NotNull PsiJetParameterListStub stub, @NotNull StubOutputStream dataStream) throws IOException { - // Nothing to serialize - } - - @NotNull - @Override - public PsiJetParameterListStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException { - return new PsiJetParameterListStubImpl(parentStub); - } - - @Override - public void indexStub(@NotNull PsiJetParameterListStub stub, @NotNull IndexSink sink) { - // No index - } -} - diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetPlaceHolderStubElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetPlaceHolderStubElementType.java new file mode 100644 index 00000000000..f672b646088 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetPlaceHolderStubElementType.java @@ -0,0 +1,51 @@ +/* + * Copyright 2010-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. + */ + +package org.jetbrains.jet.lang.psi.stubs.elements; + +import com.intellij.psi.stubs.StubElement; +import com.intellij.psi.stubs.StubInputStream; +import com.intellij.psi.stubs.StubOutputStream; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.lang.psi.JetElementImplStub; +import org.jetbrains.jet.lang.psi.stubs.PsiJetPlaceHolderStub; +import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetPlaceHolderStubImpl; + +import java.io.IOException; + +public class JetPlaceHolderStubElementType> extends JetStubElementType, T> { + + public JetPlaceHolderStubElementType(@NotNull @NonNls String debugName, @NotNull Class psiClass) { + super(debugName, psiClass, PsiJetPlaceHolderStub.class); + } + + @Override + public PsiJetPlaceHolderStub createStub(@NotNull T psi, StubElement parentStub) { + return new PsiJetPlaceHolderStubImpl(parentStub, this); + } + + @Override + public void serialize(@NotNull PsiJetPlaceHolderStub stub, @NotNull StubOutputStream dataStream) throws IOException { + //do nothing + } + + @NotNull + @Override + public PsiJetPlaceHolderStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException { + return new PsiJetPlaceHolderStubImpl(parentStub, this); + } +} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetPropertyElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetPropertyElementType.java index 94b13426d50..bc5dfb8e22c 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetPropertyElementType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetPropertyElementType.java @@ -37,17 +37,7 @@ import java.io.IOException; public class JetPropertyElementType extends JetStubElementType { public JetPropertyElementType(@NotNull @NonNls String debugName) { - super(debugName); - } - - @Override - public JetProperty createPsiFromAst(@NotNull ASTNode node) { - return new JetProperty(node); - } - - @Override - public JetProperty createPsi(@NotNull PsiJetPropertyStub stub) { - return new JetProperty(stub); + super(debugName, JetProperty.class, PsiJetPropertyStub.class); } @Override diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetStubElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetStubElementType.java index 7732fbc6ec9..84607b692a4 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetStubElementType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetStubElementType.java @@ -19,20 +19,45 @@ package org.jetbrains.jet.lang.psi.stubs.elements; import com.intellij.lang.ASTNode; import com.intellij.psi.PsiElement; import com.intellij.psi.stubs.IStubElementType; +import com.intellij.psi.stubs.IndexSink; import com.intellij.psi.stubs.StubElement; import com.intellij.psi.util.PsiTreeUtil; +import com.intellij.util.ReflectionUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.plugin.JetLanguage; -public abstract class JetStubElementType extends IStubElementType { +import java.lang.reflect.Constructor; - public JetStubElementType(@NotNull @NonNls String debugName) { +public abstract class JetStubElementType> extends IStubElementType { + + @NotNull + private final Constructor byNodeConstructor; + @NotNull + private final Constructor byStubConstructor; + + public JetStubElementType(@NotNull @NonNls String debugName, @NotNull Class psiClass, @NotNull Class stubClass) { super(debugName, JetLanguage.INSTANCE); + try { + byNodeConstructor = psiClass.getConstructor(ASTNode.class); + byStubConstructor = psiClass.getConstructor(stubClass); + } + catch (NoSuchMethodException e) { + throw new RuntimeException("Stub element type declaration for " + psiClass.getSimpleName() + " is missing required constructors",e); + } } - public abstract PsiT createPsiFromAst(@NotNull ASTNode node); + @NotNull + public PsiT createPsiFromAst(@NotNull ASTNode node) { + return ReflectionUtil.createInstance(byNodeConstructor, node); + } + + @Override + @NotNull + public PsiT createPsi(@NotNull StubT stub) { + return ReflectionUtil.createInstance(byStubConstructor, stub); + } @NotNull @Override @@ -77,4 +102,9 @@ public abstract class JetStubElementType VALUE_PARAMETER_LIST = + new JetPlaceHolderStubElementType("VALUE_PARAMETER_LIST", JetParameterList.class); JetTypeParameterElementType TYPE_PARAMETER = new JetTypeParameterElementType("TYPE_PARAMETER"); - JetTypeParameterListElementType TYPE_PARAMETER_LIST = new JetTypeParameterListElementType("TYPE_PARAMETER_LIST"); + JetPlaceHolderStubElementType TYPE_PARAMETER_LIST = + new JetPlaceHolderStubElementType("TYPE_PARAMETER_LIST", JetTypeParameterList.class); + JetAnnotationElementType ANNOTATION_ENTRY = new JetAnnotationElementType("ANNOTATION_ENTRY"); - JetClassBodyElementType CLASS_BODY = new JetClassBodyElementType("CLASS_BODY"); - JetImportListElementType IMPORT_LIST = new JetImportListElementType("IMPORT_LIST"); + + JetPlaceHolderStubElementType CLASS_BODY = + new JetPlaceHolderStubElementType("CLASS_BODY", JetClassBody.class); + + JetPlaceHolderStubElementType IMPORT_LIST = + new JetPlaceHolderStubElementType("IMPORT_LIST", JetImportList.class); + JetImportDirectiveElementType IMPORT_DIRECTIVE = new JetImportDirectiveElementType("IMPORT_DIRECTIVE"); JetModifierListElementType MODIFIER_LIST = new JetModifierListElementType("MODIFIER_LIST"); JetModifierListElementType PRIMARY_CONSTRUCTOR_MODIFIER_LIST = new JetModifierListElementType("PRIMARY_CONSTRUCTOR_MODIFIER_LIST"); - JetTypeConstraintListElementType TYPE_CONSTRAINT_LIST = new JetTypeConstraintListElementType("TYPE_CONSTRAINT_LIST"); + JetPlaceHolderStubElementType TYPE_CONSTRAINT_LIST = + new JetPlaceHolderStubElementType("TYPE_CONSTRAINT_LIST", JetTypeConstraintList.class); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetTypeConstraintListElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetTypeConstraintListElementType.java deleted file mode 100644 index 6de3344d4d1..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetTypeConstraintListElementType.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2010-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. - */ - -package org.jetbrains.jet.lang.psi.stubs.elements; - -import com.intellij.lang.ASTNode; -import com.intellij.psi.stubs.IndexSink; -import com.intellij.psi.stubs.StubElement; -import com.intellij.psi.stubs.StubInputStream; -import com.intellij.psi.stubs.StubOutputStream; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.lang.psi.JetTypeConstraintList; -import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeConstraintListStub; -import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetTypeConstraintListStubImpl; - -import java.io.IOException; - -public class JetTypeConstraintListElementType extends JetStubElementType { - public JetTypeConstraintListElementType(@NotNull @NonNls String debugName) { - super(debugName); - } - - @Override - public JetTypeConstraintList createPsiFromAst(@NotNull ASTNode node) { - return new JetTypeConstraintList(node); - } - - @Override - public JetTypeConstraintList createPsi(@NotNull PsiJetTypeConstraintListStub stub) { - return new JetTypeConstraintList(stub); - } - - @Override - public PsiJetTypeConstraintListStub createStub( - @NotNull JetTypeConstraintList psi, StubElement parentStub - ) { - return new PsiJetTypeConstraintListStubImpl(parentStub); - } - - @Override - public void serialize( - @NotNull PsiJetTypeConstraintListStub stub, @NotNull StubOutputStream dataStream - ) throws IOException { - //TODO: - } - - @NotNull - @Override - public PsiJetTypeConstraintListStub deserialize( - @NotNull StubInputStream dataStream, StubElement parentStub - ) throws IOException { - throw new UnsupportedOperationException("org.jetbrains.jet.lang.psi.stubs.elements.JetTypeConstraintListElementType#deserialize"); - } - - @Override - public void indexStub( - @NotNull PsiJetTypeConstraintListStub stub, @NotNull IndexSink sink - ) { - //do nothing - } -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetTypeParameterElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetTypeParameterElementType.java index 337f4a7a0b2..3cabe17ef47 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetTypeParameterElementType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetTypeParameterElementType.java @@ -16,8 +16,6 @@ package org.jetbrains.jet.lang.psi.stubs.elements; -import com.intellij.lang.ASTNode; -import com.intellij.psi.stubs.IndexSink; import com.intellij.psi.stubs.StubElement; import com.intellij.psi.stubs.StubInputStream; import com.intellij.psi.stubs.StubOutputStream; @@ -34,17 +32,7 @@ import java.io.IOException; public class JetTypeParameterElementType extends JetStubElementType { public JetTypeParameterElementType(@NotNull @NonNls String debugName) { - super(debugName); - } - - @Override - public JetTypeParameter createPsiFromAst(@NotNull ASTNode node) { - return new JetTypeParameter(node); - } - - @Override - public JetTypeParameter createPsi(@NotNull PsiJetTypeParameterStub stub) { - return new JetTypeParameter(stub); + super(debugName, JetTypeParameter.class, PsiJetTypeParameterStub.class); } @Override @@ -76,9 +64,4 @@ public class JetTypeParameterElementType extends JetStubElementType { - public JetTypeParameterListElementType(@NotNull @NonNls String debugName) { - super(debugName); - } - - @Override - public JetTypeParameterList createPsiFromAst(@NotNull ASTNode node) { - return new JetTypeParameterList(node); - } - - @Override - public JetTypeParameterList createPsi(@NotNull PsiJetTypeParameterListStub stub) { - return new JetTypeParameterList(stub); - } - - @Override - public PsiJetTypeParameterListStub createStub(@NotNull JetTypeParameterList psi, StubElement parentStub) { - return new PsiJetTypeParameterListStubImpl(parentStub); - } - - @Override - public void serialize(@NotNull PsiJetTypeParameterListStub stub, @NotNull StubOutputStream dataStream) throws IOException { - // Do nothing - } - - @NotNull - @Override - public PsiJetTypeParameterListStub deserialize(StubInputStream dataStream, StubElement parentStub) throws IOException { - return new PsiJetTypeParameterListStubImpl(parentStub); - } - - @Override - public void indexStub(@NotNull PsiJetTypeParameterListStub stub, @NotNull IndexSink sink) { - // No index - } -} - diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetClassBodyStubImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetClassBodyStubImpl.java deleted file mode 100644 index 76523756c83..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetClassBodyStubImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.lang.psi.stubs.impl; - -import com.intellij.psi.stubs.StubBase; -import com.intellij.psi.stubs.StubElement; -import org.jetbrains.jet.lang.psi.JetClassBody; -import org.jetbrains.jet.lang.psi.stubs.PsiJetClassBodyStub; -import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; - -public class PsiJetClassBodyStubImpl extends StubBase implements PsiJetClassBodyStub { - public PsiJetClassBodyStubImpl(StubElement parent) { - super(parent, JetStubElementTypes.CLASS_BODY); - } -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetModifiedListStubImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetModifiedListStubImpl.java deleted file mode 100644 index 31806ac573a..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetModifiedListStubImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2010-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. - */ - -package org.jetbrains.jet.lang.psi.stubs.impl; - -import com.intellij.psi.stubs.StubBase; -import com.intellij.psi.stubs.StubElement; -import org.jetbrains.jet.lang.psi.JetModifierList; -import org.jetbrains.jet.lang.psi.stubs.PsiJetModifiedListStub; -import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; - -public class PsiJetModifiedListStubImpl extends StubBase implements PsiJetModifiedListStub { - public PsiJetModifiedListStubImpl(StubElement parent) { - super(parent, JetStubElementTypes.MODIFIER_LIST); - } -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetParameterListStubImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetParameterListStubImpl.java deleted file mode 100644 index 560812dfd4e..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetParameterListStubImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.lang.psi.stubs.impl; - -import com.intellij.psi.stubs.StubBase; -import com.intellij.psi.stubs.StubElement; -import org.jetbrains.jet.lang.psi.JetParameterList; -import org.jetbrains.jet.lang.psi.stubs.PsiJetParameterListStub; -import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; - -public class PsiJetParameterListStubImpl extends StubBase implements PsiJetParameterListStub { - public PsiJetParameterListStubImpl(StubElement parent) { - super(parent, JetStubElementTypes.VALUE_PARAMETER_LIST); - } -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetImportListStubImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetPlaceHolderStubImpl.java similarity index 64% rename from compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetImportListStubImpl.java rename to compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetPlaceHolderStubImpl.java index 3d070cf7408..5b61bc59081 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetImportListStubImpl.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetPlaceHolderStubImpl.java @@ -16,15 +16,14 @@ package org.jetbrains.jet.lang.psi.stubs.impl; +import com.intellij.psi.stubs.IStubElementType; import com.intellij.psi.stubs.StubBase; import com.intellij.psi.stubs.StubElement; -import org.jetbrains.jet.lang.psi.JetImportList; -import org.jetbrains.jet.lang.psi.stubs.PsiJetImportListStub; -import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; +import org.jetbrains.jet.lang.psi.JetElement; +import org.jetbrains.jet.lang.psi.stubs.PsiJetPlaceHolderStub; -public class PsiJetImportListStubImpl extends StubBase implements PsiJetImportListStub { - - public PsiJetImportListStubImpl(StubElement parent) { - super(parent, JetStubElementTypes.IMPORT_LIST); +public class PsiJetPlaceHolderStubImpl extends StubBase implements PsiJetPlaceHolderStub { + public PsiJetPlaceHolderStubImpl(StubElement parent, IStubElementType elementType) { + super(parent, elementType); } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetTypeConstraintListStubImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetTypeConstraintListStubImpl.java deleted file mode 100644 index d7ba0db52bb..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetTypeConstraintListStubImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2010-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. - */ - -package org.jetbrains.jet.lang.psi.stubs.impl; - -import com.intellij.psi.stubs.StubBase; -import com.intellij.psi.stubs.StubElement; -import org.jetbrains.jet.lang.psi.JetTypeConstraintList; -import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeConstraintListStub; -import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; - -public class PsiJetTypeConstraintListStubImpl extends StubBase implements PsiJetTypeConstraintListStub { - public PsiJetTypeConstraintListStubImpl(StubElement parent) { - super(parent, JetStubElementTypes.TYPE_CONSTRAINT_LIST); - } -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetTypeParameterListStubImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetTypeParameterListStubImpl.java deleted file mode 100644 index e87c15c9c4a..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetTypeParameterListStubImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.jet.lang.psi.stubs.impl; - -import com.intellij.psi.stubs.StubBase; -import com.intellij.psi.stubs.StubElement; -import org.jetbrains.jet.lang.psi.JetTypeParameterList; -import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeParameterListStub; -import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; - -public class PsiJetTypeParameterListStubImpl extends StubBase implements PsiJetTypeParameterListStub { - public PsiJetTypeParameterListStubImpl(StubElement parent) { - super(parent, JetStubElementTypes.TYPE_PARAMETER_LIST); - } - - @Override - public String toString() { - return "PsiJetTypeParameterListStubImpl"; - } -} diff --git a/idea/testData/stubs/AnnotationOnFunction.expected b/idea/testData/stubs/AnnotationOnFunction.expected index fa932fa9ef1..a609e45c639 100644 --- a/idea/testData/stubs/AnnotationOnFunction.expected +++ b/idea/testData/stubs/AnnotationOnFunction.expected @@ -1,4 +1,4 @@ PsiJetFileStubImpl[package=] FUN:PsiJetFunctionStubImpl[top fqName=foo name=foo] - ANNOTATION_ENTRY:PsiJetAnnotationStubImpl[shortName=Deprecated] - VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl + ANNOTATION_ENTRY:PsiJetAnnotationStubImpl[shortName=Deprecated] + VALUE_PARAMETER_LIST diff --git a/idea/testData/stubs/AnnotationOnLocalFunction.expected b/idea/testData/stubs/AnnotationOnLocalFunction.expected index 8f04c639699..9cf4c501b68 100644 --- a/idea/testData/stubs/AnnotationOnLocalFunction.expected +++ b/idea/testData/stubs/AnnotationOnLocalFunction.expected @@ -1,3 +1,3 @@ PsiJetFileStubImpl[package=] FUN:PsiJetFunctionStubImpl[top fqName=foo name=foo] - VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl + VALUE_PARAMETER_LIST diff --git a/idea/testData/stubs/ClassObject.expected b/idea/testData/stubs/ClassObject.expected index 831ac7c6c84..03c62e691b3 100644 --- a/idea/testData/stubs/ClassObject.expected +++ b/idea/testData/stubs/ClassObject.expected @@ -1,7 +1,7 @@ PsiJetFileStubImpl[package=] CLASS:PsiJetClassStubImpl[name=C fqn=C superNames=[]] - CLASS_BODY:PsiJetClassBodyStubImpl + CLASS_BODY OBJECT_DECLARATION:PsiJetObjectStubImpl[class-object name=null fqName=null superNames=[]] - CLASS_BODY:PsiJetClassBodyStubImpl + CLASS_BODY FUN:PsiJetFunctionStubImpl[name=foo] - VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl + VALUE_PARAMETER_LIST diff --git a/idea/testData/stubs/ClassProperty.expected b/idea/testData/stubs/ClassProperty.expected index 0e67e76cfdd..8252a2ad9c5 100644 --- a/idea/testData/stubs/ClassProperty.expected +++ b/idea/testData/stubs/ClassProperty.expected @@ -1,4 +1,4 @@ PsiJetFileStubImpl[package=] CLASS:PsiJetClassStubImpl[name=More fqn=More superNames=[]] - CLASS_BODY:PsiJetClassBodyStubImpl + CLASS_BODY PROPERTY:PsiJetPropertyStubImpl[val name=test typeText=Int bodyText=11] diff --git a/idea/testData/stubs/ClassTypeParameters.expected b/idea/testData/stubs/ClassTypeParameters.expected index dfc9f4e0c79..6531c22387e 100644 --- a/idea/testData/stubs/ClassTypeParameters.expected +++ b/idea/testData/stubs/ClassTypeParameters.expected @@ -1,5 +1,5 @@ PsiJetFileStubImpl[package=] CLASS:PsiJetClassStubImpl[name=C fqn=C superNames=[]] - TYPE_PARAMETER_LIST:PsiJetTypeParameterListStubImpl + TYPE_PARAMETER_LIST TYPE_PARAMETER:PsiJetTypeParameterStubImpl[name=T extendText=null] - CLASS_BODY:PsiJetClassBodyStubImpl + CLASS_BODY diff --git a/idea/testData/stubs/FunctionInNotNamedObject.expected b/idea/testData/stubs/FunctionInNotNamedObject.expected index 022d543dac8..f6ec362ef64 100644 --- a/idea/testData/stubs/FunctionInNotNamedObject.expected +++ b/idea/testData/stubs/FunctionInNotNamedObject.expected @@ -1,5 +1,5 @@ PsiJetFileStubImpl[package=] OBJECT_DECLARATION:PsiJetObjectStubImpl[top name=null fqName= superNames=[]] - CLASS_BODY:PsiJetClassBodyStubImpl + CLASS_BODY FUN:PsiJetFunctionStubImpl[name=testing] - VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl + VALUE_PARAMETER_LIST diff --git a/idea/testData/stubs/FunctionParameters.expected b/idea/testData/stubs/FunctionParameters.expected index 9bbb06da036..f1a1ed69284 100644 --- a/idea/testData/stubs/FunctionParameters.expected +++ b/idea/testData/stubs/FunctionParameters.expected @@ -1,5 +1,5 @@ PsiJetFileStubImpl[package=] FUN:PsiJetFunctionStubImpl[top fqName=some name=some] - VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl + VALUE_PARAMETER_LIST VALUE_PARAMETER:PsiJetParameterStubImpl[val name=t typeText=Int defaultValue=null] VALUE_PARAMETER:PsiJetParameterStubImpl[val name=other typeText=String defaultValue="hello"] diff --git a/idea/testData/stubs/InnerClass.expected b/idea/testData/stubs/InnerClass.expected index 62164c068b5..f8e30546d8c 100644 --- a/idea/testData/stubs/InnerClass.expected +++ b/idea/testData/stubs/InnerClass.expected @@ -1,5 +1,5 @@ PsiJetFileStubImpl[package=] CLASS:PsiJetClassStubImpl[name=A fqn=A superNames=[]] - CLASS_BODY:PsiJetClassBodyStubImpl + CLASS_BODY CLASS:PsiJetClassStubImpl[inner name=B fqn=A.B superNames=[]] - CLASS_BODY:PsiJetClassBodyStubImpl + CLASS_BODY diff --git a/idea/testData/stubs/LocalClass.expected b/idea/testData/stubs/LocalClass.expected index 8db9d5f72de..4aa7a09c53a 100644 --- a/idea/testData/stubs/LocalClass.expected +++ b/idea/testData/stubs/LocalClass.expected @@ -2,5 +2,5 @@ PsiJetFileStubImpl[package=] CLASS:PsiJetClassStubImpl[name=A fqn=A superNames=[]] CLASS:PsiJetClassStubImpl[trait name=T fqn=T superNames=[]] FUN:PsiJetFunctionStubImpl[top fqName=foo name=foo] - VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl + VALUE_PARAMETER_LIST CLASS:PsiJetClassStubImpl[local name=Test fqn=null superNames=[AT]] diff --git a/idea/testData/stubs/LocalClassInLocalFunction.expected b/idea/testData/stubs/LocalClassInLocalFunction.expected index 8db9d5f72de..4aa7a09c53a 100644 --- a/idea/testData/stubs/LocalClassInLocalFunction.expected +++ b/idea/testData/stubs/LocalClassInLocalFunction.expected @@ -2,5 +2,5 @@ PsiJetFileStubImpl[package=] CLASS:PsiJetClassStubImpl[name=A fqn=A superNames=[]] CLASS:PsiJetClassStubImpl[trait name=T fqn=T superNames=[]] FUN:PsiJetFunctionStubImpl[top fqName=foo name=foo] - VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl + VALUE_PARAMETER_LIST CLASS:PsiJetClassStubImpl[local name=Test fqn=null superNames=[AT]] diff --git a/idea/testData/stubs/LocalNamedObject.expected b/idea/testData/stubs/LocalNamedObject.expected index 57fa824514d..ad55ff9fbff 100644 --- a/idea/testData/stubs/LocalNamedObject.expected +++ b/idea/testData/stubs/LocalNamedObject.expected @@ -2,5 +2,5 @@ PsiJetFileStubImpl[package=] CLASS:PsiJetClassStubImpl[name=A fqn=A superNames=[]] CLASS:PsiJetClassStubImpl[trait name=T fqn=T superNames=[]] FUN:PsiJetFunctionStubImpl[top fqName=foo name=foo] - VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl + VALUE_PARAMETER_LIST OBJECT_DECLARATION:PsiJetObjectStubImpl[local name=O fqName=null superNames=[AT]] diff --git a/idea/testData/stubs/NamedObject.expected b/idea/testData/stubs/NamedObject.expected index d8d2c3acade..6a1c3dd3de6 100644 --- a/idea/testData/stubs/NamedObject.expected +++ b/idea/testData/stubs/NamedObject.expected @@ -2,4 +2,4 @@ PsiJetFileStubImpl[package=] CLASS:PsiJetClassStubImpl[name=A fqn=A superNames=[]] CLASS:PsiJetClassStubImpl[trait name=T fqn=T superNames=[]] OBJECT_DECLARATION:PsiJetObjectStubImpl[top name=Test fqName=Test superNames=[AT]] - CLASS_BODY:PsiJetClassBodyStubImpl + CLASS_BODY diff --git a/idea/testData/stubs/NotStorePropertiesFrom.expected b/idea/testData/stubs/NotStorePropertiesFrom.expected index 1402f800356..d2c3af2032a 100644 --- a/idea/testData/stubs/NotStorePropertiesFrom.expected +++ b/idea/testData/stubs/NotStorePropertiesFrom.expected @@ -1,7 +1,7 @@ PsiJetFileStubImpl[package=] CLASS:PsiJetClassStubImpl[name=Test fqn=Test superNames=[]] - VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl - CLASS_BODY:PsiJetClassBodyStubImpl + VALUE_PARAMETER_LIST + CLASS_BODY PROPERTY:PsiJetPropertyStubImpl[val name=test typeText=null bodyText=12] FUN:PsiJetFunctionStubImpl[name=more] - VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl + VALUE_PARAMETER_LIST diff --git a/idea/testData/stubs/NotStorePropertyFromInitializer.expected b/idea/testData/stubs/NotStorePropertyFromInitializer.expected index 9399f90088b..adf017b5d97 100644 --- a/idea/testData/stubs/NotStorePropertyFromInitializer.expected +++ b/idea/testData/stubs/NotStorePropertyFromInitializer.expected @@ -1,3 +1,3 @@ PsiJetFileStubImpl[package=] FUN:PsiJetFunctionStubImpl[top fqName=some ext name=some] - VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl + VALUE_PARAMETER_LIST diff --git a/idea/testData/stubs/ParametersWithFqName.expected b/idea/testData/stubs/ParametersWithFqName.expected index 047e62be2bc..b251325a5bd 100644 --- a/idea/testData/stubs/ParametersWithFqName.expected +++ b/idea/testData/stubs/ParametersWithFqName.expected @@ -1,7 +1,7 @@ PsiJetFileStubImpl[package=test] CLASS:PsiJetClassStubImpl[name=A fqn=test.A superNames=[]] - VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl + VALUE_PARAMETER_LIST VALUE_PARAMETER:PsiJetParameterStubImpl[val name=b fqName=test.A.b typeText=Int defaultValue=null] VALUE_PARAMETER:PsiJetParameterStubImpl[var name=c fqName=test.A.c typeText=String defaultValue=null] VALUE_PARAMETER:PsiJetParameterStubImpl[val name=justParam typeText=Int defaultValue=null] - CLASS_BODY:PsiJetClassBodyStubImpl + CLASS_BODY diff --git a/idea/testData/stubs/QualifiedAnnotationOnFunction.expected b/idea/testData/stubs/QualifiedAnnotationOnFunction.expected index fa932fa9ef1..e40f432ab71 100644 --- a/idea/testData/stubs/QualifiedAnnotationOnFunction.expected +++ b/idea/testData/stubs/QualifiedAnnotationOnFunction.expected @@ -1,4 +1,4 @@ PsiJetFileStubImpl[package=] FUN:PsiJetFunctionStubImpl[top fqName=foo name=foo] ANNOTATION_ENTRY:PsiJetAnnotationStubImpl[shortName=Deprecated] - VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl + VALUE_PARAMETER_LIST diff --git a/idea/testData/stubs/SimpleEnumBuild.expected b/idea/testData/stubs/SimpleEnumBuild.expected index c126e12d911..8429a1a3d66 100644 --- a/idea/testData/stubs/SimpleEnumBuild.expected +++ b/idea/testData/stubs/SimpleEnumBuild.expected @@ -1,5 +1,5 @@ PsiJetFileStubImpl[package=] CLASS:PsiJetClassStubImpl[enumClass name=Test fqn=Test superNames=[]] - CLASS_BODY:PsiJetClassBodyStubImpl + CLASS_BODY ENUM_ENTRY:PsiJetClassStubImpl[enumEntry name=First fqn=Test.First superNames=[]] ENUM_ENTRY:PsiJetClassStubImpl[enumEntry name=Second fqn=Test.Second superNames=[]] diff --git a/idea/tests/org/jetbrains/jet/plugin/stubs/AbstractStubBuilderTest.java b/idea/tests/org/jetbrains/jet/plugin/stubs/AbstractStubBuilderTest.java index 0ce6ba41db4..c647fbeb4d6 100644 --- a/idea/tests/org/jetbrains/jet/plugin/stubs/AbstractStubBuilderTest.java +++ b/idea/tests/org/jetbrains/jet/plugin/stubs/AbstractStubBuilderTest.java @@ -24,6 +24,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.JetTestUtils; import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.stubs.elements.JetFileStubBuilder; +import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetPlaceHolderStubImpl; import org.jetbrains.jet.lang.resolve.lazy.ResolveSessionUtils; import java.io.File; @@ -35,7 +36,9 @@ public abstract class AbstractStubBuilderTest extends LightCodeInsightFixtureTes JetFile file = (JetFile) myFixture.configureByFile(sourcePath); JetFileStubBuilder jetStubBuilder = new JetFileStubBuilder(); StubElement lighterTree = jetStubBuilder.buildStubTree(file); - String stubTree = DebugUtil.stubTreeToString(lighterTree).replace(NO_NAME_FOR_LAZY_RESOLVE.asString(), ""); + String stubTree = DebugUtil.stubTreeToString(lighterTree) + .replace(NO_NAME_FOR_LAZY_RESOLVE.asString(), "") + .replace(":" + PsiJetPlaceHolderStubImpl.class.getSimpleName(), ""); String expectedFile = sourcePath.replace(".kt", ".expected"); JetTestUtils.assertEqualsToFile(new File(expectedFile), stubTree); }