Class PmdKotlinParser
java.lang.Object
net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrBaseParser<KotlinNode,KotlinParser.KtKotlinFile>
net.sourceforge.pmd.lang.kotlin.ast.PmdKotlinParser
- All Implemented Interfaces:
Parser
Adapter for the KotlinParser.
Each parse injects a fresh InterruptibleParserATNSimulator with its own DFA arrays
and PredictionContextCache. Using per-parse instances avoids lock contention when
PMD parses files in parallel, which would otherwise cause severe performance degradation due
to the complexity of the Kotlin grammar.
A per-file parse timeout acts as a safety net. Files exceeding the timeout are skipped with a processing
error. The timeout is configured via KotlinLanguageProperties.PARSE_TIMEOUT_SECONDS.
Error handling strategy:
- Lexer errors (e.g. unrecognized tokens) and Parser errors (e.g. unexpected token structure) are collected and lexing/parsing continues.
- Further lexer/parser errors are collected as suppressed exceptions.
- The first occurred lexer/parser exception is thrown at the end and no rules are executed.
PMD reports the file as a ProcessingError and skips rule analysis for it.
All other files continue to be processed. Exit code 5 is returned by the CLI if
any processing errors occurred (suppressible with --no-fail-on-error).
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.sourceforge.pmd.lang.ast.Parser
Parser.ParserTask -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.antlr.v4.runtime.LexergetLexer(org.antlr.v4.runtime.CharStream source) protected KotlinParser.KtKotlinFileparse(org.antlr.v4.runtime.Lexer lexer, Parser.ParserTask task) Methods inherited from class net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrBaseParser
parse
-
Constructor Details
-
PmdKotlinParser
Deprecated.Since 7.25.0. Don't create a parser directly. UseKotlinLanguageModule.getInstance(),KotlinLanguageModule.createProcessor(LanguagePropertyBundle),KotlinLanguageProcessor.services(),KotlinHandler.getParser()instead.
-
-
Method Details
-
parse
- Specified by:
parsein classAntlrBaseParser<KotlinNode,KotlinParser.KtKotlinFile>
-
getLexer
protected org.antlr.v4.runtime.Lexer getLexer(org.antlr.v4.runtime.CharStream source) - Specified by:
getLexerin classAntlrBaseParser<KotlinNode,KotlinParser.KtKotlinFile>
-