コード例 #1
0
 private static PsiType removeClassWildcard(PsiType type) {
   if (type instanceof PsiClassType) {
     final PsiClass psiClass = ((PsiClassType) type).resolve();
     if (psiClass != null
         && CommonClassNames.JAVA_LANG_CLASS.equals(psiClass.getQualifiedName())) {
       return GenericsUtil.eliminateWildcards(type);
     }
   }
   return type;
 }
コード例 #2
0
  private void processIfJavaLangClass(@Nullable PsiType type) {
    if (!(type instanceof PsiClassType)) return;

    final PsiClass psiClass = ((PsiClassType) type).resolve();
    if (psiClass == null || !CommonClassNames.JAVA_LANG_CLASS.equals(psiClass.getQualifiedName()))
      return;

    final PsiType[] params = ((PsiClassType) type).getParameters();
    if (params.length != 1) return;

    getVariantsFromQualifierType(params[0], myRefExpr.getProject());
  }
コード例 #3
0
    @Nullable
    @Override
    public MethodVisitor visitMethod(
        int access, String name, String desc, String signature, String[] exceptions) {
      if ((access & ACC_SYNTHETIC) == 0 && (access & ACC_STATIC) != 0 && name != null) {
        Type[] args = Type.getArgumentTypes(desc);
        if (args.length > 0
            && args[0].getSort() == Type.OBJECT
            && CommonClassNames.JAVA_LANG_CLASS.equals(args[0].getClassName())) {
          return super.visitMethod(access, name, desc, signature, exceptions);
        }
      }

      return null;
    }
コード例 #4
0
 private static PsiType removeClassWildcard(PsiType type) {
   if (type instanceof PsiClassType) {
     final PsiClass psiClass = ((PsiClassType) type).resolve();
     if (psiClass != null
         && CommonClassNames.JAVA_LANG_CLASS.equals(psiClass.getQualifiedName())) {
       PsiClassType erased = (PsiClassType) GenericsUtil.eliminateWildcards(type);
       PsiType[] parameters = erased.getParameters();
       if (parameters.length == 1
           && !parameters[0].equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) {
         return erased;
       }
     }
   }
   return type;
 }