Search in sources :

Example 1 with LanguageVersionHandler

use of net.sourceforge.pmd.lang.LanguageVersionHandler in project Gargoyle by callakrsos.

the class PMDUtil method getSupportedLanguageVersions.

/**
	 * 지원가능한 PMD Language를 리턴.
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2016. 10. 4.
	 * @return
	 */
public static LanguageVersion[] getSupportedLanguageVersions() {
    List<LanguageVersion> languageVersions = new ArrayList<>();
    for (LanguageVersion languageVersion : LanguageRegistry.findAllVersions()) {
        LanguageVersionHandler languageVersionHandler = languageVersion.getLanguageVersionHandler();
        if (languageVersionHandler != null) {
            Parser parser = languageVersionHandler.getParser(languageVersionHandler.getDefaultParserOptions());
            if (parser != null && parser.canParse()) {
                languageVersions.add(languageVersion);
                LOGGER.debug("support parser: {}", parser.toString());
            } else {
                LOGGER.debug("not support parser: {}", parser.toString());
            }
        } else {
            LOGGER.debug("not support parser (handler is null): {}", languageVersion.toString());
        }
    }
    return languageVersions.toArray(new LanguageVersion[languageVersions.size()]);
}
Also used : ArrayList(java.util.ArrayList) LanguageVersion(net.sourceforge.pmd.lang.LanguageVersion) LanguageVersionHandler(net.sourceforge.pmd.lang.LanguageVersionHandler) Parser(net.sourceforge.pmd.lang.Parser)

Aggregations

ArrayList (java.util.ArrayList)1 LanguageVersion (net.sourceforge.pmd.lang.LanguageVersion)1 LanguageVersionHandler (net.sourceforge.pmd.lang.LanguageVersionHandler)1 Parser (net.sourceforge.pmd.lang.Parser)1