Skip to content

JAVA-7383 Add a static helper parsing method for single files - #6559

Merged
aurelien-coet-sonarsource merged 3 commits into
masterfrom
ac/expand-parser-api
Nov 23, 2026
Merged

aurelien-coet-sonarsource merged 3 commits into
masterfrom
ac/expand-parser-api

Conversation

@aurelien-coet-sonarsource

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

Copy link
Copy Markdown
Contributor

Summary by Gitar

  • New API:
    • Added static JParser.parse(InputFile, List<File>, JavaVersion) returning a file's CompilationUnitTree, wrapping checked exceptions in IllegalStateException and rethrowing runtime exceptions unchanged
  • Tests:
    • Added JParserTest cases for empty and supplied classpaths, Java version selection, syntax errors, and file-read failures
  • Refactoring:
    • Switched JParserTestUtils helper to call the new JParser.parse method
  • Documentation:
    • Documented single-file migration path and the new method in documentation.md

This will update automatically on new commits.

@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title Add a static helper parsing method for single files JAVA-7383 Add a static helper parsing method for single files Nov 23, 2026
@hashicorp-vault-sonar-prod

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

Copy link
Copy Markdown
Contributor

JAVA-7383

@datadog-sonarsource

This comment has been minimized.

@gitar-bot

gitar-bot Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
CI failed: Two CI jobs failed during SonarQube analysis because the scanner timed out downloading its provisioned analysis JRE from the SonarQube server. Both are classified as infrastructure or network issues, and the supplied evidence does not connect them to this PR's single-file parsing helper changes, though the diagnosis is not fully confirmed.

Overview

Two CI jobs failed during SonarQube analysis because the scanner timed out downloading its provisioned analysis JRE from the SonarQube server. Both are classified as infrastructure or network issues, and the supplied evidence does not connect them to this PR's single-file parsing helper changes, though the diagnosis is not fully confirmed.

Failures

SonarScanner JRE download from SonarQube timed out (infrastructure, not related to PR)

  • Type: infrastructure
  • Affected jobs: 137803955926, 137821989241
  • Related to change: no
  • Confidence: high
  • Root cause: The Sonar Maven plugin failed while requesting /api/v2/analysis/jres/f4e17091-1dca-4306-8447-a68248805664; the request timed out and the response stream closed. This is an infrastructure/network or server-side JRE download failure, not a source compilation or test failure. The PR adds a single-file parsing helper and related tests; the supplied change evidence does not connect those changes to scanner JRE provisioning.
  • Root cause: The Sonar Maven scanner timed out downloading the analysis JRE from the SonarQube server endpoint /api/v2/analysis/jres/...; the underlying cause was java.net.http.HttpTimeoutException: request timed out (logged at 15:01:40). This indicates a server, network, or JRE-provisioning availability issue, not a parser test or compilation failure. The PR adds a static single-file parsing helper, and the supplied evidence does not connect that change to the scanner’s failed HTTP request.
  • Suggested fix: Retry the analysis after checking SonarQube server availability and connectivity to the analysis-JRE download endpoint. If the timeout persists, investigate server-side JRE provisioning or network transfer limits.
  • Suggested fix: Retry the analysis and check SonarQube server availability and network connectivity for the JRE provisioning endpoint. If the timeout recurs, investigate server-side download latency or scanner JRE provisioning configuration.

Summary

  • Change-related failures: 0
  • Infrastructure/flaky failures: 1
  • Recommended action: Retry the analysis after checking SonarQube server availability and connectivity to the analysis-JRE download endpoint. If the timeout persists, investigate server-side JRE provisioning or network transfer limits.
Code Review ✅ Approved 🟡 Medium risk

The new single-file parsing API wraps checked failures as IllegalStateException, so callers may see unchecked parse or file-read failures.

Adds a static JParser.parse(InputFile, List<File>, JavaVersion) helper that returns a single file's CompilationUnitTree, wrapping checked exceptions in IllegalStateException, with tests covering classpath, Java version, syntax error, and read failure cases. No issues found.

Verification Rules 3/3 met Repos 1 inspected

Functional validation No results

Rules 3 passed 2 not applicable

✅ Internal artifact registries
✅ Release secrets usage
✅ Repository license compliance

Broader impact Repos 1 inspected
Cross-repo 1 repository inspected 0 open impacts

SonarSource/sonar-java-symbolic-execution Inspected

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Tip

Comment Gitar fix CI or enable auto-apply: gitar auto-apply:on

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

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

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

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqube-next

Copy link
Copy Markdown
Contributor

@aurelien-coet-sonarsource
aurelien-coet-sonarsource merged commit 7fb9159 into master Nov 23, 2026
43 of 45 checks passed
@aurelien-coet-sonarsource
aurelien-coet-sonarsource deleted the ac/expand-parser-api branch November 23, 2026 16:33
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