Skip to content

SONARJAVA-7341 Simplify the parser interface - #6517

Merged
aurelien-coet-sonarsource merged 4 commits into
ac/implementation-agnostic-frontend-2from
simplify-parser
Nov 18, 2026
Merged

aurelien-coet-sonarsource merged 4 commits into
ac/implementation-agnostic-frontend-2from
simplify-parser

Conversation

@aurelien-coet-sonarsource

@aurelien-coet-sonarsource aurelien-coet-sonarsource commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary by Gitar

  • Parser API:
    • Replaced JParserConfig with a JParser interface and JParser.Mode factories in JParser.java
    • Parsing now takes Iterable<InputFile> and reports results through JParseResult
    • Batch mode falls back to file-by-file parsing for files not analyzed after a batch failure
  • ECJ implementation:
    • Split the ECJ code from JDTParserConfig into JDTParser (batch and file-by-file) and JDTAstConverter
    • Moved ECJ implementation classes to org.sonar.java.jdt with JDT prefixes
  • Semantic API:
    • AST nodes store Type and Symbol values instead of exposing ECJ IBinding types
    • JSymbolMetadata.JNullabilityData moved to top-level org.sonar.java.model.JNullabilityData
  • Tests and docs:
    • Updated tests and test utilities to the new parser API
    • Documented the breaking API changes in documentation.md

This will update automatically on new commits.

@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title Simplify the parser interface SONARJAVA-7341 Simplify the parser interface Nov 13, 2026
@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

SONARJAVA-7341

