private static @NotNull PsiType getValidParameterType(PsiParameter parameter, PsiMethod targetMethod) {
    PsiType bareParamType = parameter.getType();
    if (!bareParamType.isValid()) {
      try {
        PsiUtil.ensureValidType(bareParamType);
      }
      catch (ProcessCanceledException e) {
        throw e;
      }
      catch (Throwable e) {
        throw PluginException.createByClass(
          parameter.getClass() + "; valid=" + parameter.isValid() + "; method.valid=" + targetMethod.isValid(),
          e, parameter.getClass());
      }
    }
    return bareParamType;
  }
private static @NotNull PsiType getValidParameterType(PsiParameter parameter, PsiMethod targetMethod)