or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

ast.mdcpd.mdindex.mdlanguage-module.mdmetrics.mdmultifile.mdrules.md

language-module.mddocs/

0

# Language Module

1

2

Core language module registration and configuration for PMD integration. Provides entry points for parser creation, language properties, and violation suppression handling.

3

4

## Capabilities

5

6

### Language Module Registration

7

8

Main entry point for the Apex language module integration with PMD framework.

9

10

```java { .api }

11

/**

12

* Main entry point for the Apex language module

13

* Singleton class that provides PMD integration

14

*/

15

public class ApexLanguageModule {

16

/** Get singleton instance of the language module */

17

public static ApexLanguageModule getInstance();

18

19

/** Create language processor for batch processing */

20

public ApexLanguageProcessor createProcessor(LanguagePropertyBundle bundle);

21

22

/** Create new property bundle with language-specific properties */

23

public LanguagePropertyBundle newPropertyBundle();

24

25

/** Create CPD lexer for copy-paste detection */

26

public Lexer createCpdLexer(LanguagePropertyBundle bundle);

27

}

28

```

29

30

### Language Processor

31

32

Handles batch processing of Apex files with multifile analysis support.

33

34

```java { .api }

35

/**

36

* Language processor for batch processing of Apex files

37

*/

38

public class ApexLanguageProcessor {

39

/** Get language version handler for parsing and analysis */

40

public LanguageVersionHandler services();

41

42

/** Get multifile analysis state for cross-file analysis */

43

public ApexMultifileAnalysis getMultiFileState();

44

}

45

```

46

47

### Language Properties

48

49

Configuration and properties specific to Apex language processing.

50

51

```java { .api }

52

/**

53

* Language-specific properties and configuration

54

*/

55

public class ApexLanguageProperties {

56

/** Property for specifying Salesforce metadata root directory for multifile analysis */

57

public static final PropertyDescriptor<String> MULTIFILE_DIRECTORY;

58

}

59

```

60

61

### Violation Suppressors

62

63

Handles @SuppressWarnings annotation processing for PMD violations.

64

65

```java { .api }

66

/**

67

* Handles @SuppressWarnings annotation processing

68

*/

69

public class ApexViolationSuppressors {

70

/** List of all Apex violation suppressors */

71

public static final List<ViolationSuppressor> ALL_APEX_SUPPRESSORS;

72

}

73

```

74

75

**Usage Examples:**

76

77

```java

78

// Register Apex language module

79

ApexLanguageModule apexModule = ApexLanguageModule.getInstance();

80

81

// Create language processor with properties

82

LanguagePropertyBundle properties = apexModule.newPropertyBundle();

83

properties.setProperty(ApexLanguageProperties.MULTIFILE_DIRECTORY, "/path/to/salesforce/metadata");

84

ApexLanguageProcessor processor = apexModule.createProcessor(properties);

85

86

// Get language services

87

LanguageVersionHandler handler = processor.services();

88

89

// Access multifile analysis

90

ApexMultifileAnalysis multifileAnalysis = processor.getMultiFileState();

91

if (!multifileAnalysis.isFailed()) {

92

List<Issue> issues = multifileAnalysis.getFileIssues("MyClass.cls");

93

for (Issue issue : issues) {

94

System.out.println("Issue: " + issue.getMessage());

95

}

96

}

97

98

// Create CPD lexer for duplicate detection

99

Lexer cpdLexer = apexModule.createCpdLexer(properties);

100

```