@Override
    boolean isApplicable(PsiElement context, PsiType inType, PsiType outType) {
      if (inType == null ||
          outType == null ||
          inType.equals(PsiTypes.nullType()) ||
          !myInTypeFilter.test(inType) ||
          !myOutTypeFilter.test(outType)) {
        return false;
      }
      PsiType variableType = GenericsUtil.getVariableTypeByExpressionType(inType);
      if (LambdaUtil.notInferredType(variableType)) return false;
      if (variableType instanceof PsiDisjunctionType) {
        variableType = ((PsiDisjunctionType)variableType).getLeastUpperBound();
      }

      String typeText = variableType.getCanonicalText();
      // Empty text can be generated by PsiImmediateClassType if unresolved anonymous class is created like new X() {}
      if (typeText.isEmpty()) return false;
      if (variableType instanceof PsiClassType clsType &&
          !PsiNameHelper.getInstance(context.getProject()).isQualifiedName(clsType.rawType().getCanonicalText())) {
        // Wrong qualified name may happen e.g. if we depend on class file that contains a package name with keyword part
        // (probably compiled from non-Java language)
        return false;
      }
      PsiExpression replacement;
      try {
        replacement = createReplacement(context, "((" + typeText + ")null)");
      }
      catch (IncorrectOperationException ioe) {
        PsiClass aClass = PsiUtil.resolveClassInClassTypeOnly(variableType);
        throw new IncorrectOperationException(getExceptionMessage(variableType, aClass), (Throwable)ioe);
      }
      PsiDeclarationStatement declaration =
        JavaPsiFacade.getElementFactory(context.getProject()).createVariableDeclarationStatement("x", outType, replacement, context);
      PsiVariable var = ObjectUtils.tryCast(ArrayUtil.getFirstElement(declaration.getDeclaredElements()), PsiVariable.class);
      if (var == null) return false;
      PsiExpression initializer = var.getInitializer();
      if (initializer == null) return false;
      PsiType resultType = initializer.getType();
      return resultType != null && outType.isAssignableFrom(resultType);
    }
@Override
    boolean isApplicable(PsiElement context, PsiType inType, PsiType outType)