Comment on lines 28 to +42
public interface JParser {

JavaTree.CompilationUnitTreeImpl parse(String version, String unitName, String source);
JavaVersion MAXIMUM_SUPPORTED_JAVA_VERSION = new JavaVersionImpl(JavaVersionImpl.MAX_SUPPORTED, true);

enum Mode {
BATCH,
FILE_BY_FILE;

static JavaTree.CompilationUnitTreeImpl parse(JParser parser, String version, String unitName, String source) {
return parser.parse(version, unitName, source);
public JParser create(JavaVersion javaVersion, List<File> classpath) {
return create(javaVersion, classpath, false);
}

public JParser create(JavaVersion javaVersion, List<File> classpath, boolean shouldIgnoreUnnamedModuleForSplitPackage) {
return JDTParser.create(this, javaVersion, classpath, shouldIgnoreUnnamedModuleForSplitPackage);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Cross-Repo: SE test helper JParserTestUtils.parse stops compiling on java-frontend bump

Fix here and in SonarSource/sonar-java-symbolic-execution

Breaks in: SonarSource/sonar-java-symbolic-execution - java-symbolic-execution/java-symbolic-execution-plugin/src/test/java/org/sonar/java/se/utils/JParserTestUtils.java - JParserTestUtils.parse

This PR deletes org.sonar.java.model.JParserConfig, which takes astParser() and MAXIMUM_SUPPORTED_JAVA_VERSION with it. It also removes the static JParser.parse(JParser, String, String, String) helper and the instance method parse(String, String, String). JParser is left with only the multi-file parse(Iterable<InputFile>, BooleanSupplier, AnalysisProgress, BiConsumer<InputFile, JParseResult>).

In SonarSource/sonar-java-symbolic-execution, JParserTestUtils.parse (java-symbolic-execution/java-symbolic-execution-plugin/src/test/java/org/sonar/java/se/utils/JParserTestUtils.java) still uses JParserConfig.MAXIMUM_SUPPORTED_JAVA_VERSION, JParserConfig.Mode.FILE_BY_FILE.create(...).astParser() and the static JParser.parse(parser, ...). When that repo upgrades its pinned java-frontend to a build that includes this change, the helper no longer compiles, and neither does any SE test that depends on it.

The removal is deliberate, so the SE repo is the side that has to move. Because only the InputFile-based API is left, its test module also needs a test-scoped sensor-test-fixtures dependency (the same one this PR adds to java-checks-common/pom.xml) or some other way to get an InputFile. The 8.47 notes in documentation.md don't name the removed JParserConfig#astParser(), the static JParser.parse(JParser, …), or the move of MAXIMUM_SUPPORTED_JAVA_VERSION.

Here: In the 8.47 Breaking notes, list the removed JParserConfig#astParser(), JParserConfig#parse(String, String) and static JParser.parse(JParser, String, String, String), and say that MAXIMUM_SUPPORTED_JAVA_VERSION now lives on JParser. Then tell sonar-java-symbolic-execution so it can migrate to the InputFile-based parse when it bumps java-frontend.

There: In JParserTestUtils.parse, remove the JParserConfig, astParser() and static JParser.parse usage. Wrap the source in a TestInputFileBuilder InputFile and call the multi-file parse on JParser.Mode.FILE_BY_FILE.create(version, classpath). Then add a test-scoped org.sonarsource.scanner.engine:sensor-test-fixtures dependency to the plugin's pom.

In SonarSource/sonar-java-symbolic-execution - java-symbolic-execution/java-symbolic-execution-plugin/src/test/java/org/sonar/java/se/utils/JParserTestUtils.java:

public static CompilationUnitTree parse(String unitName, String source, List<File> classpath) {
  JavaVersion version = JParser.MAXIMUM_SUPPORTED_JAVA_VERSION;
  InputFile inputFile = new TestInputFileBuilder("", unitName)
    .setContents(source).setCharset(StandardCharsets.UTF_8).build();
  List<JParseResult> results = new ArrayList<>();
  JParser.Mode.FILE_BY_FILE.create(version, classpath)
    .parse(List.of(inputFile), () -> false, new AnalysisProgress(1), (input, result) -> results.add(result));
  try {
    return results.getFirst().get();
  } catch (RuntimeException e) {
    throw e;
  } catch (Exception e) {
    throw new IllegalStateException("Unable to parse source", e);
  }
}

Was this helpful? React with 👍 / 👎

Comment on lines +63 to 77
public static JParser create(JParser.Mode mode, JavaVersion javaVersion, List<File> classpath, boolean shouldIgnoreUnnamedModuleForSplitPackage) {
if (shouldIgnoreUnnamedModuleForSplitPackage) {
LOG.info("The Java analyzer will ignore the unnamed module for split packages.");
}
return ((JavaTree) node).getChildren().iterator();
return switch (mode) {
case BATCH -> new Batch(javaVersion, classpath, shouldIgnoreUnnamedModuleForSplitPackage);
case FILE_BY_FILE -> new FileByFile(javaVersion, classpath, shouldIgnoreUnnamedModuleForSplitPackage);
};
}

@VisibleForTesting
static List<Token> lex(String version, String unitName, char[] sourceChars) {
List<Token> tokens = new ArrayList<>();
Scanner scanner = new Scanner(
true,
false,
false,
CompilerOptions.versionToJdkLevel(version),
null,
null,
false
);
scanner.fakeInModule = "module-info.java".equals(unitName);
scanner.setSource(sourceChars);
while (true) {
try {
TerminalToken tokenType = scanner.getNextToken();
Token token = Token.fromCurrent(scanner, tokenType);
tokens.add(token);
if (tokenType == TerminalToken.TokenNameEOF) {
break;
}
} catch (InvalidInputException e) {
throw new IllegalStateException(e);
}
}
return tokens;
}

private CompilationUnit compilationUnit;

private TokenManager tokenManager;
private LineColumnConverter lineColumnConverter;

private JDTSema sema;

private final Deque<JLabelSymbol> labels = new LinkedList<>();

private void declaration(@Nullable IBinding binding, Tree node) {
if (binding == null) {
return;
}
sema.declarations.put(binding, node);
static boolean shouldEnablePreviewFlag(JavaVersion currentVersion) {
return currentVersion.arePreviewFeaturesEnabled();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Cross-PR: JDK release-option support from #6459 is lost after JParserConfig removal

Breaks when this PR and #6459 both merge into the same line. Whichever lands second either fails to compile or silently drops the sonar.java.useJdkReleaseOption behaviour.

How

  1. #6459 adds a shouldUseJdkReleaseOption field, a four-argument Mode.create(...) and useReleaseApiOfConfiguredJdk(...) to JParserConfig (java-frontend/src/main/java/org/sonar/java/model/JParserConfig.java:141). It calls them from JavaFrontend.scanBatch and JavaAstScanner.scan.
  2. This PR deletes JParserConfig. Parser construction moves to JParser.Mode.create(JavaVersion, List<File>, boolean) (java-frontend/src/main/java/org/sonar/java/model/JParser.java:36-42) and JDTParser.create.
  3. JDTParser.jdtAstParser() (java-frontend/src/main/java/org/sonar/java/jdt/JDTParser.java:84-112) builds the ECJ environment from the raw classpath and never sets SystemReleaseClasspath.OPTION_RELEASE. If #6459's call sites are only ported to JParser.Mode, the parser keeps using the running JDK's API instead of the target release's.

Fix

  • This PR: If #6459 lands first, add the shouldUseJdkReleaseOption flag to JParser.Mode.create, JDTParser.create and the JDTParser constructor. Move useReleaseApiOfConfiguredJdk into JDTParser.jdtAstParser() and keep the JavaFrontend/JavaAstScanner wiring.
  • #6459: If this PR lands first, rebase onto JParser.Mode/JDTParser. Put the release-option logic in JDTParser.jdtAstParser() instead of JParserConfig.astParser(), and move the JParserConfigTest cases to JParserModeTest/JDTParserTest.

Compared 5006a8c with #6459 at 71f4165

Was this helpful? React with 👍 / 👎

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

For the runtime risk of breaking things:

  • DBD only relies on removed classes through the StubsGenerator, which is not run at runtime, so analysis on my local SQ with the new sonar-java was functioning correctly.
  • Security also is not be affected on production code
  • Same for symbolic-execution

@sonarqube-next

Copy link
Copy Markdown
Contributor

@gitar-bot

gitar-bot Bot commented Nov 17, 2026

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 🔴 High risk 1 closed / 3 findings

The parser and semantic API changes remove and replace public entry points, so downstream integrations could fail to compile or require migration.

Simplifies the parser interface by removing JParserConfig and the static and instance parse helpers in favor of the multi-file JParser.parse(Iterable<InputFile>, ...) API, with JParser.Mode now owning parser construction. Changes requested: the JParserTestUtils.parse helper in sonar-java-symbolic-execution will stop compiling on the java-frontend bump and the 8.47 Breaking notes omit the removed entry points, and the sonar.java.useJdkReleaseOption support from #6459 is lost or will conflict depending on merge order.

⚠️ Cross-Repo: SE test helper JParserTestUtils.parse stops compiling on java-frontend bump

📄 java-frontend/src/main/java/org/sonar/java/model/JParser.java:28-42 📄 sonar-java-plugin/src/main/resources/static/documentation.md:158-163

Fix here and in SonarSource/sonar-java-symbolic-execution

Breaks in: SonarSource/sonar-java-symbolic-execution - java-symbolic-execution/java-symbolic-execution-plugin/src/test/java/org/sonar/java/se/utils/JParserTestUtils.java - JParserTestUtils.parse

This PR deletes org.sonar.java.model.JParserConfig, which takes astParser() and MAXIMUM_SUPPORTED_JAVA_VERSION with it. It also removes the static JParser.parse(JParser, String, String, String) helper and the instance method parse(String, String, String). JParser is left with only the multi-file parse(Iterable<InputFile>, BooleanSupplier, AnalysisProgress, BiConsumer<InputFile, JParseResult>).

In SonarSource/sonar-java-symbolic-execution, JParserTestUtils.parse (java-symbolic-execution/java-symbolic-execution-plugin/src/test/java/org/sonar/java/se/utils/JParserTestUtils.java) still uses JParserConfig.MAXIMUM_SUPPORTED_JAVA_VERSION, JParserConfig.Mode.FILE_BY_FILE.create(...).astParser() and the static JParser.parse(parser, ...). When that repo upgrades its pinned java-frontend to a build that includes this change, the helper no longer compiles, and neither does any SE test that depends on it.

The removal is deliberate, so the SE repo is the side that has to move. Because only the InputFile-based API is left, its test module also needs a test-scoped sensor-test-fixtures dependency (the same one this PR adds to java-checks-common/pom.xml) or some other way to get an InputFile. The 8.47 notes in documentation.md don't name the removed JParserConfig#astParser(), the static JParser.parse(JParser, …), or the move of MAXIMUM_SUPPORTED_JAVA_VERSION.

Here: In the 8.47 Breaking notes, list the removed JParserConfig#astParser(), JParserConfig#parse(String, String) and static JParser.parse(JParser, String, String, String), and say that MAXIMUM_SUPPORTED_JAVA_VERSION now lives on JParser. Then tell sonar-java-symbolic-execution so it can migrate to the InputFile-based parse when it bumps java-frontend.

There: In JParserTestUtils.parse, remove the JParserConfig, astParser() and static JParser.parse usage. Wrap the source in a TestInputFileBuilder InputFile and call the multi-file parse on JParser.Mode.FILE_BY_FILE.create(version, classpath). Then add a test-scoped org.sonarsource.scanner.engine:sensor-test-fixtures dependency to the plugin's pom.

In SonarSource/sonar-java-symbolic-execution - java-symbolic-execution/java-symbolic-execution-plugin/src/test/java/org/sonar/java/se/utils/JParserTestUtils.java:

public static CompilationUnitTree parse(String unitName, String source, List<File> classpath) {
  JavaVersion version = JParser.MAXIMUM_SUPPORTED_JAVA_VERSION;
  InputFile inputFile = new TestInputFileBuilder("", unitName)
    .setContents(source).setCharset(StandardCharsets.UTF_8).build();
  List<JParseResult> results = new ArrayList<>();
  JParser.Mode.FILE_BY_FILE.create(version, classpath)
    .parse(List.of(inputFile), () -> false, new AnalysisProgress(1), (input, result) -> results.add(result));
  try {
    return results.getFirst().get();
  } catch (RuntimeException e) {
    throw e;
  } catch (Exception e) {
    throw new IllegalStateException("Unable to parse source", e);
  }
}
ℹ️ Cross-PR: JDK release-option support from #6459 is lost after JParserConfig removal

📄 java-frontend/src/main/java/org/sonar/java/jdt/JDTParser.java:63-77 📄 java-frontend/src/main/java/org/sonar/java/model/JParser.java:36-42

Breaks when this PR and #6459 both merge into the same line. Whichever lands second either fails to compile or silently drops the sonar.java.useJdkReleaseOption behaviour.

How

  1. #6459 adds a shouldUseJdkReleaseOption field, a four-argument Mode.create(...) and useReleaseApiOfConfiguredJdk(...) to JParserConfig (java-frontend/src/main/java/org/sonar/java/model/JParserConfig.java:141). It calls them from JavaFrontend.scanBatch and JavaAstScanner.scan.
  2. This PR deletes JParserConfig. Parser construction moves to JParser.Mode.create(JavaVersion, List<File>, boolean) (java-frontend/src/main/java/org/sonar/java/model/JParser.java:36-42) and JDTParser.create.
  3. JDTParser.jdtAstParser() (java-frontend/src/main/java/org/sonar/java/jdt/JDTParser.java:84-112) builds the ECJ environment from the raw classpath and never sets SystemReleaseClasspath.OPTION_RELEASE. If #6459's call sites are only ported to JParser.Mode, the parser keeps using the running JDK's API instead of the target release's.

Fix

  • This PR: If #6459 lands first, add the shouldUseJdkReleaseOption flag to JParser.Mode.create, JDTParser.create and the JDTParser constructor. Move useReleaseApiOfConfiguredJdk into JDTParser.jdtAstParser() and keep the JavaFrontend/JavaAstScanner wiring.
  • #6459: If this PR lands first, rebase onto JParser.Mode/JDTParser. Put the release-option logic in JDTParser.jdtAstParser() instead of JParserConfig.astParser(), and move the JParserConfigTest cases to JParserModeTest/JDTParserTest.

Compared 5006a8c with #6459 at 71f4165

✅ 1 closed
✅ Quality: 8.47 notes skip removed parser entry points and misstate the migration

📄 sonar-java-plugin/src/main/resources/static/documentation.md:158-163 📄 java-frontend/src/main/java/org/sonar/java/model/JParser.java:28-42
The rewritten 8.47 Breaking notes only mention that the parse(String version, String unitName, String source) overload is gone. This PR also removes other parser entry points that the earlier 8.47 notes advertised: the static JParser.parse(JParser, String, String, String), JParserConfig#astParser(), JParserConfig#parse(String unitName, String source), and the ParserConfigConstructor interface. MAXIMUM_SUPPORTED_JAVA_VERSION has moved to JParser, and the notes don't say that either. Line 162 also tells readers that "Code compiled against JParserConfig must be recompiled", but JParserConfig has been deleted, so that code has to be migrated, and recompiling alone fails. Existing consumers of these calls, such as JParserTestUtils.parse in sonar-java-symbolic-execution, are covered by the SE JParser dependency and the JParserConfig SE dependency notes, and they get no migration guidance. Fix: list the removed symbols, name JParser.MAXIMUM_SUPPORTED_JAVA_VERSION and JParser.Mode#create(...) plus the Iterable<InputFile> parse as the replacements, and replace the 'recompiled' sentence with a migration instruction.

🤖 Prompt for agents
Code Review: Simplifies the parser interface by removing `JParserConfig` and the static and instance `parse` helpers in favor of the multi-file `JParser.parse(Iterable<InputFile>, ...)` API, with `JParser.Mode` now owning parser construction. Changes requested: the `JParserTestUtils.parse` helper in sonar-java-symbolic-execution will stop compiling on the java-frontend bump and the 8.47 Breaking notes omit the removed entry points, and the `sonar.java.useJdkReleaseOption` support from #6459 is lost or will conflict depending on merge order.

1. ⚠️ Cross-Repo: SE test helper JParserTestUtils.parse stops compiling on java-frontend bump
   Files: java-frontend/src/main/java/org/sonar/java/model/JParser.java:28-42, sonar-java-plugin/src/main/resources/static/documentation.md:158-163

   **Fix here and in [`SonarSource/sonar-java-symbolic-execution`](https://github.com/SonarSource/sonar-java-symbolic-execution)**
   
   **Breaks in:** [`SonarSource/sonar-java-symbolic-execution`](https://github.com/SonarSource/sonar-java-symbolic-execution) - [`java-symbolic-execution/java-symbolic-execution-plugin/src/test/java/org/sonar/java/se/utils/JParserTestUtils.java`](https://github.com/SonarSource/sonar-java-symbolic-execution/blob/HEAD/java-symbolic-execution/java-symbolic-execution-plugin/src/test/java/org/sonar/java/se/utils/JParserTestUtils.java) - `JParserTestUtils.parse`
   
   This PR deletes `org.sonar.java.model.JParserConfig`, which takes `astParser()` and `MAXIMUM_SUPPORTED_JAVA_VERSION` with it. It also removes the static `JParser.parse(JParser, String, String, String)` helper and the instance method `parse(String, String, String)`. `JParser` is left with only the multi-file `parse(Iterable<InputFile>, BooleanSupplier, AnalysisProgress, BiConsumer<InputFile, JParseResult>)`.
   
   In SonarSource/sonar-java-symbolic-execution, `JParserTestUtils.parse` (`java-symbolic-execution/java-symbolic-execution-plugin/src/test/java/org/sonar/java/se/utils/JParserTestUtils.java`) still uses `JParserConfig.MAXIMUM_SUPPORTED_JAVA_VERSION`, `JParserConfig.Mode.FILE_BY_FILE.create(...).astParser()` and the static `JParser.parse(parser, ...)`. When that repo upgrades its pinned java-frontend to a build that includes this change, the helper no longer compiles, and neither does any SE test that depends on it.
   
   The removal is deliberate, so the SE repo is the side that has to move. Because only the `InputFile`-based API is left, its test module also needs a test-scoped `sensor-test-fixtures` dependency (the same one this PR adds to `java-checks-common/pom.xml`) or some other way to get an `InputFile`. The 8.47 notes in `documentation.md` don't name the removed `JParserConfig#astParser()`, the static `JParser.parse(JParser, …)`, or the move of `MAXIMUM_SUPPORTED_JAVA_VERSION`.
   
   **Here:** In the 8.47 Breaking notes, list the removed `JParserConfig#astParser()`, `JParserConfig#parse(String, String)` and static `JParser.parse(JParser, String, String, String)`, and say that `MAXIMUM_SUPPORTED_JAVA_VERSION` now lives on `JParser`. Then tell sonar-java-symbolic-execution so it can migrate to the `InputFile`-based `parse` when it bumps java-frontend.
   
   **There:** In `JParserTestUtils.parse`, remove the `JParserConfig`, `astParser()` and static `JParser.parse` usage. Wrap the source in a `TestInputFileBuilder` InputFile and call the multi-file `parse` on `JParser.Mode.FILE_BY_FILE.create(version, classpath)`. Then add a test-scoped `org.sonarsource.scanner.engine:sensor-test-fixtures` dependency to the plugin's pom.
   
   In SonarSource/sonar-java-symbolic-execution - `java-symbolic-execution/java-symbolic-execution-plugin/src/test/java/org/sonar/java/se/utils/JParserTestUtils.java`:
   
   ````
   public static CompilationUnitTree parse(String unitName, String source, List<File> classpath) {
     JavaVersion version = JParser.MAXIMUM_SUPPORTED_JAVA_VERSION;
     InputFile inputFile = new TestInputFileBuilder("", unitName)
       .setContents(source).setCharset(StandardCharsets.UTF_8).build();
     List<JParseResult> results = new ArrayList<>();
     JParser.Mode.FILE_BY_FILE.create(version, classpath)
       .parse(List.of(inputFile), () -> false, new AnalysisProgress(1), (input, result) -> results.add(result));
     try {
       return results.getFirst().get();
     } catch (RuntimeException e) {
       throw e;
     } catch (Exception e) {
       throw new IllegalStateException("Unable to parse source", e);
     }
   }
   ````

2. ℹ️ Cross-PR: JDK release-option support from [#6459](<https://github.com/SonarSource/sonar-java/pull/6459>) is lost after JParserConfig removal
   Files: java-frontend/src/main/java/org/sonar/java/jdt/JDTParser.java:63-77, java-frontend/src/main/java/org/sonar/java/model/JParser.java:36-42

   **Breaks when** this PR and [#6459](<https://github.com/SonarSource/sonar-java/pull/6459>) both merge into the same line. Whichever lands second either fails to compile or silently drops the `sonar.java.useJdkReleaseOption` behaviour.
   
   **How**
   
   1. [#6459](<https://github.com/SonarSource/sonar-java/pull/6459>) adds a `shouldUseJdkReleaseOption` field, a four-argument `Mode.create(...)` and `useReleaseApiOfConfiguredJdk(...)` to `JParserConfig` (`java-frontend/src/main/java/org/sonar/java/model/JParserConfig.java:141`). It calls them from `JavaFrontend.scanBatch` and `JavaAstScanner.scan`.
   2. This PR deletes `JParserConfig`. Parser construction moves to `JParser.Mode.create(JavaVersion, List<File>, boolean)` (`java-frontend/src/main/java/org/sonar/java/model/JParser.java:36-42`) and `JDTParser.create`.
   3. `JDTParser.jdtAstParser()` (`java-frontend/src/main/java/org/sonar/java/jdt/JDTParser.java:84-112`) builds the ECJ environment from the raw classpath and never sets `SystemReleaseClasspath.OPTION_RELEASE`. If [#6459](<https://github.com/SonarSource/sonar-java/pull/6459>)'s call sites are only ported to `JParser.Mode`, the parser keeps using the running JDK's API instead of the target release's.
   
   **Fix**
   
   - **This PR:** If [#6459](<https://github.com/SonarSource/sonar-java/pull/6459>) lands first, add the `shouldUseJdkReleaseOption` flag to `JParser.Mode.create`, `JDTParser.create` and the `JDTParser` constructor. Move `useReleaseApiOfConfiguredJdk` into `JDTParser.jdtAstParser()` and keep the `JavaFrontend`/`JavaAstScanner` wiring.
   - **[#6459](<https://github.com/SonarSource/sonar-java/pull/6459>):** If this PR lands first, rebase onto `JParser.Mode`/`JDTParser`. Put the release-option logic in `JDTParser.jdtAstParser()` instead of `JParserConfig.astParser()`, and move the `JParserConfigTest` cases to `JParserModeTest`/`JDTParserTest`.
   
   _Compared `5006a8c` with [#6459](<https://github.com/SonarSource/sonar-java/pull/6459>) at `71f4165`_

Verification Rules 1/1 met Knowledge 🔎 2 Repos 4 inspected · PRs 2 inspected

Functional validation No results

Rules 1 passed 3 not applicable

✅ Repository license compliance

Knowledge 🔎 2 informed a finding

🔎 JParser.parse(String version, String unitName, String source) / JParserConfig.Mode.create(...).astParser() / static JParser.parse(...): dependency with SonarSource/sonar-java-symbolic-execution informed a finding, resolved -> 8.47 notes skip removed parser entry points and misstate the migration
🔎 org.sonar.java.model.JParserConfig / static JParser.parse(JParser, String, String, String) / JParserConfig.Mode.create(...).astParser(): dependency with SonarSource/sonar-java-symbolic-execution informed a finding, resolved -> 8.47 notes skip removed parser entry points and misstate the migration

Broader impact Repos 4 inspected PRs 2 inspected
Cross-repo 4 repositories inspected 1 open impact

SonarSource/sonarlint-vscode Inspected
SonarSource/sonarlint-intellij Inspected
SonarSource/sonarlint-eclipse Inspected
SonarSource/sonar-java-symbolic-execution Inspected

Cross-PR 2 PRs inspected 1 open impact

PR 6485: SONARJAVA-7300 Decouple the Sonar Java frontend from Eclipse JDT core Inspected
PR 6459: SONARJAVA-7279 Resolve the JDK API of the target release through the new jdt-package option Inspected

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.
Unblock → Override a blocking verdict and allow merging.

Comment with these commands to change the behavior for this request:

Auto-apply Compact Unblock
gitar auto-apply:on         
gitar display:verbose         
gitar unblock         

Was this helpful? React with 👍 / 👎 | Gitar

@aurelien-coet-sonarsource
aurelien-coet-sonarsource merged commit 0b46bcc into master Nov 18, 2026
18 checks passed
@aurelien-coet-sonarsource
aurelien-coet-sonarsource deleted the simplify-parser branch November 18, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants