Java 类com.intellij.psi.impl.cache.RecordUtil 实例源码

项目:intellij-ce-playground    文件:JavaNameValuePairType.java   
@Override
public PsiNameValuePairStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) {
  String name = null;
  String value = null;
  List<LighterASTNode> children = tree.getChildren(node);
  for (LighterASTNode child : children) {
    if (child.getTokenType() == JavaTokenType.IDENTIFIER) {
      name = RecordUtil.intern(tree.getCharTable(), child);
    }
    else if (child.getTokenType() == JavaElementType.LITERAL_EXPRESSION) {
      value = RecordUtil.intern(tree.getCharTable(), tree.getChildren(child).get(0));
      value = StringUtil.unquoteString(value);
    }
  }
  return new PsiNameValuePairStubImpl(parentStub, StringRef.fromString(name), StringRef.fromString(value));
}
项目:tools-idea    文件:JavaNameValuePairType.java   
@Override
public PsiNameValuePairStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) {
  String name = null;
  String value = null;
  List<LighterASTNode> children = tree.getChildren(node);
  for (LighterASTNode child : children) {
    if (child.getTokenType() == JavaTokenType.IDENTIFIER) {
      name = RecordUtil.intern(tree.getCharTable(), child);
    }
    else if (child.getTokenType() == JavaElementType.LITERAL_EXPRESSION) {
      value = RecordUtil.intern(tree.getCharTable(), tree.getChildren(child).get(0));
      value = StringUtil.stripQuotesAroundValue(value);
    }
  }
  return new PsiNameValuePairStubImpl(parentStub, StringRef.fromString(name), StringRef.fromString(value));
}
项目:consulo-java    文件:JavaNameValuePairType.java   
@Override
public PsiNameValuePairStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) {
  String name = null;
  String value = null;
  List<LighterASTNode> children = tree.getChildren(node);
  for (LighterASTNode child : children) {
    if (child.getTokenType() == JavaTokenType.IDENTIFIER) {
      name = RecordUtil.intern(tree.getCharTable(), child);
    }
    else if (child.getTokenType() == JavaElementType.LITERAL_EXPRESSION) {
      value = RecordUtil.intern(tree.getCharTable(), tree.getChildren(child).get(0));
      value = StringUtil.stripQuotesAroundValue(value);
    }
  }
  return new PsiNameValuePairStubImpl(parentStub, StringRef.fromString(name), StringRef.fromString(value));
}
项目:consulo-java    文件:LambdaExpressionElementType.java   
private static void formatParameter(@NotNull LighterAST tree, @NotNull LighterASTNode parameter, StringBuilder buf)
{
    final List<LighterASTNode> children = tree.getChildren(parameter);
    for(LighterASTNode node : children)
    {
        final IElementType tokenType = node.getTokenType();
        if(tokenType == JavaElementType.TYPE)
        {
            formatType(tree, node, buf);
            buf.append(' ');
        }
        else if(tokenType == JavaTokenType.IDENTIFIER)
        {
            buf.append(RecordUtil.intern(tree.getCharTable(), node));
        }
    }
}
项目:intellij-ce-playground    文件:JavaFieldStubElementType.java   
@Override
public PsiFieldStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
  final TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);

  boolean isDeprecatedByComment = false;
  boolean hasDeprecatedAnnotation = false;
  boolean hasDocComment = false;
  String name = null;
  String initializer = null;

  boolean expectingInit = false;
  for (final LighterASTNode child : tree.getChildren(node)) {
    final IElementType type = child.getTokenType();
    if (type == JavaDocElementType.DOC_COMMENT) {
      hasDocComment = true;
      isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
    }
    else if (type == JavaElementType.MODIFIER_LIST) {
      hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
    }
    else if (type == JavaTokenType.IDENTIFIER) {
      name = RecordUtil.intern(tree.getCharTable(), child);
    }
    else if (type == JavaTokenType.EQ) {
      expectingInit = true;
    }
    else if (expectingInit && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) && type != JavaTokenType.SEMICOLON) {
      initializer = encodeInitializer(tree, child);
      break;
    }
  }

  final boolean isEnumConst = node.getTokenType() == JavaElementType.ENUM_CONSTANT;
  final byte flags = PsiFieldStubImpl.packFlags(isEnumConst, isDeprecatedByComment, hasDeprecatedAnnotation, hasDocComment);

  return new PsiFieldStubImpl(parentStub, name, typeInfo, initializer, flags);
}
项目:intellij-ce-playground    文件:JavaFieldStubElementType.java   
@Override
public void indexStub(@NotNull final PsiFieldStub stub, @NotNull final IndexSink sink) {
  final String name = stub.getName();
  if (name != null) {
    sink.occurrence(JavaStubIndexKeys.FIELDS, name);
    if (RecordUtil.isStaticNonPrivateMember(stub)) {
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getType(false).getShortTypeText());
    }
  }
}
项目:intellij-ce-playground    文件:JavaParameterElementType.java   
@Override
public PsiParameterStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) {
  TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);
  LighterASTNode id = LightTreeUtil.requiredChildOfType(tree, node, JavaTokenType.IDENTIFIER);
  String name = RecordUtil.intern(tree.getCharTable(), id);
  return new PsiParameterStubImpl(parentStub, name, typeInfo, typeInfo.isEllipsis);
}
项目:tools-idea    文件:JavaMethodElementType.java   
@Override
public void indexStub(@NotNull final PsiMethodStub stub, @NotNull final IndexSink sink) {
  final String name = stub.getName();
  if (name != null) {
    sink.occurrence(JavaStubIndexKeys.METHODS, name);
    if (RecordUtil.isStaticNonPrivateMember(stub)) {
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getReturnTypeText(false).getShortTypeText());
    }
  }
}
项目:tools-idea    文件:JavaFieldStubElementType.java   
@Override
public PsiFieldStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
  final TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);

  boolean isDeprecatedByComment = false;
  boolean hasDeprecatedAnnotation = false;
  String name = null;
  String initializer = null;

  boolean expectingInit = false;
  for (final LighterASTNode child : tree.getChildren(node)) {
    final IElementType type = child.getTokenType();
    if (type == JavaDocElementType.DOC_COMMENT) {
      isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
    }
    else if (type == JavaElementType.MODIFIER_LIST) {
      hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
    }
    else if (type == JavaTokenType.IDENTIFIER) {
      name = RecordUtil.intern(tree.getCharTable(), child);
    }
    else if (type == JavaTokenType.EQ) {
      expectingInit = true;
    }
    else if (expectingInit && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) && type != JavaTokenType.SEMICOLON) {
      initializer = encodeInitializer(tree, child);
      break;
    }
  }

  final boolean isEnumConst = node.getTokenType() == JavaElementType.ENUM_CONSTANT;
  final byte flags = PsiFieldStubImpl.packFlags(isEnumConst, isDeprecatedByComment, hasDeprecatedAnnotation);

  return new PsiFieldStubImpl(parentStub, name, typeInfo, initializer, flags);
}
项目:tools-idea    文件:JavaFieldStubElementType.java   
@Override
public void indexStub(@NotNull final PsiFieldStub stub, @NotNull final IndexSink sink) {
  final String name = stub.getName();
  if (name != null) {
    sink.occurrence(JavaStubIndexKeys.FIELDS, name);
    if (RecordUtil.isStaticNonPrivateMember(stub)) {
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getType(false).getShortTypeText());
    }
  }
}
项目:tools-idea    文件:JavaParameterElementType.java   
@Override
public PsiParameterStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) {
  TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);
  LighterASTNode id = LightTreeUtil.requiredChildOfType(tree, node, ID_TYPES);
  String name = RecordUtil.intern(tree.getCharTable(), id);
  return new PsiParameterStubImpl(parentStub, name, typeInfo, typeInfo.isEllipsis);
}
项目:consulo-java    文件:JavaFieldStubElementType.java   
@Override
public void indexStub(@NotNull final PsiFieldStub stub, @NotNull final IndexSink sink)
{
    final String name = stub.getName();
    if(name != null)
    {
        sink.occurrence(JavaStubIndexKeys.FIELDS, name);
        if(RecordUtil.isStaticNonPrivateMember(stub))
        {
            sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
            sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getType(false).getShortTypeText());
        }
    }
}
项目:consulo-java    文件:LambdaExpressionElementType.java   
private static void formatType(LighterAST tree, LighterASTNode typeElement, StringBuilder buf)
{
    for(LighterASTNode node : tree.getChildren(typeElement))
    {
        final IElementType tokenType = node.getTokenType();
        if(tokenType == JavaElementType.JAVA_CODE_REFERENCE)
        {
            formatCodeReference(tree, node, buf);
        }
        else if(tokenType == JavaElementType.TYPE)
        {
            formatType(tree, node, buf);
        }
        else if(tokenType == JavaTokenType.QUEST)
        {
            buf.append("? ");
        }
        else if(ElementType.KEYWORD_BIT_SET.contains(tokenType))
        {
            buf.append(RecordUtil.intern(tree.getCharTable(), node));
            if(!ElementType.PRIMITIVE_TYPE_BIT_SET.contains(tokenType))
            {
                buf.append(" ");
            }
        }
        else if(tokenType == JavaTokenType.ELLIPSIS)
        {
            buf.append("...");
        }
        else if(tokenType == JavaTokenType.RBRACKET)
        {
            buf.append("]");
        }
        else if(tokenType == JavaTokenType.LBRACKET)
        {
            buf.append("[");
        }
    }
}
项目:consulo-java    文件:LambdaExpressionElementType.java   
private static void formatCodeReference(LighterAST tree, LighterASTNode codeRef, StringBuilder buf)
{
    for(LighterASTNode node : tree.getChildren(codeRef))
    {
        final IElementType tokenType = node.getTokenType();
        if(tokenType == JavaTokenType.IDENTIFIER)
        {
            buf.append(RecordUtil.intern(tree.getCharTable(), node));
        }
        else if(tokenType == JavaElementType.REFERENCE_PARAMETER_LIST)
        {
            formatTypeParameters(tree, node, buf);
        }
    }
}
项目:consulo-java    文件:JavaParameterElementType.java   
@Override
public PsiParameterStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub)
{
    TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);
    LighterASTNode id = LightTreeUtil.requiredChildOfType(tree, node, JavaTokenType.IDENTIFIER);
    String name = RecordUtil.intern(tree.getCharTable(), id);
    return new PsiParameterStubImpl(parentStub, name, typeInfo, typeInfo.isEllipsis, false);
}
项目:consulo-java    文件:JavaLightTreeUtil.java   
@Nullable
@Contract("_,null->null")
public static String getNameIdentifierText(@NotNull LighterAST tree, @Nullable LighterASTNode idOwner)
{
    LighterASTNode id = LightTreeUtil.firstChildOfType(tree, idOwner, JavaTokenType.IDENTIFIER);
    return id != null ? RecordUtil.intern(tree.getCharTable(), id) : null;
}
项目:intellij-ce-playground    文件:JavaMethodElementType.java   
@Override
public PsiMethodStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
  String name = null;
  boolean isConstructor = true;
  boolean isVarArgs = false;
  boolean isDeprecatedByComment = false;
  boolean hasDeprecatedAnnotation = false;
  boolean hasDocComment = false;
  String defValueText = null;

  boolean expectingDef = false;
  for (final LighterASTNode child : tree.getChildren(node)) {
    final IElementType type = child.getTokenType();
    if (type == JavaDocElementType.DOC_COMMENT) {
      hasDocComment = true;
      isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
    }
    else if (type == JavaElementType.MODIFIER_LIST) {
      hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
    }
    else if (type == JavaElementType.TYPE) {
      isConstructor = false;
    }
    else if (type == JavaTokenType.IDENTIFIER) {
      name = RecordUtil.intern(tree.getCharTable(), child);
    }
    else if (type == JavaElementType.PARAMETER_LIST) {
      final List<LighterASTNode> params = LightTreeUtil.getChildrenOfType(tree, child, JavaElementType.PARAMETER);
      if (!params.isEmpty()) {
        final LighterASTNode pType = LightTreeUtil.firstChildOfType(tree, params.get(params.size() - 1), JavaElementType.TYPE);
        if (pType != null) {
          isVarArgs = (LightTreeUtil.firstChildOfType(tree, pType, JavaTokenType.ELLIPSIS) != null);
        }
      }
    }
    else if (type == JavaTokenType.DEFAULT_KEYWORD) {
      expectingDef = true;
    }
    else if (expectingDef && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) &&
             type != JavaTokenType.SEMICOLON && type != JavaElementType.CODE_BLOCK) {
      defValueText = LightTreeUtil.toFilteredString(tree, child, null);
      break;
    }
  }

  TypeInfo typeInfo = isConstructor ? TypeInfo.createConstructorType() : TypeInfo.create(tree, node, parentStub);
  boolean isAnno = (node.getTokenType() == JavaElementType.ANNOTATION_METHOD);
  byte flags = PsiMethodStubImpl.packFlags(isConstructor, isAnno, isVarArgs, isDeprecatedByComment, hasDeprecatedAnnotation, hasDocComment);

  return new PsiMethodStubImpl(parentStub, name, typeInfo, flags, defValueText);
}
项目:intellij-ce-playground    文件:JavaMethodElementType.java   
@Override
public void indexStub(@NotNull final PsiMethodStub stub, @NotNull final IndexSink sink) {
  final String name = stub.getName();
  if (name != null) {
    sink.occurrence(JavaStubIndexKeys.METHODS, name);
    if (RecordUtil.isStaticNonPrivateMember(stub)) {
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getReturnTypeText(false).getShortTypeText());
    }
  }

  Set<String> methodTypeParams = null;
  for (StubElement stubElement : stub.getChildrenStubs()) {
    if (stubElement instanceof PsiTypeParameterListStub) {
      for (Object tStub : stubElement.getChildrenStubs()) {
        if (tStub instanceof PsiTypeParameterStub) {
          if (methodTypeParams == null) {
            methodTypeParams = new HashSet<String>();
          }
          methodTypeParams.add(((PsiTypeParameterStub)tStub).getName());
        }
      }
    }
    else if (stubElement instanceof PsiParameterListStub) {
      for (StubElement paramStub : ((PsiParameterListStub)stubElement).getChildrenStubs()) {
        if (paramStub instanceof PsiParameterStub) {
          TypeInfo type = ((PsiParameterStub)paramStub).getType(false);
          if (type.arrayCount > 0) continue;
          String typeName = type.getShortTypeText();
          if (TypeConversionUtil.isPrimitive(typeName) || TypeConversionUtil.isPrimitiveWrapper(typeName)) continue;
          sink.occurrence(JavaStubIndexKeys.METHOD_TYPES, typeName);
          if (methodTypeParams != null && methodTypeParams.contains(typeName)) {
            sink.occurrence(JavaStubIndexKeys.METHOD_TYPES, TYPE_PARAMETER_PSEUDO_NAME);
            methodTypeParams = null;
          }
        }
      }
      break;
    }
  }
}
项目:intellij-ce-playground    文件:JavaTypeParameterElementType.java   
@Override
public PsiTypeParameterStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
  final LighterASTNode id = LightTreeUtil.requiredChildOfType(tree, node, JavaTokenType.IDENTIFIER);
  final String name = RecordUtil.intern(tree.getCharTable(), id);
  return new PsiTypeParameterStubImpl(parentStub, StringRef.fromString(name));
}
项目:intellij-ce-playground    文件:JavaModifierListElementType.java   
@Override
public PsiModifierListStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
  return new PsiModifierListStubImpl(parentStub, RecordUtil.packModifierList(tree, node, parentStub));
}
项目:tools-idea    文件:JavaMethodElementType.java   
@Override
public PsiMethodStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
  String name = null;
  boolean isConstructor = true;
  boolean isVarArgs = false;
  boolean isDeprecatedByComment = false;
  boolean hasDeprecatedAnnotation = false;
  String defValueText = null;

  boolean expectingDef = false;
  for (final LighterASTNode child : tree.getChildren(node)) {
    final IElementType type = child.getTokenType();
    if (type == JavaDocElementType.DOC_COMMENT) {
      isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
    }
    else if (type == JavaElementType.MODIFIER_LIST) {
      hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
    }
    else if (type == JavaElementType.TYPE) {
      isConstructor = false;
    }
    else if (type == JavaTokenType.IDENTIFIER) {
      name = RecordUtil.intern(tree.getCharTable(), child);
    }
    else if (type == JavaElementType.PARAMETER_LIST) {
      final List<LighterASTNode> params = LightTreeUtil.getChildrenOfType(tree, child, JavaElementType.PARAMETER);
      if (params.size() > 0) {
        final LighterASTNode pType = LightTreeUtil.firstChildOfType(tree, params.get(params.size() - 1), JavaElementType.TYPE);
        if (pType != null) {
          isVarArgs = (LightTreeUtil.firstChildOfType(tree, pType, JavaTokenType.ELLIPSIS) != null);
        }
      }
    }
    else if (type == JavaTokenType.DEFAULT_KEYWORD) {
      expectingDef = true;
    }
    else if (expectingDef && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) &&
             type != JavaTokenType.SEMICOLON && type != JavaElementType.CODE_BLOCK) {
      defValueText = LightTreeUtil.toFilteredString(tree, child, null);
      break;
    }
  }

  TypeInfo typeInfo = isConstructor ? TypeInfo.createConstructorType() : TypeInfo.create(tree, node, parentStub);
  boolean isAnno = (node.getTokenType() == JavaElementType.ANNOTATION_METHOD);
  byte flags = PsiMethodStubImpl.packFlags(isConstructor, isAnno, isVarArgs, isDeprecatedByComment, hasDeprecatedAnnotation);

  return new PsiMethodStubImpl(parentStub, StringRef.fromString(name), typeInfo, flags, StringRef.fromString(defValueText));
}
项目:tools-idea    文件:JavaTypeParameterElementType.java   
@Override
public PsiTypeParameterStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
  final LighterASTNode id = LightTreeUtil.requiredChildOfType(tree, node, JavaTokenType.IDENTIFIER);
  final String name = RecordUtil.intern(tree.getCharTable(), id);
  return new PsiTypeParameterStubImpl(parentStub, StringRef.fromString(name));
}
项目:tools-idea    文件:JavaModifierListElementType.java   
@Override
public PsiModifierListStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
  return new PsiModifierListStubImpl(parentStub, RecordUtil.packModifierList(tree, node, parentStub));
}
项目:consulo-java    文件:JavaMethodElementType.java   
@Override
public PsiMethodStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub)
{
    String name = null;
    boolean isConstructor = true;
    boolean isVarArgs = false;
    boolean isDeprecatedByComment = false;
    boolean hasDeprecatedAnnotation = false;
    boolean hasDocComment = false;
    String defValueText = null;

    boolean expectingDef = false;
    for(final LighterASTNode child : tree.getChildren(node))
    {
        final IElementType type = child.getTokenType();
        if(type == JavaDocElementType.DOC_COMMENT)
        {
            hasDocComment = true;
            isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
        }
        else if(type == JavaElementType.MODIFIER_LIST)
        {
            hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
        }
        else if(type == JavaElementType.TYPE)
        {
            isConstructor = false;
        }
        else if(type == JavaTokenType.IDENTIFIER)
        {
            name = RecordUtil.intern(tree.getCharTable(), child);
        }
        else if(type == JavaElementType.PARAMETER_LIST)
        {
            final List<LighterASTNode> params = LightTreeUtil.getChildrenOfType(tree, child, JavaElementType.PARAMETER);
            if(!params.isEmpty())
            {
                final LighterASTNode pType = LightTreeUtil.firstChildOfType(tree, params.get(params.size() - 1), JavaElementType.TYPE);
                if(pType != null)
                {
                    isVarArgs = (LightTreeUtil.firstChildOfType(tree, pType, JavaTokenType.ELLIPSIS) != null);
                }
            }
        }
        else if(type == JavaTokenType.DEFAULT_KEYWORD)
        {
            expectingDef = true;
        }
        else if(expectingDef && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) &&
                type != JavaTokenType.SEMICOLON && type != JavaElementType.CODE_BLOCK)
        {
            defValueText = LightTreeUtil.toFilteredString(tree, child, null);
            break;
        }
    }

    TypeInfo typeInfo = isConstructor ? TypeInfo.createConstructorType() : TypeInfo.create(tree, node, parentStub);
    boolean isAnno = (node.getTokenType() == JavaElementType.ANNOTATION_METHOD);
    byte flags = PsiMethodStubImpl.packFlags(isConstructor, isAnno, isVarArgs, isDeprecatedByComment, hasDeprecatedAnnotation, hasDocComment);

    return new PsiMethodStubImpl(parentStub, name, typeInfo, flags, defValueText);
}
项目:consulo-java    文件:JavaMethodElementType.java   
@Override
public void indexStub(@NotNull final PsiMethodStub stub, @NotNull final IndexSink sink)
{
    final String name = stub.getName();
    if(name != null)
    {
        sink.occurrence(JavaStubIndexKeys.METHODS, name);
        if(RecordUtil.isStaticNonPrivateMember(stub))
        {
            sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
            sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getReturnTypeText(false).getShortTypeText());
        }
    }

    Set<String> methodTypeParams = null;
    for(StubElement stubElement : stub.getChildrenStubs())
    {
        if(stubElement instanceof PsiTypeParameterListStub)
        {
            for(Object tStub : stubElement.getChildrenStubs())
            {
                if(tStub instanceof PsiTypeParameterStub)
                {
                    if(methodTypeParams == null)
                    {
                        methodTypeParams = new HashSet<String>();
                    }
                    methodTypeParams.add(((PsiTypeParameterStub) tStub).getName());
                }
            }
        }
        else if(stubElement instanceof PsiParameterListStub)
        {
            for(StubElement paramStub : ((PsiParameterListStub) stubElement).getChildrenStubs())
            {
                if(paramStub instanceof PsiParameterStub)
                {
                    TypeInfo type = ((PsiParameterStub) paramStub).getType(false);
                    if(type.arrayCount > 0)
                    {
                        continue;
                    }
                    String typeName = type.getShortTypeText();
                    if(TypeConversionUtil.isPrimitive(typeName) || TypeConversionUtil.isPrimitiveWrapper(typeName))
                    {
                        continue;
                    }
                    sink.occurrence(JavaStubIndexKeys.METHOD_TYPES, typeName);
                    if(methodTypeParams != null && methodTypeParams.contains(typeName))
                    {
                        sink.occurrence(JavaStubIndexKeys.METHOD_TYPES, TYPE_PARAMETER_PSEUDO_NAME);
                        methodTypeParams = null;
                    }
                }
            }
            break;
        }
    }
}
项目:consulo-java    文件:JavaTypeParameterElementType.java   
@Override
public PsiTypeParameterStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
  final LighterASTNode id = LightTreeUtil.requiredChildOfType(tree, node, JavaTokenType.IDENTIFIER);
  final String name = RecordUtil.intern(tree.getCharTable(), id);
  return new PsiTypeParameterStubImpl(parentStub, StringRef.fromString(name));
}
项目:consulo-java    文件:JavaFieldStubElementType.java   
@Override
public PsiFieldStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub)
{
    final TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);

    boolean isDeprecatedByComment = false;
    boolean hasDeprecatedAnnotation = false;
    boolean hasDocComment = false;
    String name = null;
    String initializer = null;

    boolean expectingInit = false;
    for(final LighterASTNode child : tree.getChildren(node))
    {
        final IElementType type = child.getTokenType();
        if(type == JavaDocElementType.DOC_COMMENT)
        {
            hasDocComment = true;
            isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
        }
        else if(type == JavaElementType.MODIFIER_LIST)
        {
            hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
        }
        else if(type == JavaTokenType.IDENTIFIER)
        {
            name = RecordUtil.intern(tree.getCharTable(), child);
        }
        else if(type == JavaTokenType.EQ)
        {
            expectingInit = true;
        }
        else if(expectingInit && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) && type !=
                JavaTokenType.SEMICOLON)
        {
            initializer = encodeInitializer(tree, child);
            break;
        }
    }

    final boolean isEnumConst = node.getTokenType() == JavaElementType.ENUM_CONSTANT;
    final byte flags = PsiFieldStubImpl.packFlags(isEnumConst, isDeprecatedByComment, hasDeprecatedAnnotation,
            hasDocComment);

    return new PsiFieldStubImpl(parentStub, name, typeInfo, initializer, flags);
}
项目:consulo-java    文件:JavaLiteralExpressionElementType.java   
@Override
public PsiLiteralStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub)
{
    return new PsiLiteralStub(parentStub, RecordUtil.intern(tree.getCharTable(), tree.getChildren(node).get(0)));
}
项目:consulo-java    文件:JavaModifierListElementType.java   
@Override
public PsiModifierListStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub)
{
    return new PsiModifierListStubImpl(parentStub, RecordUtil.packModifierList(tree, node));
}