actually the sort call itself would throw NPE if the method parameter were null, I'm reordering while merging as:

````
Assert.isTrue(modules != null && modules.size() > 0, "at least one module required");
if (modules.size() == 1) {
    return modules.get(0).getType();
}
Collections.sort(modules);
````