All language modules: getInstance()

Use a consistent implementation of getInstance().
Now all modules resolve against the LanguageRegistry.
This commit is contained in:
Andreas Dangel
2023-08-24 15:30:49 +02:00
parent 80856732cc
commit 32afa53f8e
44 changed files with 232 additions and 154 deletions

View File

@ -17,7 +17,7 @@ import net.sourceforge.pmd.properties.PropertyFactory;
* Defines the Language module for C/C++
*/
public class CppLanguageModule extends CpdOnlyLanguageModuleBase {
private static final String ID = "cpp";
public static final PropertyDescriptor<String> CPD_SKIP_BLOCKS =
PropertyFactory.stringProperty("cpdSkipBlocksPattern")
@ -32,13 +32,13 @@ public class CppLanguageModule extends CpdOnlyLanguageModuleBase {
* for c/c++ files.
*/
public CppLanguageModule() {
super(LanguageMetadata.withId("cpp")
super(LanguageMetadata.withId(ID)
.name("C++")
.extensions("h", "hpp", "hxx", "c", "cpp", "cxx", "cc", "C"));
}
public static CppLanguageModule getInstance() {
return (CppLanguageModule) LanguageRegistry.CPD.getLanguageById("cpp");
return (CppLanguageModule) LanguageRegistry.CPD.getLanguageById(ID);
}
@Override