当前位置: 首页>>代码示例>>Java>>正文


Java PsiTypeParameterStub类代码示例

本文整理汇总了Java中com.intellij.psi.impl.java.stubs.PsiTypeParameterStub的典型用法代码示例。如果您正苦于以下问题:Java PsiTypeParameterStub类的具体用法?Java PsiTypeParameterStub怎么用?Java PsiTypeParameterStub使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PsiTypeParameterStub类属于com.intellij.psi.impl.java.stubs包,在下文中一共展示了PsiTypeParameterStub类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getIndex

import com.intellij.psi.impl.java.stubs.PsiTypeParameterStub; //导入依赖的package包/类
@Override
public int getIndex() {
  final PsiTypeParameterStub stub = getStub();
  if (stub != null) {
    final PsiTypeParameterListStub parentStub = (PsiTypeParameterListStub)stub.getParentStub();
    return parentStub.getChildrenStubs().indexOf(stub);
  }

  int ret = 0;
  PsiElement element = getPrevSibling();
  while (element != null) {
    if (element instanceof PsiTypeParameter) {
      ret++;
    }
    element = element.getPrevSibling();
  }
  return ret;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:PsiTypeParameterImpl.java

示例2: parseTypeParameter

import com.intellij.psi.impl.java.stubs.PsiTypeParameterStub; //导入依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:SignatureParsing.java

示例3: getName

import com.intellij.psi.impl.java.stubs.PsiTypeParameterStub; //导入依赖的package包/类
@Override
public String getName() {
  final PsiTypeParameterStub stub = getStub();
  if (stub != null) {
    return stub.getName();
  }

  return getNameIdentifier().getText();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiTypeParameterImpl.java

示例4: parseTypeParameter

import com.intellij.psi.impl.java.stubs.PsiTypeParameterStub; //导入依赖的package包/类
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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:SignatureParsing.java

示例5: ClsTypeParameterImpl

import com.intellij.psi.impl.java.stubs.PsiTypeParameterStub; //导入依赖的package包/类
public ClsTypeParameterImpl(@NotNull PsiTypeParameterStub stub) {
  super(stub);
  myLightEmptyImplementsList = new LightEmptyImplementsList(getManager());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ClsTypeParameterImpl.java

示例6: getIndex

import com.intellij.psi.impl.java.stubs.PsiTypeParameterStub; //导入依赖的package包/类
@Override
public int getIndex() {
  final PsiTypeParameterStub stub = getStub();
  return stub.getParentStub().getChildrenStubs().indexOf(stub);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ClsTypeParameterImpl.java

示例7: PsiTypeParameterImpl

import com.intellij.psi.impl.java.stubs.PsiTypeParameterStub; //导入依赖的package包/类
public PsiTypeParameterImpl(final PsiTypeParameterStub stub) {
  super(stub, JavaStubElementTypes.TYPE_PARAMETER);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:PsiTypeParameterImpl.java

示例8: visit

import com.intellij.psi.impl.java.stubs.PsiTypeParameterStub; //导入依赖的package包/类
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
{
	myInternalName = name;
	String parentName = myParent instanceof PsiClassStub ? ((PsiClassStub) myParent).getQualifiedName() : myParent instanceof PsiJavaFileStub ? ((PsiJavaFileStub) myParent).getPackageName() :
			null;
	String fqn = getFqn(name, myShortName, parentName);
	String shortName = myShortName != null && name.endsWith(myShortName) ? myShortName : PsiNameHelper.getShortClassName(fqn);

	int flags = myAccess | access;
	boolean isDeprecated = isSet(flags, Opcodes.ACC_DEPRECATED);
	boolean isInterface = isSet(flags, Opcodes.ACC_INTERFACE);
	boolean isEnum = isSet(flags, Opcodes.ACC_ENUM);
	boolean isAnnotationType = isSet(flags, Opcodes.ACC_ANNOTATION);
	byte stubFlags = PsiClassStubImpl.packFlags(isDeprecated, isInterface, isEnum, false, false, isAnnotationType, false, false);
	myResult = new PsiClassStubImpl(JavaStubElementTypes.CLASS, myParent, fqn, shortName, null, stubFlags);

	myModList = new PsiModifierListStubImpl(myResult, packClassFlags(flags));

	ClassInfo info = null;
	if(signature != null)
	{
		try
		{
			info = parseClassSignature(signature);
		}
		catch(ClsFormatException e)
		{
			if(LOG.isDebugEnabled())
			{
				LOG.debug("source=" + mySource + " signature=" + signature, e);
			}
		}
	}
	if(info == null)
	{
		info = parseClassDescription(superName, interfaces);
	}

	PsiTypeParameterListStub typeParameterList = new PsiTypeParameterListStubImpl(myResult);
	for(Pair<String, String[]> parameter : info.typeParameters)
	{
		PsiTypeParameterStub parameterStub = new PsiTypeParameterStubImpl(typeParameterList, StringRef.fromString(parameter.first));
		newReferenceList(JavaStubElementTypes.EXTENDS_BOUND_LIST, parameterStub, parameter.second);
	}

	if(myResult.isInterface())
	{
		if(info.interfaceNames != null && myResult.isAnnotationType())
		{
			info.interfaceNames.remove(CommonClassNames.JAVA_LANG_ANNOTATION_ANNOTATION);
		}
		newReferenceList(JavaStubElementTypes.EXTENDS_LIST, myResult, ArrayUtil.toStringArray(info.interfaceNames));
		newReferenceList(JavaStubElementTypes.IMPLEMENTS_LIST, myResult, ArrayUtil.EMPTY_STRING_ARRAY);
	}
	else
	{
		if(info.superName == null || "java/lang/Object".equals(superName) || myResult.isEnum() && "java/lang/Enum".equals(superName))
		{
			newReferenceList(JavaStubElementTypes.EXTENDS_LIST, myResult, ArrayUtil.EMPTY_STRING_ARRAY);
		}
		else
		{
			newReferenceList(JavaStubElementTypes.EXTENDS_LIST, myResult, new String[]{info.superName});
		}
		newReferenceList(JavaStubElementTypes.IMPLEMENTS_LIST, myResult, ArrayUtil.toStringArray(info.interfaceNames));
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:69,代码来源:StubBuildingVisitor.java


注:本文中的com.intellij.psi.impl.java.stubs.PsiTypeParameterStub类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。