or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

ast-parsing.mdast-traversal.mdcopy-paste-detection.mdindex.mdlanguage-module.mdrule-development.md
tile.json

language-module.mddocs/

Language Module

The language module provides core PMD integration for Scala support, registering the language with PMD's framework and providing version-specific configuration.

Core Language Integration

ScalaLanguageModule

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);

ScalaLanguageHandler

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();

Supported Versions

The module supports the following Scala versions through dialect configuration:

  • Scala 2.10: Historical support
  • Scala 2.11: Historical support
  • Scala 2.12: Primary target version for this module
  • Scala 2.13: Default version used when no specific version is specified

Integration Points

PMD Framework Integration

The language module integrates with PMD through:

  1. Language Registry: Registers "scala" as a supported language
  2. File Extensions: Associates ".scala" files with the Scala language module
  3. Version Management: Provides version-specific parsing capabilities
  4. CPD Integration: Creates lexers for copy-paste detection

Configuration

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:

  • Language identifier: "scala"
  • Display name: "Scala"
  • File extensions: ".scala"
  • Supported versions with 2.13 as default