Refactor: fix stubs and psi having redundant constructor parameters

This commit is contained in:
Pavel V. Talanov
2013-08-07 21:27:48 +04:00
parent b2f2d43919
commit 105949de53
24 changed files with 92 additions and 95 deletions
@@ -18,7 +18,6 @@ package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode; import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.stubs.StubElement; import com.intellij.psi.stubs.StubElement;
import com.intellij.psi.tree.TokenSet; import com.intellij.psi.tree.TokenSet;
import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiTreeUtil;
@@ -26,6 +25,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.JetNodeTypes; import org.jetbrains.jet.JetNodeTypes;
import org.jetbrains.jet.lang.psi.stubs.PsiJetClassBodyStub; import org.jetbrains.jet.lang.psi.stubs.PsiJetClassBodyStub;
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
import org.jetbrains.jet.lexer.JetTokens; import org.jetbrains.jet.lexer.JetTokens;
import java.util.List; import java.util.List;
@@ -35,8 +35,8 @@ public class JetClassBody extends JetElementImplStub<PsiJetClassBodyStub> implem
super(node); super(node);
} }
public JetClassBody(@NotNull PsiJetClassBodyStub stub, @NotNull IStubElementType nodeType) { public JetClassBody(@NotNull PsiJetClassBodyStub stub) {
super(stub, nodeType); super(stub, JetStubElementTypes.CLASS_BODY);
} }
@Override @Override
@@ -19,12 +19,12 @@ package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode; import com.intellij.lang.ASTNode;
import com.intellij.navigation.ItemPresentation; import com.intellij.navigation.ItemPresentation;
import com.intellij.navigation.ItemPresentationProviders; import com.intellij.navigation.ItemPresentationProviders;
import com.intellij.psi.stubs.IStubElementType;
import com.intellij.util.ArrayFactory; import com.intellij.util.ArrayFactory;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.JetNodeTypes; import org.jetbrains.jet.JetNodeTypes;
import org.jetbrains.jet.lang.psi.stubs.PsiJetParameterStub; import org.jetbrains.jet.lang.psi.stubs.PsiJetParameterStub;
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
import org.jetbrains.jet.lexer.JetTokens; import org.jetbrains.jet.lexer.JetTokens;
public class JetParameter extends JetNamedDeclarationStub<PsiJetParameterStub> { public class JetParameter extends JetNamedDeclarationStub<PsiJetParameterStub> {
@@ -41,8 +41,8 @@ public class JetParameter extends JetNamedDeclarationStub<PsiJetParameterStub> {
super(node); super(node);
} }
public JetParameter(@NotNull PsiJetParameterStub stub, @NotNull IStubElementType nodeType) { public JetParameter(@NotNull PsiJetParameterStub stub) {
super(stub, nodeType); super(stub, JetStubElementTypes.VALUE_PARAMETER);
} }
@Override @Override
@@ -17,7 +17,6 @@
package org.jetbrains.jet.lang.psi; package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode; import com.intellij.lang.ASTNode;
import com.intellij.psi.stubs.IStubElementType;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.psi.stubs.PsiJetParameterListStub; import org.jetbrains.jet.lang.psi.stubs.PsiJetParameterListStub;
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
@@ -30,8 +29,8 @@ public class JetParameterList extends JetElementImplStub<PsiJetParameterListStub
super(node); super(node);
} }
public JetParameterList(@NotNull PsiJetParameterListStub stub, @NotNull IStubElementType nodeType) { public JetParameterList(@NotNull PsiJetParameterListStub stub) {
super(stub, nodeType); super(stub, JetStubElementTypes.VALUE_PARAMETER_LIST);
} }
@Override @Override
@@ -20,7 +20,6 @@ import com.intellij.lang.ASTNode;
import com.intellij.navigation.ItemPresentation; import com.intellij.navigation.ItemPresentation;
import com.intellij.navigation.ItemPresentationProviders; import com.intellij.navigation.ItemPresentationProviders;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet; import com.intellij.psi.tree.TokenSet;
import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiTreeUtil;
@@ -28,6 +27,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.JetNodeTypes; import org.jetbrains.jet.JetNodeTypes;
import org.jetbrains.jet.lang.psi.stubs.PsiJetPropertyStub; import org.jetbrains.jet.lang.psi.stubs.PsiJetPropertyStub;
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
import org.jetbrains.jet.lexer.JetTokens; import org.jetbrains.jet.lexer.JetTokens;
import java.util.List; import java.util.List;
@@ -42,8 +42,8 @@ public class JetProperty extends JetTypeParameterListOwnerStub<PsiJetPropertyStu
super(node); super(node);
} }
public JetProperty(@NotNull PsiJetPropertyStub stub, @NotNull IStubElementType nodeType) { public JetProperty(@NotNull PsiJetPropertyStub stub) {
super(stub, nodeType); super(stub, JetStubElementTypes.PROPERTY);
} }
@Override @Override
@@ -17,12 +17,12 @@
package org.jetbrains.jet.lang.psi; package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode; import com.intellij.lang.ASTNode;
import com.intellij.psi.stubs.IStubElementType;
import com.intellij.util.ArrayFactory; import com.intellij.util.ArrayFactory;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.JetNodeTypes; import org.jetbrains.jet.JetNodeTypes;
import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeParameterStub; import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeParameterStub;
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
import org.jetbrains.jet.lang.types.Variance; import org.jetbrains.jet.lang.types.Variance;
import org.jetbrains.jet.lexer.JetTokens; import org.jetbrains.jet.lexer.JetTokens;
@@ -40,8 +40,8 @@ public class JetTypeParameter extends JetNamedDeclarationStub<PsiJetTypeParamete
super(node); super(node);
} }
public JetTypeParameter(@NotNull PsiJetTypeParameterStub stub, @NotNull IStubElementType nodeType) { public JetTypeParameter(@NotNull PsiJetTypeParameterStub stub) {
super(stub, nodeType); super(stub, JetStubElementTypes.TYPE_PARAMETER);
} }
@Override @Override
@@ -17,7 +17,6 @@
package org.jetbrains.jet.lang.psi; package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode; import com.intellij.lang.ASTNode;
import com.intellij.psi.stubs.IStubElementType;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeParameterListStub; import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeParameterListStub;
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
@@ -30,8 +29,8 @@ public class JetTypeParameterList extends JetElementImplStub<PsiJetTypeParameter
super(node); super(node);
} }
public JetTypeParameterList(@NotNull PsiJetTypeParameterListStub stub, @NotNull IStubElementType nodeType) { public JetTypeParameterList(@NotNull PsiJetTypeParameterListStub stub) {
super(stub, nodeType); super(stub, JetStubElementTypes.TYPE_PARAMETER_LIST);
} }
@NotNull @NotNull
@@ -24,7 +24,8 @@ import com.intellij.psi.stubs.StubOutputStream;
import com.intellij.util.io.StringRef; import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.psi.JetAnnotationEntry;
import org.jetbrains.jet.lang.psi.JetPsiUtil;
import org.jetbrains.jet.lang.psi.stubs.PsiJetAnnotationStub; import org.jetbrains.jet.lang.psi.stubs.PsiJetAnnotationStub;
import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetAnnotationStubImpl; import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetAnnotationStubImpl;
import org.jetbrains.jet.lang.resolve.name.Name; import org.jetbrains.jet.lang.resolve.name.Name;
@@ -51,7 +52,7 @@ public class JetAnnotationElementType extends JetStubElementType<PsiJetAnnotatio
public PsiJetAnnotationStub createStub(@NotNull JetAnnotationEntry psi, StubElement parentStub) { public PsiJetAnnotationStub createStub(@NotNull JetAnnotationEntry psi, StubElement parentStub) {
Name shortName = JetPsiUtil.getShortName(psi); Name shortName = JetPsiUtil.getShortName(psi);
String resultName = shortName != null ? shortName.asString() : psi.getText(); String resultName = shortName != null ? shortName.asString() : psi.getText();
return new PsiJetAnnotationStubImpl(parentStub, JetStubElementTypes.ANNOTATION_ENTRY, resultName); return new PsiJetAnnotationStubImpl(parentStub, resultName);
} }
@Override @Override
@@ -63,7 +64,7 @@ public class JetAnnotationElementType extends JetStubElementType<PsiJetAnnotatio
@Override @Override
public PsiJetAnnotationStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException { public PsiJetAnnotationStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
StringRef text = dataStream.readName(); StringRef text = dataStream.readName();
return new PsiJetAnnotationStubImpl(parentStub, JetStubElementTypes.ANNOTATION_ENTRY, text); return new PsiJetAnnotationStubImpl(parentStub, text);
} }
@Override @Override
@@ -41,12 +41,12 @@ public class JetClassBodyElementType extends JetStubElementType<PsiJetClassBodyS
@Override @Override
public JetClassBody createPsi(@NotNull PsiJetClassBodyStub stub) { public JetClassBody createPsi(@NotNull PsiJetClassBodyStub stub) {
return new JetClassBody(stub, JetStubElementTypes.CLASS_BODY); return new JetClassBody(stub);
} }
@Override @Override
public PsiJetClassBodyStub createStub(@NotNull JetClassBody psi, StubElement parentStub) { public PsiJetClassBodyStub createStub(@NotNull JetClassBody psi, StubElement parentStub) {
return new PsiJetClassBodyStubImpl(parentStub, JetStubElementTypes.CLASS_BODY); return new PsiJetClassBodyStubImpl(parentStub);
} }
@Override @Override
@@ -57,7 +57,7 @@ public class JetClassBodyElementType extends JetStubElementType<PsiJetClassBodyS
@NotNull @NotNull
@Override @Override
public PsiJetClassBodyStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException { public PsiJetClassBodyStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
return new PsiJetClassBodyStubImpl(parentStub, JetStubElementTypes.CLASS_BODY); return new PsiJetClassBodyStubImpl(parentStub);
} }
@Override @Override
@@ -69,7 +69,7 @@ public class JetFunctionElementType extends JetStubElementType<PsiJetFunctionStu
FqName qualifiedName = psi.getFqName(); FqName qualifiedName = psi.getFqName();
return new PsiJetFunctionStubImpl(JetStubElementTypes.FUNCTION, parentStub, psi.getName(), isTopLevel, qualifiedName, isExtension); return new PsiJetFunctionStubImpl(parentStub, psi.getName(), isTopLevel, qualifiedName, isExtension);
} }
@Override @Override
@@ -94,7 +94,7 @@ public class JetFunctionElementType extends JetStubElementType<PsiJetFunctionStu
boolean isExtension = dataStream.readBoolean(); boolean isExtension = dataStream.readBoolean();
return new PsiJetFunctionStubImpl(JetStubElementTypes.FUNCTION, parentStub, name, isTopLevel, fqName, isExtension); return new PsiJetFunctionStubImpl(parentStub, name, isTopLevel, fqName, isExtension);
} }
@Override @Override
@@ -61,7 +61,6 @@ public class JetObjectElementType extends JetStubElementType<PsiJetObjectStub, J
FqName fqName = psi.getFqName(); FqName fqName = psi.getFqName();
List<String> superNames = PsiUtilPackage.getSuperNames(psi); List<String> superNames = PsiUtilPackage.getSuperNames(psi);
return new PsiJetObjectStubImpl( return new PsiJetObjectStubImpl(
JetStubElementTypes.OBJECT_DECLARATION,
parentStub, parentStub,
name, name,
fqName, fqName,
@@ -107,9 +106,7 @@ public class JetObjectElementType extends JetStubElementType<PsiJetObjectStub, J
superNames[i] = dataStream.readName(); superNames[i] = dataStream.readName();
} }
return new PsiJetObjectStubImpl( return new PsiJetObjectStubImpl(parentStub, name, fqName, superNames, isTopLevel, isClassObject, isLocal);
JetStubElementTypes.OBJECT_DECLARATION, parentStub, name, fqName, superNames, isTopLevel, isClassObject, isLocal
);
} }
@Override @Override
@@ -46,7 +46,7 @@ public class JetParameterElementType extends JetStubElementType<PsiJetParameterS
@Override @Override
public JetParameter createPsi(@NotNull PsiJetParameterStub stub) { public JetParameter createPsi(@NotNull PsiJetParameterStub stub) {
return new JetParameter(stub, JetStubElementTypes.VALUE_PARAMETER); return new JetParameter(stub);
} }
@Override @Override
@@ -54,7 +54,7 @@ public class JetParameterElementType extends JetStubElementType<PsiJetParameterS
JetTypeReference typeReference = psi.getTypeReference(); JetTypeReference typeReference = psi.getTypeReference();
JetExpression defaultValue = psi.getDefaultValue(); JetExpression defaultValue = psi.getDefaultValue();
return new PsiJetParameterStubImpl(JetStubElementTypes.VALUE_PARAMETER, parentStub, psi.getFqName(), return new PsiJetParameterStubImpl(parentStub, psi.getFqName(),
psi.getName(), psi.isMutable(), psi.isVarArg(), psi.getName(), psi.isMutable(), psi.isVarArg(),
typeReference != null ? typeReference.getText() : null, typeReference != null ? typeReference.getText() : null,
defaultValue != null ? defaultValue.getText() : null); defaultValue != null ? defaultValue.getText() : null);
@@ -91,7 +91,7 @@ public class JetParameterElementType extends JetStubElementType<PsiJetParameterS
StringRef fqNameAsString = dataStream.readName(); StringRef fqNameAsString = dataStream.readName();
FqName fqName = fqNameAsString != null ? new FqName(fqNameAsString.toString()) : null; FqName fqName = fqNameAsString != null ? new FqName(fqNameAsString.toString()) : null;
return new PsiJetParameterStubImpl(JetStubElementTypes.VALUE_PARAMETER, parentStub, fqName, name, isMutable, isVarArg, return new PsiJetParameterStubImpl(parentStub, fqName, name, isMutable, isVarArg,
typeText, defaultValueText); typeText, defaultValueText);
} }
@@ -41,12 +41,12 @@ public class JetParameterListElementType extends JetStubElementType<PsiJetParame
@Override @Override
public JetParameterList createPsi(@NotNull PsiJetParameterListStub stub) { public JetParameterList createPsi(@NotNull PsiJetParameterListStub stub) {
return new JetParameterList(stub, JetStubElementTypes.VALUE_PARAMETER_LIST); return new JetParameterList(stub);
} }
@Override @Override
public PsiJetParameterListStub createStub(@NotNull JetParameterList psi, StubElement parentStub) { public PsiJetParameterListStub createStub(@NotNull JetParameterList psi, StubElement parentStub) {
return new PsiJetParameterListStubImpl(JetStubElementTypes.VALUE_PARAMETER_LIST, parentStub); return new PsiJetParameterListStubImpl(parentStub);
} }
@Override @Override
@@ -57,7 +57,7 @@ public class JetParameterListElementType extends JetStubElementType<PsiJetParame
@NotNull @NotNull
@Override @Override
public PsiJetParameterListStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException { public PsiJetParameterListStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
return new PsiJetParameterListStubImpl(JetStubElementTypes.VALUE_PARAMETER_LIST, parentStub); return new PsiJetParameterListStubImpl(parentStub);
} }
@Override @Override
@@ -46,7 +46,7 @@ public class JetPropertyElementType extends JetStubElementType<PsiJetPropertyStu
@Override @Override
public JetProperty createPsi(@NotNull PsiJetPropertyStub stub) { public JetProperty createPsi(@NotNull PsiJetPropertyStub stub) {
return new JetProperty(stub, JetStubElementTypes.PROPERTY); return new JetProperty(stub);
} }
@Override @Override
@@ -71,7 +71,7 @@ public class JetPropertyElementType extends JetStubElementType<PsiJetPropertyStu
String.format("Should not store local property: %s, parent %s", String.format("Should not store local property: %s, parent %s",
psi.getText(), psi.getParent() != null ? psi.getParent().getText() : "<no parent>"); psi.getText(), psi.getParent() != null ? psi.getParent().getText() : "<no parent>");
return new PsiJetPropertyStubImpl(JetStubElementTypes.PROPERTY, parentStub, return new PsiJetPropertyStubImpl(parentStub,
psi.getName(), psi.isVar(), psi.isTopLevel(), psi.getFqName(), psi.getName(), psi.isVar(), psi.isTopLevel(), psi.getFqName(),
typeRef != null ? typeRef.getText() : null, typeRef != null ? typeRef.getText() : null,
expression != null ? expression.getText() : null); expression != null ? expression.getText() : null);
@@ -103,7 +103,7 @@ public class JetPropertyElementType extends JetStubElementType<PsiJetPropertyStu
StringRef typeText = dataStream.readName(); StringRef typeText = dataStream.readName();
StringRef inferenceBodyText = dataStream.readName(); StringRef inferenceBodyText = dataStream.readName();
return new PsiJetPropertyStubImpl(JetStubElementTypes.PROPERTY, parentStub, return new PsiJetPropertyStubImpl(parentStub,
name, isVar, isTopLevel, fqName, typeText, inferenceBodyText); name, isVar, isTopLevel, fqName, typeText, inferenceBodyText);
} }
@@ -44,13 +44,13 @@ public class JetTypeParameterElementType extends JetStubElementType<PsiJetTypePa
@Override @Override
public JetTypeParameter createPsi(@NotNull PsiJetTypeParameterStub stub) { public JetTypeParameter createPsi(@NotNull PsiJetTypeParameterStub stub) {
return new JetTypeParameter(stub, JetStubElementTypes.TYPE_PARAMETER); return new JetTypeParameter(stub);
} }
@Override @Override
public PsiJetTypeParameterStub createStub(@NotNull JetTypeParameter psi, StubElement parentStub) { public PsiJetTypeParameterStub createStub(@NotNull JetTypeParameter psi, StubElement parentStub) {
JetTypeReference extendsBound = psi.getExtendsBound(); JetTypeReference extendsBound = psi.getExtendsBound();
return new PsiJetTypeParameterStubImpl(JetStubElementTypes.TYPE_PARAMETER, parentStub, return new PsiJetTypeParameterStubImpl(parentStub,
psi.getName(), psi.getName(),
extendsBound != null ? extendsBound.getText() : null, extendsBound != null ? extendsBound.getText() : null,
psi.getVariance() == Variance.IN_VARIANCE, psi.getVariance() == Variance.IN_VARIANCE,
@@ -73,7 +73,7 @@ public class JetTypeParameterElementType extends JetStubElementType<PsiJetTypePa
boolean isInVariance = dataStream.readBoolean(); boolean isInVariance = dataStream.readBoolean();
boolean isOutVariance = dataStream.readBoolean(); boolean isOutVariance = dataStream.readBoolean();
return new PsiJetTypeParameterStubImpl(JetStubElementTypes.TYPE_PARAMETER, parentStub, return new PsiJetTypeParameterStubImpl(parentStub,
name, extendBoundTypeText, isInVariance, isOutVariance); name, extendBoundTypeText, isInVariance, isOutVariance);
} }
@@ -41,12 +41,12 @@ public class JetTypeParameterListElementType extends JetStubElementType<PsiJetTy
@Override @Override
public JetTypeParameterList createPsi(@NotNull PsiJetTypeParameterListStub stub) { public JetTypeParameterList createPsi(@NotNull PsiJetTypeParameterListStub stub) {
return new JetTypeParameterList(stub, JetStubElementTypes.TYPE_PARAMETER_LIST); return new JetTypeParameterList(stub);
} }
@Override @Override
public PsiJetTypeParameterListStub createStub(@NotNull JetTypeParameterList psi, StubElement parentStub) { public PsiJetTypeParameterListStub createStub(@NotNull JetTypeParameterList psi, StubElement parentStub) {
return new PsiJetTypeParameterListStubImpl(JetStubElementTypes.TYPE_PARAMETER_LIST, parentStub); return new PsiJetTypeParameterListStubImpl(parentStub);
} }
@Override @Override
@@ -56,8 +56,8 @@ public class JetTypeParameterListElementType extends JetStubElementType<PsiJetTy
@NotNull @NotNull
@Override @Override
public PsiJetTypeParameterListStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException { public PsiJetTypeParameterListStub deserialize(StubInputStream dataStream, StubElement parentStub) throws IOException {
return new PsiJetTypeParameterListStubImpl(JetStubElementTypes.TYPE_PARAMETER_LIST, parentStub); return new PsiJetTypeParameterListStubImpl(parentStub);
} }
@Override @Override
@@ -16,23 +16,23 @@
package org.jetbrains.jet.lang.psi.stubs.impl; 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.StubBase;
import com.intellij.psi.stubs.StubElement; import com.intellij.psi.stubs.StubElement;
import com.intellij.util.io.StringRef; import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.psi.JetAnnotationEntry; import org.jetbrains.jet.lang.psi.JetAnnotationEntry;
import org.jetbrains.jet.lang.psi.stubs.PsiJetAnnotationStub; import org.jetbrains.jet.lang.psi.stubs.PsiJetAnnotationStub;
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
public class PsiJetAnnotationStubImpl extends StubBase<JetAnnotationEntry> implements PsiJetAnnotationStub { public class PsiJetAnnotationStubImpl extends StubBase<JetAnnotationEntry> implements PsiJetAnnotationStub {
private final StringRef shortName; private final StringRef shortName;
public PsiJetAnnotationStubImpl(StubElement parent, IStubElementType elementType, @NotNull String shortName) { public PsiJetAnnotationStubImpl(StubElement parent, @NotNull String shortName) {
this(parent, elementType, StringRef.fromString(shortName)); this(parent, StringRef.fromString(shortName));
} }
public PsiJetAnnotationStubImpl(StubElement parent, IStubElementType elementType, StringRef shortName) { public PsiJetAnnotationStubImpl(StubElement parent, StringRef shortName) {
super(parent, elementType); super(parent, JetStubElementTypes.ANNOTATION_ENTRY);
this.shortName = shortName; this.shortName = shortName;
} }
@@ -16,14 +16,14 @@
package org.jetbrains.jet.lang.psi.stubs.impl; 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.StubBase;
import com.intellij.psi.stubs.StubElement; import com.intellij.psi.stubs.StubElement;
import org.jetbrains.jet.lang.psi.JetClassBody; import org.jetbrains.jet.lang.psi.JetClassBody;
import org.jetbrains.jet.lang.psi.stubs.PsiJetClassBodyStub; 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 class PsiJetClassBodyStubImpl extends StubBase<JetClassBody> implements PsiJetClassBodyStub {
public PsiJetClassBodyStubImpl(StubElement parent, IStubElementType elementType) { public PsiJetClassBodyStubImpl(StubElement parent) {
super(parent, elementType); super(parent, JetStubElementTypes.CLASS_BODY);
} }
} }
@@ -16,7 +16,6 @@
package org.jetbrains.jet.lang.psi.stubs.impl; 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.StubBase;
import com.intellij.psi.stubs.StubElement; import com.intellij.psi.stubs.StubElement;
import com.intellij.util.ArrayUtil; import com.intellij.util.ArrayUtil;
@@ -25,6 +24,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetNamedFunction; import org.jetbrains.jet.lang.psi.JetNamedFunction;
import org.jetbrains.jet.lang.psi.stubs.PsiJetFunctionStub; import org.jetbrains.jet.lang.psi.stubs.PsiJetFunctionStub;
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.FqName;
public class PsiJetFunctionStubImpl extends StubBase<JetNamedFunction> implements PsiJetFunctionStub { public class PsiJetFunctionStubImpl extends StubBase<JetNamedFunction> implements PsiJetFunctionStub {
@@ -35,23 +35,23 @@ public class PsiJetFunctionStubImpl extends StubBase<JetNamedFunction> implement
private final FqName fqName; private final FqName fqName;
public PsiJetFunctionStubImpl( public PsiJetFunctionStubImpl(
@NotNull IStubElementType elementType,
@NotNull StubElement parent, @NotNull StubElement parent,
@Nullable String name, @Nullable String name,
boolean isTopLevel, boolean isTopLevel,
@Nullable FqName fqName, @Nullable FqName fqName,
boolean isExtension) { boolean isExtension
this(elementType, parent, StringRef.fromString(name), isTopLevel, fqName, isExtension); ) {
this(parent, StringRef.fromString(name), isTopLevel, fqName, isExtension);
} }
public PsiJetFunctionStubImpl( public PsiJetFunctionStubImpl(
@NotNull IStubElementType elementType,
@NotNull StubElement parent, @NotNull StubElement parent,
@Nullable StringRef nameRef, @Nullable StringRef nameRef,
boolean isTopLevel, boolean isTopLevel,
@Nullable FqName fqName, @Nullable FqName fqName,
boolean isExtension) { boolean isExtension
super(parent, elementType); ) {
super(parent, JetStubElementTypes.FUNCTION);
if (isTopLevel && fqName == null) { if (isTopLevel && fqName == null) {
throw new IllegalArgumentException("fqName shouldn't be null for top level functions"); throw new IllegalArgumentException("fqName shouldn't be null for top level functions");
@@ -17,7 +17,6 @@
package org.jetbrains.jet.lang.psi.stubs.impl; package org.jetbrains.jet.lang.psi.stubs.impl;
import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.stubs.StubBase; import com.intellij.psi.stubs.StubBase;
import com.intellij.psi.stubs.StubElement; import com.intellij.psi.stubs.StubElement;
import com.intellij.util.ArrayUtil; import com.intellij.util.ArrayUtil;
@@ -26,6 +25,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetObjectDeclaration; import org.jetbrains.jet.lang.psi.JetObjectDeclaration;
import org.jetbrains.jet.lang.psi.stubs.PsiJetObjectStub; import org.jetbrains.jet.lang.psi.stubs.PsiJetObjectStub;
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.FqName;
import java.util.ArrayList; import java.util.ArrayList;
@@ -40,8 +40,7 @@ public class PsiJetObjectStubImpl extends StubBase<JetObjectDeclaration> impleme
private final boolean isLocal; private final boolean isLocal;
public PsiJetObjectStubImpl( public PsiJetObjectStubImpl(
@NotNull IStubElementType elementType, @NotNull StubElement parent,
StubElement parent,
@Nullable String name, @Nullable String name,
@Nullable FqName fqName, @Nullable FqName fqName,
@NotNull List<String> superNames, @NotNull List<String> superNames,
@@ -49,20 +48,19 @@ public class PsiJetObjectStubImpl extends StubBase<JetObjectDeclaration> impleme
boolean isClassObject, boolean isClassObject,
boolean isLocal boolean isLocal
) { ) {
this(elementType, parent, StringRef.fromString(name), fqName, Utils.instance$.wrapStrings(superNames), isTopLevel, isClassObject, isLocal); this(parent, StringRef.fromString(name), fqName, Utils.instance$.wrapStrings(superNames), isTopLevel, isClassObject, isLocal);
} }
public PsiJetObjectStubImpl( public PsiJetObjectStubImpl(
@NotNull IStubElementType elementType, @NotNull StubElement parent,
StubElement parent,
@Nullable StringRef name, @Nullable StringRef name,
@Nullable FqName fqName, @Nullable FqName fqName,
@NotNull StringRef[] superNames, @NotNull StringRef[] superNames,
boolean isTopLevel, boolean isTopLevel,
boolean isClassObject, boolean isClassObject,
boolean isLocal) { boolean isLocal
super(parent, elementType); ) {
super(parent, JetStubElementTypes.OBJECT_DECLARATION);
this.name = name; this.name = name;
this.fqName = fqName; this.fqName = fqName;
this.superNames = superNames; this.superNames = superNames;
@@ -16,15 +16,15 @@
package org.jetbrains.jet.lang.psi.stubs.impl; 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.StubBase;
import com.intellij.psi.stubs.StubElement; import com.intellij.psi.stubs.StubElement;
import org.jetbrains.jet.lang.psi.JetParameterList; import org.jetbrains.jet.lang.psi.JetParameterList;
import org.jetbrains.jet.lang.psi.stubs.PsiJetParameterListStub; 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 class PsiJetParameterListStubImpl extends StubBase<JetParameterList> implements PsiJetParameterListStub {
public PsiJetParameterListStubImpl(IStubElementType elementType, StubElement parent) { public PsiJetParameterListStubImpl(StubElement parent) {
super(parent, elementType); super(parent, JetStubElementTypes.VALUE_PARAMETER_LIST);
} }
@Override @Override
@@ -16,13 +16,13 @@
package org.jetbrains.jet.lang.psi.stubs.impl; 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.StubBase;
import com.intellij.psi.stubs.StubElement; import com.intellij.psi.stubs.StubElement;
import com.intellij.util.io.StringRef; import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetParameter; import org.jetbrains.jet.lang.psi.JetParameter;
import org.jetbrains.jet.lang.psi.stubs.PsiJetParameterStub; import org.jetbrains.jet.lang.psi.stubs.PsiJetParameterStub;
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.FqName;
public class PsiJetParameterStubImpl extends StubBase<JetParameter> implements PsiJetParameterStub { public class PsiJetParameterStubImpl extends StubBase<JetParameter> implements PsiJetParameterStub {
@@ -34,13 +34,13 @@ public class PsiJetParameterStubImpl extends StubBase<JetParameter> implements P
private final FqName fqName; private final FqName fqName;
public PsiJetParameterStubImpl( public PsiJetParameterStubImpl(
IStubElementType elementType, StubElement parent, StubElement parent,
FqName fqName, StringRef name, FqName fqName, StringRef name,
boolean isMutable, boolean isMutable,
boolean isVarArg, boolean isVarArg,
StringRef typeText, StringRef defaultValueText StringRef typeText, StringRef defaultValueText
) { ) {
super(parent, elementType); super(parent, JetStubElementTypes.VALUE_PARAMETER);
this.name = name; this.name = name;
this.isMutable = isMutable; this.isMutable = isMutable;
this.isVarArg = isVarArg; this.isVarArg = isVarArg;
@@ -50,14 +50,14 @@ public class PsiJetParameterStubImpl extends StubBase<JetParameter> implements P
} }
public PsiJetParameterStubImpl( public PsiJetParameterStubImpl(
IStubElementType elementType, StubElement parent, StubElement parent,
FqName fqName, String name, FqName fqName, String name,
boolean isMutable, boolean isMutable,
boolean isVarArg, boolean isVarArg,
String typeText, String typeText,
String defaultValueText String defaultValueText
) { ) {
this(elementType, parent, fqName, StringRef.fromString(name), isMutable, isVarArg, this(parent, fqName, StringRef.fromString(name), isMutable, isVarArg,
StringRef.fromString(typeText), StringRef.fromString(defaultValueText)); StringRef.fromString(typeText), StringRef.fromString(defaultValueText));
} }
@@ -16,13 +16,13 @@
package org.jetbrains.jet.lang.psi.stubs.impl; 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.StubBase;
import com.intellij.psi.stubs.StubElement; import com.intellij.psi.stubs.StubElement;
import com.intellij.util.io.StringRef; import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetProperty; import org.jetbrains.jet.lang.psi.JetProperty;
import org.jetbrains.jet.lang.psi.stubs.PsiJetPropertyStub; import org.jetbrains.jet.lang.psi.stubs.PsiJetPropertyStub;
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.FqName;
public class PsiJetPropertyStubImpl extends StubBase<JetProperty> implements PsiJetPropertyStub { public class PsiJetPropertyStubImpl extends StubBase<JetProperty> implements PsiJetPropertyStub {
@@ -33,9 +33,11 @@ public class PsiJetPropertyStubImpl extends StubBase<JetProperty> implements Psi
private final StringRef typeText; private final StringRef typeText;
private final StringRef inferenceBodyText; private final StringRef inferenceBodyText;
public PsiJetPropertyStubImpl(IStubElementType elementType, StubElement parent, StringRef name, public PsiJetPropertyStubImpl(
boolean isVar, boolean isTopLevel, @Nullable FqName fqName, StringRef typeText, StringRef inferenceBodyText) { StubElement parent, StringRef name,
super(parent, elementType); boolean isVar, boolean isTopLevel, @Nullable FqName fqName, StringRef typeText, StringRef inferenceBodyText
) {
super(parent, JetStubElementTypes.PROPERTY);
if (isTopLevel && fqName == null) { if (isTopLevel && fqName == null) {
throw new IllegalArgumentException("fqName shouldn't be null for top level properties"); throw new IllegalArgumentException("fqName shouldn't be null for top level properties");
@@ -49,11 +51,11 @@ public class PsiJetPropertyStubImpl extends StubBase<JetProperty> implements Psi
this.inferenceBodyText = inferenceBodyText; this.inferenceBodyText = inferenceBodyText;
} }
public PsiJetPropertyStubImpl(IStubElementType elementType, StubElement parent, String name, public PsiJetPropertyStubImpl(StubElement parent, String name,
boolean isVar, boolean isTopLevel, @Nullable FqName topFQName, boolean isVar, boolean isTopLevel, @Nullable FqName topFQName,
String typeText, String inferenceBodyText String typeText, String inferenceBodyText
) { ) {
this(elementType, parent, StringRef.fromString(name), this(parent, StringRef.fromString(name),
isVar, isTopLevel, topFQName, StringRef.fromString(typeText), StringRef.fromString(inferenceBodyText)); isVar, isTopLevel, topFQName, StringRef.fromString(typeText), StringRef.fromString(inferenceBodyText));
} }
@@ -16,16 +16,15 @@
package org.jetbrains.jet.lang.psi.stubs.impl; 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.StubBase;
import com.intellij.psi.stubs.StubElement; import com.intellij.psi.stubs.StubElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.psi.JetTypeParameterList; import org.jetbrains.jet.lang.psi.JetTypeParameterList;
import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeParameterListStub; 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 class PsiJetTypeParameterListStubImpl extends StubBase<JetTypeParameterList> implements PsiJetTypeParameterListStub {
public PsiJetTypeParameterListStubImpl(@NotNull IStubElementType elementType, StubElement parent) { public PsiJetTypeParameterListStubImpl(StubElement parent) {
super(parent, elementType); super(parent, JetStubElementTypes.TYPE_PARAMETER_LIST);
} }
@Override @Override
@@ -22,7 +22,7 @@ import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetTypeParameter; import org.jetbrains.jet.lang.psi.JetTypeParameter;
import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeParameterStub; import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeParameterStub;
import org.jetbrains.jet.lang.psi.stubs.elements.JetTypeParameterElementType; import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.FqName;
public class PsiJetTypeParameterStubImpl extends StubBase<JetTypeParameter> implements PsiJetTypeParameterStub { public class PsiJetTypeParameterStubImpl extends StubBase<JetTypeParameter> implements PsiJetTypeParameterStub {
@@ -31,9 +31,10 @@ public class PsiJetTypeParameterStubImpl extends StubBase<JetTypeParameter> impl
private final boolean isInVariance; private final boolean isInVariance;
private final boolean isOutVariance; private final boolean isOutVariance;
public PsiJetTypeParameterStubImpl(JetTypeParameterElementType type, StubElement parent, public PsiJetTypeParameterStubImpl(
StringRef name, StringRef extendBoundTypeText, boolean isInVariance, boolean isOutVariance) { StubElement parent, StringRef name, StringRef extendBoundTypeText, boolean isInVariance, boolean isOutVariance
super(parent, type); ) {
super(parent, JetStubElementTypes.TYPE_PARAMETER);
this.name = name; this.name = name;
this.extendBoundTypeText = extendBoundTypeText; this.extendBoundTypeText = extendBoundTypeText;
@@ -41,9 +42,10 @@ public class PsiJetTypeParameterStubImpl extends StubBase<JetTypeParameter> impl
this.isOutVariance = isOutVariance; this.isOutVariance = isOutVariance;
} }
public PsiJetTypeParameterStubImpl(JetTypeParameterElementType type, StubElement parent, public PsiJetTypeParameterStubImpl(
String name, String extendBoundTypeText, boolean isInVariance, boolean isOutVariance) { StubElement parent, String name, String extendBoundTypeText, boolean isInVariance, boolean isOutVariance
this(type, parent, StringRef.fromString(name), StringRef.fromString(extendBoundTypeText), isInVariance, isOutVariance); ) {
this(parent, StringRef.fromString(name), StringRef.fromString(extendBoundTypeText), isInVariance, isOutVariance);
} }
@Override @Override