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


Java PsiTypeParameter类代码示例

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


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

示例1: makeSrcClass

import com.intellij.psi.PsiTypeParameter; //导入依赖的package包/类
public SrcClass makeSrcClass( String fqn, PsiClass psiClass, ManModule module )
{
  SrcClass srcClass = new SrcClass( fqn, getKind( psiClass ) )
    .modifiers( getModifiers( psiClass.getModifierList() ) );
  for( PsiTypeParameter typeVar : psiClass.getTypeParameters() )
  {
    srcClass.addTypeVar( new SrcType( makeTypeVar( typeVar ) ) );
  }
  setSuperTypes( srcClass, psiClass );
  for( PsiMethod psiMethod : psiClass.getMethods() )
  {
    addMethod( srcClass, psiMethod );
  }
  for( PsiField psiField : psiClass.getFields() )
  {
    addField( srcClass, psiField );
  }
  for( PsiClass psiInnerClass : psiClass.getInnerClasses() )
  {
    addInnerClass( srcClass, psiInnerClass, module );
  }
  return srcClass;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:24,代码来源:StubBuilder.java

示例2: makeTypeVar

import com.intellij.psi.PsiTypeParameter; //导入依赖的package包/类
public static String makeTypeVar( PsiTypeParameter typeVar )
{
  StringBuilder sb = new StringBuilder();
  sb.append( typeVar.getName() );

  PsiJavaCodeReferenceElement[] bounds = typeVar.getExtendsList().getReferenceElements();
  if( bounds.length > 0 )
  {
    sb.append( " extends " );
    for( int i = 0; i < bounds.length; i++ )
    {
      if( i > 0 )
      {
        sb.append( " & " );
      }
      sb.append( bounds[i].getCanonicalText() );
    }
  }
  return sb.toString();
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:21,代码来源:StubBuilder.java

示例3: makeDefaultParameterizedType

import com.intellij.psi.PsiTypeParameter; //导入依赖的package包/类
public static PsiType makeDefaultParameterizedType( PsiType type )
{
  if( type != null && !isStructuralInterface( type ) &&
      !isParameterizedType( type ) && isGenericType( type ) )
  {
    PsiTypeParameter[] typeVars = type( type ).getTypeParameters();
    PsiType[] boundingTypes = new PsiType[typeVars.length];
    for( int i = 0; i < boundingTypes.length; i++ )
    {
      PsiTypeParameter typeVar = typeVars[i];
      boundingTypes[i] = type( getBoundingType( typeVar ) );
      if( isRecursiveType( (PsiClassType)type( typeVar ), boundingTypes[i] ) )
      {
        return type;
      }
    }

    if( boundingTypes.length == 0 )
    {
      return type;
    }

    type = parameterizeType( (PsiClassType)type, boundingTypes );
  }
  return type;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:27,代码来源:TypeUtil.java

示例4: mapActualTypeByVarName

import com.intellij.psi.PsiTypeParameter; //导入依赖的package包/类
private static TypeVarToTypeMap mapActualTypeByVarName( PsiType ownersType )
{
  TypeVarToTypeMap actualParamByVarName = new TypeVarToTypeMap();
  PsiTypeParameter[] vars = type( ownersType ).getTypeParameters();
  if( vars != null )
  {
    PsiType[] paramArgs = ((PsiClassType)ownersType).getParameters();
    for( int i = 0; i < vars.length; i++ )
    {
      PsiClassType typeVar = (PsiClassType)type( vars[i] );
      if( paramArgs.length > i )
      {
        actualParamByVarName.put( typeVar, paramArgs[i] );
      }
    }
  }
  return actualParamByVarName;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:19,代码来源:TypeUtil.java

示例5: visitClass

import com.intellij.psi.PsiTypeParameter; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
  if (aClass.isInterface() || aClass.isAnnotationType() || aClass.isEnum()) {
    return;
  }
  if (aClass instanceof PsiTypeParameter) {
    return;
  }
  if (!aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
    return;
  }
  if (!InheritanceUtil.hasOneInheritor(aClass)) {
    return;
  }
  registerClassError(aClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AbstractClassWithOnlyOneDirectInheritorInspection.java

示例6: visitClass

import com.intellij.psi.PsiTypeParameter; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
  if (aClass.isInterface() || aClass.isAnnotationType() || aClass instanceof PsiTypeParameter) {
    return;
  }
  if (!CloneUtils.isCloneable(aClass)) {
    return;
  }
  final PsiMethod[] methods = aClass.getMethods();
  for (final PsiMethod method : methods) {
    if (CloneUtils.isClone(method)) {
      if (ControlFlowUtils.methodAlwaysThrowsException(method)) {
        return;
      }
    }
  }
  registerClassError(aClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:CloneableClassInSecureContextInspection.java

示例7: visitClass

import com.intellij.psi.PsiTypeParameter; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
  if (aClass.isInterface() || aClass.isAnnotationType() || aClass.isEnum()) {
    return;
  }
  if (aClass instanceof PsiTypeParameter || !SerializationUtils.isSerializable(aClass)) {
    return;
  }
  final PsiMethod[] methods = aClass.getMethods();
  for (final PsiMethod method : methods) {
    if (!SerializationUtils.isReadObject(method)) {
      continue;
    }
    if (ControlFlowUtils.methodAlwaysThrowsException(method)) {
      return;
    }
    else {
      break;
    }
  }
  if (ignoreThrowable && InheritanceUtil.isInheritor(aClass, false, "java.lang.Throwable")) {
    return;
  }
  registerClassError(aClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:DeserializableClassInSecureContextInspection.java

示例8: visitClass

import com.intellij.psi.PsiTypeParameter; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
  if (aClass.isInterface() || aClass.isAnnotationType() || aClass.isEnum()) {
    return;
  }
  if (aClass instanceof PsiTypeParameter || !SerializationUtils.isSerializable(aClass)) {
    return;
  }
  final PsiMethod[] methods = aClass.findMethodsByName("writeObject", true);
  for (final PsiMethod method : methods) {
    if (!SerializationUtils.isWriteObject(method)) {
      continue;
    }
    if (ControlFlowUtils.methodAlwaysThrowsException((PsiMethod)method.getNavigationElement())) {
      return;
    }
    else {
      break;
    }
  }
  if (ignoreThrowable && InheritanceUtil.isInheritor(aClass, false, "java.lang.Throwable")) {
    return;
  }
  registerClassError(aClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:SerializableClassInSecureContextInspection.java

示例9: visitClass

import com.intellij.psi.PsiTypeParameter; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
  // no call to super, so it doesn't drill down into inner classes
  if (aClass instanceof PsiTypeParameter) {
    return;
  }
  final String className = aClass.getName();
  if (className == null) {
    return;
  }
  @NonNls final String exception = "Exception";
  if (className.endsWith(exception)) {
    return;
  }
  if (!InheritanceUtil.isInheritor(aClass,
                                   CommonClassNames.JAVA_LANG_EXCEPTION)) {
    return;
  }
  registerClassError(aClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ExceptionNameDoesntEndWithExceptionInspectionBase.java

示例10: visitClass

import com.intellij.psi.PsiTypeParameter; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
  if (aClass.isInterface() || aClass.isAnnotationType() || aClass.isEnum()) {
    return;
  }
  if (aClass instanceof PsiTypeParameter) {
    return;
  }
  if (aClass.hasModifierProperty(PsiModifier.ABSTRACT) && isInspectionEnabled("AbstractClassNamingConvention", aClass)) {
    return;
  }
  final String name = aClass.getName();
  if (name == null || isValid(name)) {
    return;
  }
  registerClassError(aClass, name);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ClassNamingConventionInspectionBase.java

示例11: visitTypeParameter

import com.intellij.psi.PsiTypeParameter; //导入依赖的package包/类
@Override
public void visitTypeParameter(PsiTypeParameter parameter) {
  super.visitTypeParameter(parameter);
  final String name = parameter.getName();
  if (name == null) {
    return;
  }
  if (isValid(name)) {
    return;
  }
  final PsiIdentifier nameIdentifier = parameter.getNameIdentifier();
  if (nameIdentifier == null) {
    return;
  }
  registerError(nameIdentifier, name);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:TypeParameterNamingConventionInspectionBase.java

示例12: visitClass

import com.intellij.psi.PsiTypeParameter; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
  // no call to super, so it doesn't drill down
  if (aClass.isInterface() || aClass.isEnum() ||
      aClass.isAnnotationType()) {
    return;
  }
  if (aClass instanceof PsiTypeParameter) {
    return;
  }
  if (m_ignoreClassesWithNoConstructors &&
      !classHasConstructor(aClass)) {
    return;
  }
  if (classHasNoArgConstructor(aClass)) {
    return;
  }
  registerClassError(aClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ClassWithoutNoArgConstructorInspection.java

示例13: visitClass

import com.intellij.psi.PsiTypeParameter; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
  // note: no call to super
  if (aClass.isEnum()) {
    return;
  }
  if (aClass instanceof PsiTypeParameter) {
    return;
  }
  final int inheritanceDepth =
    getInheritanceDepth(aClass, new HashSet<PsiClass>());
  if (inheritanceDepth <= getLimit()) {
    return;
  }
  registerClassError(aClass, Integer.valueOf(inheritanceDepth));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ClassInheritanceDepthInspection.java

示例14: findClass

import com.intellij.psi.PsiTypeParameter; //导入依赖的package包/类
@Nullable
@Override
public PsiClass findClass(@NotNull PsiElement place) {
  if (place.getLanguage() == GroovyLanguage.INSTANCE) {
    PsiClass containingClass = PsiTreeUtil.getParentOfType(place, PsiClass.class, false);
    while (containingClass instanceof PsiTypeParameter) {
      containingClass = PsiTreeUtil.getParentOfType(containingClass, PsiClass.class);
    }
    if (containingClass != null) return containingClass;

    PsiFile file = place.getContainingFile();
    if (file instanceof GroovyFile && ((GroovyFile)file).isScript()) {
      return ((GroovyFile)file).getScriptClass();
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GroovyScriptClassSearcher.java

示例15: findElementForParameterInfo

import com.intellij.psi.PsiTypeParameter; //导入依赖的package包/类
@Nullable
@Override
public GrTypeArgumentList findElementForParameterInfo(@NotNull CreateParameterInfoContext context) {
  final GrTypeArgumentList parameterList = ParameterInfoUtils.findParentOfType(context.getFile(), context.getOffset(), GrTypeArgumentList.class);

  if (parameterList != null) {
    if (!(parameterList.getParent() instanceof GrCodeReferenceElement)) return null;
    final GrCodeReferenceElement ref = ((GrCodeReferenceElement)parameterList.getParent());

    final PsiElement resolved = ref.resolve();
    if (!(resolved instanceof PsiTypeParameterListOwner)) return null;

    final PsiTypeParameter[] typeParams = ((PsiTypeParameterListOwner)resolved).getTypeParameters();
    if (typeParams.length == 0) return null;

    context.setItemsToShow(typeParams);
    return parameterList;
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GroovyTypeParameterInfoHandler.java


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