public static boolean doInjectInJavaMethod(@NotNull final Project project,
                                             @Nullable final PsiMethod psiMethod,
                                             final int parameterIndex,
                                             @NotNull PsiLanguageInjectionHost host, @NotNull final String languageId) {
    if (psiMethod == null) return false;
    if (parameterIndex < -1) return false;
    if (parameterIndex >= psiMethod.getParameterList().getParametersCount()) return false;
    final PsiModifierList methodModifiers = psiMethod.getModifierList();
    if (methodModifiers.hasModifierProperty(PsiModifier.PRIVATE) || methodModifiers.hasModifierProperty(PsiModifier.PACKAGE_LOCAL)) {
      return doAddLanguageAnnotation(project, parameterIndex >= 0? psiMethod.getParameterList().getParameters()[parameterIndex] : psiMethod,
                                     host, languageId);
    }
    final PsiClass containingClass = psiMethod.getContainingClass();
    assert containingClass != null;
    final PsiModifierList classModifiers = containingClass.getModifierList();
    if (classModifiers != null && (classModifiers.hasModifierProperty(PsiModifier.PRIVATE) || classModifiers.hasModifierProperty(PsiModifier.PACKAGE_LOCAL))) {
      return doAddLanguageAnnotation(project, parameterIndex >= 0 ? psiMethod.getParameterList().getParameters()[parameterIndex] : psiMethod,
                                     host, languageId);
    }

    final MethodParameterInjection injection = makeParameterInjection(psiMethod, parameterIndex, languageId);
    doEditInjection(project, injection, host.getContainingFile(), psiMethod);
    return true;
  }
public static boolean doInjectInJavaMethod(@NotNull final Project project,
                                             @Nullable final PsiMethod psiMethod,
                                             final int parameterIndex,
                                             @NotNull PsiLanguageInjectionHost host, @NotNull final String languageId)