The language module provides core PMD integration for Scala support, registering the language with PMD's framework and providing version-specific configuration.
Main language module registration class that integrates Scala with PMD's multilanguage architecture.
public class ScalaLanguageModule extends SimpleLanguageModuleBase {
public ScalaLanguageModule();
public static ScalaLanguageModule getInstance();
public CpdLexer createCpdLexer(LanguagePropertyBundle bundle);
}Usage Example:
// Get the singleton Scala language module instance
ScalaLanguageModule module = ScalaLanguageModule.getInstance();
// Create a CPD lexer for copy-paste detection
LanguagePropertyBundle bundle = // ... configure language properties
CpdLexer lexer = module.createCpdLexer(bundle);Language version handler that provides parser instances for different Scala versions.
public class ScalaLanguageHandler extends AbstractPmdLanguageVersionHandler {
public ScalaParser getParser();
}Usage Example:
ScalaLanguageHandler handler = new ScalaLanguageHandler();
ScalaParser parser = handler.getParser();The module supports the following Scala versions through dialect configuration:
The language module integrates with PMD through:
Language configuration is handled through:
// Language metadata configuration
LanguageMetadata.withId("scala")
.name("Scala")
.extensions("scala")
.addVersion("2.10")
.addVersion("2.11")
.addVersion("2.12")
.addDefaultVersion("2.13")The module automatically configures: