void (@NotNull Disposable parent, @NotNull Module module, String libName, @NotNull String libPath, String @NotNull ... jarArr) { Ref<Library> ref = new Ref<>(); ModuleRootModificationUtil.updateModel(module, model -> ref.set(addLibrary(model, libName, libPath, jarArr))); Disposer.register(parent, () -> removeLibrary(module, ref.get())); }