Delete old CPD Language interface

reorganize cpd modules
This commit is contained in:
Clément Fournier committed 2023-02-12 18:03:58 +01:00
1 parent 8fbd830daa
commit fb9f49624d
87 files changed
+402 -476

No files matched your search

@@ -28,15 +28,15 @@ public class PmdLanguageVersionTypeSupport implements ITypeConverter<LanguageVer
// Explicit language-version pairs, such as "java-18" or "apex-54".
// We build these directly to retain aliases. "java-8" works, but the canonical name for the LanguageVersion is java-1.8
return LanguageRegistry.PMD.getLanguages().stream()
.flatMap(l -> l.getVersionNamesAndAliases().stream().map(v -> l.getTerseName() + "-" + v))
.flatMap(l -> l.getVersionNamesAndAliases().stream().map(v -> l.getId() + "-" + v))
.collect(Collectors.toCollection(TreeSet::new)).iterator();
}
@Override
public LanguageVersion convert(final String value) throws Exception {
return LanguageRegistry.PMD.getLanguages().stream()
.filter(l -> value.startsWith(l.getTerseName() + "-"))
.map(l -> l.getVersion(value.substring(l.getTerseName().length() + 1)))
.filter(l -> value.startsWith(l.getId() + "-"))
.map(l -> l.getVersion(value.substring(l.getId().length() + 1)))
.filter(Objects::nonNull)
.findFirst()
.orElseThrow(() -> new TypeConversionException("Unknown language version: " + value));