void (@Nullable VirtualFile jarRoot, @NotNull Library library) { if (jarRoot != null) { if (!Arrays.asList(library.getFiles(OrderRootType.SOURCES)).contains(jarRoot)) { Library.ModifiableModel model = library.getModifiableModel(); model.addRoot(jarRoot, OrderRootType.SOURCES); model.commit(); } } }