List of usage examples for java.lang UnsupportedClassVersionError toString
public String toString()
From source file:net.sourceforge.pmd.lang.LanguageRegistry.java
private LanguageRegistry() { List<Language> languagesList = new ArrayList<>(); // Use current class' classloader instead of the threads context classloader, see https://github.com/pmd/pmd/issues/1377 ServiceLoader<Language> languageLoader = ServiceLoader.load(Language.class, getClass().getClassLoader()); Iterator<Language> iterator = languageLoader.iterator(); while (iterator.hasNext()) { try {/*from w w w . j ava 2 s . co m*/ Language language = iterator.next(); languagesList.add(language); } catch (UnsupportedClassVersionError e) { // Some languages require java8 and are therefore only available // if java8 or later is used as runtime. System.err.println("Ignoring language for PMD: " + e.toString()); } } // sort languages by terse name. Avoiding differences in the order of languages // across JVM versions / OS. Collections.sort(languagesList, new Comparator<Language>() { @Override public int compare(Language o1, Language o2) { return o1.getTerseName().compareToIgnoreCase(o2.getTerseName()); } }); // using a linked hash map to maintain insertion order languages = new LinkedHashMap<>(); for (Language language : languagesList) { languages.put(language.getName(), language); } }