Java 类com.intellij.psi.impl.java.stubs.impl.PsiTypeParameterStubImpl 实例源码

项目:intellij-ce-playground    文件:SignatureParsing.java   
private static PsiTypeParameterStub parseTypeParameter(CharacterIterator iterator, PsiTypeParameterListStub parent) throws ClsFormatException {
  StringBuilder name = new StringBuilder();
  while (iterator.current() != ':' && iterator.current() != CharacterIterator.DONE) {
    name.append(iterator.current());
    iterator.next();
  }
  if (iterator.current() == CharacterIterator.DONE) {
    throw new ClsFormatException();
  }

  //todo parse annotations on type param
  PsiTypeParameterStub parameterStub = new PsiTypeParameterStubImpl(parent, StringRef.fromString(name.toString()));

  // postpone list allocation till a second bound is seen; ignore sole Object bound
  List<String> bounds = null;
  boolean jlo = false;
  while (iterator.current() == ':') {
    iterator.next();
    String bound = parseTopLevelClassRefSignature(iterator);
    if (bound == null) continue;
    if (bounds == null) {
      if (CommonClassNames.JAVA_LANG_OBJECT.equals(bound)) {
        jlo = true;
        continue;
      }
      bounds = ContainerUtil.newSmartList();
      if (jlo) {
        bounds.add(CommonClassNames.JAVA_LANG_OBJECT);
      }
    }
    bounds.add(bound);
  }

  StubBuildingVisitor.newReferenceList(JavaStubElementTypes.EXTENDS_BOUND_LIST, parameterStub, ArrayUtil.toStringArray(bounds));

  return parameterStub;
}
项目:tools-idea    文件:SignatureParsing.java   
private static PsiTypeParameterStub parseTypeParameter(CharacterIterator signatureIterator, PsiTypeParameterListStub parent)
    throws ClsFormatException {
  StringBuilder name = new StringBuilder();
  while (signatureIterator.current() != ':' && signatureIterator.current() != CharacterIterator.DONE) {
    name.append(signatureIterator.current());
    signatureIterator.next();
  }
  if (signatureIterator.current() == CharacterIterator.DONE) {
    throw new ClsFormatException();
  }

  //todo parse annotations on type param
  PsiTypeParameterStub parameterStub = new PsiTypeParameterStubImpl(parent, StringRef.fromString(name.toString()));

  ArrayList<String> bounds = null;
  while (signatureIterator.current() == ':') {
    signatureIterator.next();
    String bound = parseTopLevelClassRefSignature(signatureIterator);
    if (bound != null && !bound.equals(CommonClassNames.JAVA_LANG_OBJECT)) {
      if (bounds == null) bounds = new ArrayList<String>();
      bounds.add(bound);
    }
  }

  StubBuildingVisitor.newReferenceList(JavaStubElementTypes.EXTENDS_BOUND_LIST, parameterStub, ArrayUtil.toStringArray(bounds));

  return parameterStub;
}
项目: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    文件:JavaTypeParameterElementType.java   
@NotNull
@Override
public PsiTypeParameterStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
  StringRef name = dataStream.readName();
  return new PsiTypeParameterStubImpl(parentStub, name);
}
项目: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    文件:JavaTypeParameterElementType.java   
@NotNull
@Override
public PsiTypeParameterStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
  StringRef name = dataStream.readName();
  return new PsiTypeParameterStubImpl(parentStub, name);
}
项目: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    文件:JavaTypeParameterElementType.java   
@NotNull
@Override
public PsiTypeParameterStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
  StringRef name = dataStream.readName();
  return new PsiTypeParameterStubImpl(parentStub, name);
}