本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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;
}
示例5: ClsTypeParameterImpl
import com.intellij.psi.impl.java.stubs.PsiTypeParameterStub; //导入依赖的package包/类
public ClsTypeParameterImpl(@NotNull PsiTypeParameterStub stub) {
super(stub);
myLightEmptyImplementsList = new LightEmptyImplementsList(getManager());
}
示例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);
}
示例7: PsiTypeParameterImpl
import com.intellij.psi.impl.java.stubs.PsiTypeParameterStub; //导入依赖的package包/类
public PsiTypeParameterImpl(final PsiTypeParameterStub stub) {
super(stub, JavaStubElementTypes.TYPE_PARAMETER);
}
示例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));
}
}