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

@@ -6,6 +6,7 @@ package net.sourceforge.pmd.lang.python;
import net.sourceforge.pmd.cpd.Tokenizer;
import net.sourceforge.pmd.lang.LanguagePropertyBundle;
import net.sourceforge.pmd.lang.LanguageRegistry;
import net.sourceforge.pmd.lang.impl.CpdOnlyLanguageModuleBase;
import net.sourceforge.pmd.lang.python.cpd.PythonTokenizer;
@@ -13,9 +14,14 @@ import net.sourceforge.pmd.lang.python.cpd.PythonTokenizer;
* Defines the Language module for Python
*/
public class PythonLanguageModule extends CpdOnlyLanguageModuleBase {
private static final String ID = "python";
public PythonLanguageModule() {
super(LanguageMetadata.withId("python").name("Python").extensions("py"));
super(LanguageMetadata.withId(ID).name("Python").extensions("py"));
}
public static PythonLanguageModule getInstance() {
return (PythonLanguageModule) LanguageRegistry.CPD.getLanguageById(ID);
}
@Override