Stubs: reduce the amount of boilerplate code

Extract a common type for placeholder stub elements
This commit is contained in:
Pavel V. Talanov
2014-03-24 19:57:18 +04:00
parent 512d1c05df
commit eb27020340
53 changed files with 171 additions and 837 deletions
@@ -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<PsiJetClassBodyStub> implements JetDeclarationContainer {
public class JetClassBody extends JetElementImplStub<PsiJetPlaceHolderStub<JetClassBody>> implements JetDeclarationContainer {
public JetClassBody(@NotNull ASTNode node) {
super(node);
}
public JetClassBody(@NotNull PsiJetClassBodyStub stub) {
public JetClassBody(@NotNull PsiJetPlaceHolderStub<JetClassBody> stub) {
super(stub, JetStubElementTypes.CLASS_BODY);
}
@@ -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<PsiJetImportListStub> {
public class JetImportList extends JetElementImplStub<PsiJetPlaceHolderStub<JetImportList>> {
public JetImportList(@NotNull ASTNode node) {
super(node);
}
public JetImportList(@NotNull PsiJetImportListStub stub) {
public JetImportList(@NotNull PsiJetPlaceHolderStub<JetImportList> stub) {
super(stub, JetStubElementTypes.IMPORT_LIST);
}
@@ -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<PsiJetModifiedListStub> {
public class JetModifierList extends JetElementImplStub<PsiJetPlaceHolderStub> {
public JetModifierList(@NotNull ASTNode node) {
super(node);
}
public JetModifierList(@NotNull PsiJetModifiedListStub stub) {
public JetModifierList(@NotNull PsiJetPlaceHolderStub stub) {
super(stub, JetStubElementTypes.MODIFIER_LIST);
}
@@ -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<PsiJetParameterListStub> {
public class JetParameterList extends JetElementImplStub<PsiJetPlaceHolderStub<JetParameterList>> {
public JetParameterList(@NotNull ASTNode node) {
super(node);
}
public JetParameterList(@NotNull PsiJetParameterListStub stub) {
public JetParameterList(@NotNull PsiJetPlaceHolderStub<JetParameterList> stub) {
super(stub, JetStubElementTypes.VALUE_PARAMETER_LIST);
}
@@ -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<PsiJetTypeConstraintListStub> {
public class JetTypeConstraintList extends JetElementImplStub<PsiJetPlaceHolderStub<JetTypeConstraintList>> {
public JetTypeConstraintList(@NotNull ASTNode node) {
super(node);
}
public JetTypeConstraintList(@NotNull PsiJetTypeConstraintListStub stub) {
public JetTypeConstraintList(@NotNull PsiJetPlaceHolderStub<JetTypeConstraintList> stub) {
super(stub, JetStubElementTypes.TYPE_CONSTRAINT_LIST);
}
@@ -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<PsiJetTypeParameterListStub> {
public class JetTypeParameterList extends JetElementImplStub<PsiJetPlaceHolderStub<JetTypeParameterList>> {
public JetTypeParameterList(@NotNull ASTNode node) {
super(node);
}
public JetTypeParameterList(@NotNull PsiJetTypeParameterListStub stub) {
public JetTypeParameterList(@NotNull PsiJetPlaceHolderStub<JetTypeParameterList> stub) {
super(stub, JetStubElementTypes.TYPE_PARAMETER_LIST);
}
@@ -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<JetClassBody> {
}
@@ -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<JetModifierList> {
}
@@ -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<JetParameterList> {
}
@@ -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<JetImportList> {
public interface PsiJetPlaceHolderStub<T extends JetElement> extends StubElement<T> {
}
@@ -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<JetTypeConstraintList> {
}
@@ -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<JetTypeParameterList> {
}
@@ -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<PsiJetAnnotationStub, JetAnnotationEntry> {
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
@@ -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<PsiJetClassBodyStub, JetClassBody> {
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
}
}
@@ -38,14 +38,16 @@ import java.util.List;
public class JetClassElementType extends JetStubElementType<PsiJetClassStub, JetClass> {
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);
@@ -37,17 +37,7 @@ import java.io.IOException;
public class JetFunctionElementType extends JetStubElementType<PsiJetFunctionStub, JetNamedFunction> {
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
@@ -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<PsiJetImportDirectiveStub, JetImportDirective> {
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
}
}
@@ -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<PsiJetImportListStub, JetImportList> {
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
}
}
@@ -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<PsiJetModifiedListStub, JetModifierList> {
public class JetModifierListElementType extends JetPlaceHolderStubElementType<JetModifierList> {
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);
}
}
@@ -38,17 +38,7 @@ import java.util.List;
public class JetObjectElementType extends JetStubElementType<PsiJetObjectStub, JetObjectDeclaration> {
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
@@ -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<PsiJetParameterStub, JetParameter> {
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<PsiJetParameterS
return new PsiJetParameterStubImpl(parentStub, fqName, name, isMutable, isVarArg,
typeText, defaultValueText);
}
@Override
public void indexStub(@NotNull PsiJetParameterStub stub, @NotNull IndexSink sink) {
// No index
}
}
@@ -1,68 +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.JetParameterList;
import org.jetbrains.jet.lang.psi.stubs.PsiJetParameterListStub;
import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetParameterListStubImpl;
import java.io.IOException;
public class JetParameterListElementType extends JetStubElementType<PsiJetParameterListStub, JetParameterList> {
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
}
}
@@ -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<T extends JetElementImplStub<?>> extends JetStubElementType<PsiJetPlaceHolderStub<T>, T> {
public JetPlaceHolderStubElementType(@NotNull @NonNls String debugName, @NotNull Class<T> psiClass) {
super(debugName, psiClass, PsiJetPlaceHolderStub.class);
}
@Override
public PsiJetPlaceHolderStub<T> createStub(@NotNull T psi, StubElement parentStub) {
return new PsiJetPlaceHolderStubImpl<T>(parentStub, this);
}
@Override
public void serialize(@NotNull PsiJetPlaceHolderStub<T> stub, @NotNull StubOutputStream dataStream) throws IOException {
//do nothing
}
@NotNull
@Override
public PsiJetPlaceHolderStub<T> deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
return new PsiJetPlaceHolderStubImpl<T>(parentStub, this);
}
}
@@ -37,17 +37,7 @@ import java.io.IOException;
public class JetPropertyElementType extends JetStubElementType<PsiJetPropertyStub, JetProperty> {
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
@@ -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<StubT extends StubElement, PsiT extends PsiElement> extends IStubElementType<StubT, PsiT> {
import java.lang.reflect.Constructor;
public JetStubElementType(@NotNull @NonNls String debugName) {
public abstract class JetStubElementType<StubT extends StubElement, PsiT extends JetElementImplStub<?>> extends IStubElementType<StubT, PsiT> {
@NotNull
private final Constructor<PsiT> byNodeConstructor;
@NotNull
private final Constructor<PsiT> byStubConstructor;
public JetStubElementType(@NotNull @NonNls String debugName, @NotNull Class<PsiT> 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<StubT extends StubElement, PsiT extends
return super.shouldCreateStub(node);
}
@Override
public void indexStub(@NotNull StubT stub, @NotNull IndexSink sink) {
// do not force inheritors to implement this method
}
}
@@ -16,6 +16,8 @@
package org.jetbrains.jet.lang.psi.stubs.elements;
import org.jetbrains.jet.lang.psi.*;
public interface JetStubElementTypes {
JetFileElementType FILE = new JetFileElementType();
@@ -26,17 +28,26 @@ public interface JetStubElementTypes {
JetObjectElementType OBJECT_DECLARATION = new JetObjectElementType("OBJECT_DECLARATION");
JetParameterElementType VALUE_PARAMETER = new JetParameterElementType("VALUE_PARAMETER");
JetParameterListElementType VALUE_PARAMETER_LIST = new JetParameterListElementType("VALUE_PARAMETER_LIST");
JetPlaceHolderStubElementType<JetParameterList> VALUE_PARAMETER_LIST =
new JetPlaceHolderStubElementType<JetParameterList>("VALUE_PARAMETER_LIST", JetParameterList.class);
JetTypeParameterElementType TYPE_PARAMETER = new JetTypeParameterElementType("TYPE_PARAMETER");
JetTypeParameterListElementType TYPE_PARAMETER_LIST = new JetTypeParameterListElementType("TYPE_PARAMETER_LIST");
JetPlaceHolderStubElementType<JetTypeParameterList> TYPE_PARAMETER_LIST =
new JetPlaceHolderStubElementType<JetTypeParameterList>("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<JetClassBody> CLASS_BODY =
new JetPlaceHolderStubElementType<JetClassBody>("CLASS_BODY", JetClassBody.class);
JetPlaceHolderStubElementType<JetImportList> IMPORT_LIST =
new JetPlaceHolderStubElementType<JetImportList>("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<JetTypeConstraintList> TYPE_CONSTRAINT_LIST =
new JetPlaceHolderStubElementType<JetTypeConstraintList>("TYPE_CONSTRAINT_LIST", JetTypeConstraintList.class);
}
@@ -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<PsiJetTypeConstraintListStub, JetTypeConstraintList> {
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
}
}
@@ -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<PsiJetTypeParameterStub, JetTypeParameter> {
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<PsiJetTypePa
return new PsiJetTypeParameterStubImpl(parentStub,
name, extendBoundTypeText, isInVariance, isOutVariance);
}
@Override
public void indexStub(@NotNull PsiJetTypeParameterStub stub, @NotNull IndexSink sink) {
// No index
}
}
@@ -1,68 +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.JetTypeParameterList;
import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeParameterListStub;
import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetTypeParameterListStubImpl;
import java.io.IOException;
public class JetTypeParameterListElementType extends JetStubElementType<PsiJetTypeParameterListStub, JetTypeParameterList> {
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
}
}
@@ -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<JetClassBody> implements PsiJetClassBodyStub {
public PsiJetClassBodyStubImpl(StubElement parent) {
super(parent, JetStubElementTypes.CLASS_BODY);
}
}
@@ -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<JetModifierList> implements PsiJetModifiedListStub {
public PsiJetModifiedListStubImpl(StubElement parent) {
super(parent, JetStubElementTypes.MODIFIER_LIST);
}
}
@@ -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<JetParameterList> implements PsiJetParameterListStub {
public PsiJetParameterListStubImpl(StubElement parent) {
super(parent, JetStubElementTypes.VALUE_PARAMETER_LIST);
}
}
@@ -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<JetImportList> implements PsiJetImportListStub {
public PsiJetImportListStubImpl(StubElement parent) {
super(parent, JetStubElementTypes.IMPORT_LIST);
public class PsiJetPlaceHolderStubImpl<T extends JetElement> extends StubBase<T> implements PsiJetPlaceHolderStub<T> {
public PsiJetPlaceHolderStubImpl(StubElement parent, IStubElementType elementType) {
super(parent, elementType);
}
}
@@ -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<JetTypeConstraintList> implements PsiJetTypeConstraintListStub {
public PsiJetTypeConstraintListStubImpl(StubElement parent) {
super(parent, JetStubElementTypes.TYPE_CONSTRAINT_LIST);
}
}
@@ -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<JetTypeParameterList> implements PsiJetTypeParameterListStub {
public PsiJetTypeParameterListStubImpl(StubElement parent) {
super(parent, JetStubElementTypes.TYPE_PARAMETER_LIST);
}
@Override
public String toString() {
return "PsiJetTypeParameterListStubImpl";
}
}
@@ -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
@@ -1,3 +1,3 @@
PsiJetFileStubImpl[package=]
FUN:PsiJetFunctionStubImpl[top fqName=foo name=foo]
VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl
VALUE_PARAMETER_LIST
+3 -3
View File
@@ -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
+1 -1
View File
@@ -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]
@@ -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
@@ -1,5 +1,5 @@
PsiJetFileStubImpl[package=]
OBJECT_DECLARATION:PsiJetObjectStubImpl[top name=null fqName=<no name> superNames=[]]
CLASS_BODY:PsiJetClassBodyStubImpl
CLASS_BODY
FUN:PsiJetFunctionStubImpl[name=testing]
VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl
VALUE_PARAMETER_LIST
@@ -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"]
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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]]
@@ -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]]
@@ -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]]
+1 -1
View File
@@ -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
@@ -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
@@ -1,3 +1,3 @@
PsiJetFileStubImpl[package=]
FUN:PsiJetFunctionStubImpl[top fqName=some ext name=some]
VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl
VALUE_PARAMETER_LIST
@@ -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
@@ -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
+1 -1
View File
@@ -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=[]]
@@ -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(), "<no name>");
String stubTree = DebugUtil.stubTreeToString(lighterTree)
.replace(NO_NAME_FOR_LAZY_RESOLVE.asString(), "<no name>")
.replace(":" + PsiJetPlaceHolderStubImpl.class.getSimpleName(), "");
String expectedFile = sourcePath.replace(".kt", ".expected");
JetTestUtils.assertEqualsToFile(new File(expectedFile), stubTree);
}