private static @NotNull JVMElementFactory getFactory(@NotNull Project p, @Nullable PsiElement target) {
    return target == null ? JavaPsiFacade.getElementFactory(p) : JVMElementFactories.requireFactory(target.getLanguage(), p);
  }
private static @NotNull JVMElementFactory getFactory(@NotNull Project p, @Nullable PsiElement target)