@Override
  ExceptionLineRefiner.RefinerMatchResult matchSpecificExceptionElement(@NotNull PsiElement current) {
    if (myTargetClass == null) return null;
    PsiElement e = PsiTreeUtil.nextVisibleLeaf(current);
    if (e instanceof PsiJavaToken && e.textMatches("(") && e.getParent() instanceof PsiTypeCastExpression) {
      PsiTypeElement typeElement = ((PsiTypeCastExpression)e.getParent()).getCastType();
      if (typeElement != null && castClassMatches(typeElement.getType(), myTargetClass)) {
        return onTheSameLineFor(current, typeElement, true);
      }
    }
    e = PsiTreeUtil.prevVisibleLeaf(current);
    if (e instanceof PsiIdentifier && e.getParent() instanceof PsiReferenceExpression ref) {
      PsiElement target = ref.resolve();
      PsiType type;
      if (target instanceof PsiMethod method) {
        type = method.getReturnType();
      }
      else if (target instanceof PsiVariable variable) {
        type = variable.getType();
      }
      else {
        return null;
      }
      PsiClass psiClass = PsiUtil.resolveClassInType(type);
      if (!(psiClass instanceof PsiTypeParameter)) return null;
      // Implicit cast added by compiler
      if (castClassMatches(ref.getType(), myTargetClass)) {
        return onTheSameLineFor(current, e, false);
      }
    }
    return null;
  }
@Override
  ExceptionLineRefiner.RefinerMatchResult matchSpecificExceptionElement(@NotNull PsiElement current)