String (@NotNull Library library) { final String result = library.getName(); if (result != null) { return result; } for (OrderRootType type : OrderRootType.getAllTypes()) { for (String url : library.getUrls(type)) { String candidate = extractNameFromPath(url); if (!StringUtil.isEmpty(candidate)) { return candidate; } } } assert false; return "unknown-lib"; }