コード例 #1
0
 public static boolean resolvesTo(PsiType type, String fqn) {
   if (type instanceof PsiClassType) {
     final PsiClass resolved = ((PsiClassType) type).resolve();
     return resolved != null && fqn.equals(resolved.getQualifiedName());
   }
   return false;
 }
コード例 #2
0
 public static boolean isClassType(@Nullable PsiType type, @NotNull String qName) {
   if (type instanceof PsiClassType) {
     final PsiClass psiClass = ((PsiClassType) type).resolve();
     return psiClass != null && qName.equals(psiClass.getQualifiedName());
   }
   return false;
 }
コード例 #3
0
 public static PsiType unboxPrimitiveTypeWrapper(@Nullable PsiType type) {
   if (type instanceof PsiClassType) {
     final PsiClass psiClass = ((PsiClassType) type).resolve();
     if (psiClass != null) {
       PsiType unboxed = ourQNameToUnboxed.get(psiClass.getQualifiedName());
       if (unboxed != null) type = unboxed;
     }
   }
   return type;
 }
コード例 #4
0
  public static Map<String, PsiClass> getSuperClassesWithCache(@NotNull PsiClass aClass) {
    Map<String, PsiClass> superClassNames = PARENT_CACHE_KEY.getCachedValue(aClass);
    if (superClassNames == null) {
      Set<PsiClass> superClasses = new THashSet<PsiClass>();
      superClasses.add(aClass);
      InheritanceUtil.getSuperClasses(aClass, superClasses, true);

      superClassNames = new LinkedHashMap<String, PsiClass>();
      for (PsiClass superClass : superClasses) {
        superClassNames.put(superClass.getQualifiedName(), superClass);
      }

      superClassNames = PARENT_CACHE_KEY.putCachedValue(aClass, superClassNames);
    }

    return superClassNames;
  }