Skip to content

DO NOT MERGE SONARJAVA-7339 Test the SemSitter frontend with PVF - #6548

Draft
rombirli wants to merge 3 commits into
rombirli/semsitter-recorded-documentsfrom
rombirli/semsitter-frontend-default-on
Draft

rombirli wants to merge 3 commits into
rombirli/semsitter-recorded-documentsfrom
rombirli/semsitter-frontend-default-on

Conversation

@rombirli

@rombirli rombirli commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #6555. Do not merge. Throw away after the PVF smoke test.

Summary

  • Flip the feature flag default to on, so an analysis that knows a SemSitter executable parses with SemSitter
  • Bundle the Linux SemSitter server for PVF runners that have no executable, and raise the plugin jar size limit so it fits
  • Use that bundled server only during PVF

The translator that has to be reviewed and merged is #6553. The recorded server answers it replays are #6555.

Test plan

  • PVF on this PR uses the SemSitter frontend
  • Drop these three commits before anything merges

Summary by Gitar

  • Flag default:
    • Flipped FLAG_DEFAULT to true so SemSitter is used whenever an executable is known
    • Flag service failures now fall back to the flag default instead of disabling SemSitter
  • Bundled server:
    • Added BundledServer to use the Linux SemSitter server when no executable is configured
  • Parser:
    • Translation now runs SemSitterTranslator::translate and reports syntax errors with line and column
  • Build:
    • Raised requireFilesSize maxsize in sonar-java-plugin/pom.xml to 50000000 to fit the bundled server
  • Enum constants:
    • Kept enum constant constructors and annotation values as ECJ provides them in AnnotationValueImpl

This will update automatically on new commits.

public static final String EXECUTABLE_ENVIRONMENT = "SEMSITTER_ANALYZER";
public static final String CLIENT_ID_ENVIRONMENT = "SONAR_JAVA_LAUNCHDARKLY_CLIENT_ID";
static final boolean FLAG_DEFAULT = false;
static final boolean FLAG_DEFAULT = true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Quality: Failure log and Javadoc still say the default frontend is used

Now that FLAG_DEFAULT is true, isFlagOn returns true when LaunchDarkly can't be reached (line 90), so SemSitter is the frontend that runs. The warning on line 89 still says "the default frontend is used", which is the opposite of what happens. The class Javadoc (line 35) also still says "Anything that goes wrong while asking leaves the default frontend in use". Anyone reading the logs or the docs during a ruling or CI run will get the wrong idea about which parser handled the analysis. The test name without_property_nor_client_id_the_default_frontend_stays (test line 111) has the same problem, since with no client id the provider now turns SemSitter on. Fix: build the log message and Javadoc from FLAG_DEFAULT, or reword them to be neutral, and rename the test.

Make the warning match what actually happens, whatever the default value is:

LOG.warn("The SemSitter frontend flag could not be read, it defaults to {}: {}", FLAG_DEFAULT ? "on" : "off", e.getMessage());
  • Apply fix

Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎

@datadog-sonarsource

This comment has been minimized.

@rombirli
rombirli added this pull request to stack #6543 November 20, 2026 10:19
@rombirli
rombirli force-pushed the rombirli/semsitter-frontend-default-on branch from 088ea84 to d79893d Compare November 20, 2026 10:29
@rombirli
rombirli force-pushed the rombirli/semsitter-frontend-default-on branch from d79893d to 6bba146 Compare November 20, 2026 10:58
@rombirli
rombirli force-pushed the rombirli/semsitter-frontend-default-on branch from 6bba146 to b655d0a Compare November 20, 2026 11:25
@rombirli rombirli changed the title DO NOT MERGE SONARJAVA-7339 Use the SemSitter frontend by default DO NOT MERGE SONARJAVA-7339 Test the SemSitter frontend with PVF Nov 20, 2026
@rombirli

Copy link
Copy Markdown
Contributor Author

/pvf

@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

📊 Performance Validation complete
🆕 71268 new · 🗑️ 1058705 lost issues
View dashboard

Projects with unexpected PVF results:

  • com.redhat.lightblue-lightblue-core-pom
  • es.usc.citius.hipster-hipster-pom
  • gatherers4j
  • guava
  • guava_java9
  • kafka
  • netflix-conductor
  • org.activiti-activiti-root
  • org.apache.wicket-wicket-parent
  • redisson
  • rxjava

@rombirli
rombirli force-pushed the rombirli/semsitter-frontend-default-on branch from 439646f to 4db55e1 Compare November 20, 2026 15:48
@rombirli

Copy link
Copy Markdown
Contributor Author

/pvf

@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

📊 Performance Validation complete
🆕 12055 new · 🗑️ 403740 lost issues
View dashboard

Projects with unexpected PVF results:

  • org.apache.jackrabbit-jackrabbit
  • tomcat8

@rombirli
rombirli force-pushed the rombirli/semsitter-frontend-default-on branch 2 times, most recently from 1469939 to 721888f Compare November 23, 2026 07:31
@rombirli
rombirli removed this pull request from stack #6543 November 23, 2026 07:33
@rombirli
rombirli changed the base branch from rombirli/semsitter-frontend-switch to rombirli/semsitter-frontend-translator November 23, 2026 07:33
@rombirli
rombirli added this pull request to stack #6554 November 23, 2026 07:33
@rombirli
rombirli force-pushed the rombirli/semsitter-frontend-default-on branch from 721888f to 32b76cf Compare November 23, 2026 07:42
@rombirli
rombirli removed this pull request from stack #6554 November 23, 2026 07:43
@rombirli
rombirli changed the base branch from rombirli/semsitter-frontend-translator to rombirli/semsitter-recorded-documents November 23, 2026 07:43
@rombirli
rombirli added this pull request to stack #6556 November 23, 2026 07:43
@rombirli

Copy link
Copy Markdown
Contributor Author

/pvf

@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

📊 Performance Validation complete
🆕 13355 new · 🗑️ 6864 lost issues
View dashboard

@rombirli
rombirli force-pushed the rombirli/semsitter-frontend-default-on branch from 32b76cf to a010d0f Compare November 24, 2026 08:31
@rombirli

Copy link
Copy Markdown
Contributor Author

/pvf

@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

⚠️ Performance Validation finished without publishing a dashboard. See run logs.

Projects with unexpected PVF results:

  • org.sonarsource.update-center-sonar-update-center
  • org.sonarsource.widget-lab-sonar-widget-lab-plugin

1 similar comment
@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

⚠️ Performance Validation finished without publishing a dashboard. See run logs.

Projects with unexpected PVF results:

  • org.sonarsource.update-center-sonar-update-center
  • org.sonarsource.widget-lab-sonar-widget-lab-plugin

@rombirli

Copy link
Copy Markdown
Contributor Author

/pvf

@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

📊 Performance Validation complete
🆕 13355 new · 🗑️ 6864 lost issues
View dashboard

…xecutable is known

The flag default flips to on, so an analysis with a SemSitter executable parses with SemSitter
unless the flag or sonar.java.semsitter.enabled turns it off.
…uses that frontend

The performance validation runners have no SemSitter executable. This build ships
the protocol 2 Linux server and turns the frontend on when no path is configured.
…ing PVF

Other Linux analyses, including ruling, stay on the default frontend.
@rombirli
rombirli force-pushed the rombirli/semsitter-frontend-default-on branch from a010d0f to 6961f1a Compare November 25, 2026 19:06
@gitar-bot

gitar-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
CI failed: The ruling update job failed because the upstream ruling QA result was cancelled, so it found zero artifacts to download. The analyzer states the cancellation cause is not shown in the log and found no link to this PR's SemSitter frontend changes, so the failure is classed as unrelated to the change.

Overview

The ruling update job failed because the upstream ruling QA result was cancelled, so it found zero artifacts to download. The analyzer states the cancellation cause is not shown in the log and found no link to this PR's SemSitter frontend changes, so the failure is classed as unrelated to the change.

Failures

Ruling update failed: no ruling artifacts found after upstream ruling QA was cancelled

  • Type: infrastructure
  • Affected jobs: 139444525816
  • Related to change: no
  • Confidence: high
  • Root cause: The log explicitly reports Ruling QA result: cancelled and later Found 0 artifact(s), followed by No artifacts were downloaded (directory does not exist). The ruling-update action then failed during artifact synchronization; the commit and comment steps were skipped. The log does not explain why ruling QA was cancelled. The PR changes the SemSitter frontend and bundled server, but the supplied evidence does not connect those changes to this cancellation or the missing artifacts.
  • Suggested fix: Determine why the ruling QA jobs were cancelled and rerun them so they can upload the expected artifacts. Consider making the ruling-update workflow skip artifact synchronization when its upstream QA result is cancelled.

Summary

  • Change-related failures: 0
  • Infrastructure/flaky failures: 1
  • Recommended action: Determine why the ruling QA jobs were cancelled and rerun them so they can upload the expected artifacts. Consider making the ruling-update workflow skip artifact synchronization when its upstream QA result is cancelled.
Code Review 👍 Approved with suggestions 🟡 Medium risk 3 closed / 4 findings

Enabling SemSitter by default when an executable is available could change parsing and resulting Java analysis findings.

Flips the SemSitter feature flag default to on and bundles the Linux SemSitter server for PVF runs, so analyses with a known executable parse with SemSitter. Approved with suggestions: the failure log and Javadoc in SemSitterParserProvider still say the default frontend is used, which is now wrong when LaunchDarkly is unreachable, and the test without_property_nor_client_id_the_default_frontend_stays should be renamed to match.

💡 Quality: Failure log and Javadoc still say the default frontend is used

📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:33-35 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:45 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:89-90 📄 java-frontend-semsitter/src/test/java/org/sonar/java/semsitter/SemSitterParserProviderTest.java:111-116 📄 java-frontend-semsitter/src/test/java/org/sonar/java/semsitter/SemSitterParserProviderTest.java:114-120 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:47 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:87-89

Now that FLAG_DEFAULT is true, isFlagOn returns true when LaunchDarkly can't be reached (line 90), so SemSitter is the frontend that runs. The warning on line 89 still says "the default frontend is used", which is the opposite of what happens. The class Javadoc (line 35) also still says "Anything that goes wrong while asking leaves the default frontend in use". Anyone reading the logs or the docs during a ruling or CI run will get the wrong idea about which parser handled the analysis. The test name without_property_nor_client_id_the_default_frontend_stays (test line 111) has the same problem, since with no client id the provider now turns SemSitter on. Fix: build the log message and Javadoc from FLAG_DEFAULT, or reword them to be neutral, and rename the test.

Make the warning match what actually happens, whatever the default value is
LOG.warn("The SemSitter frontend flag could not be read, it defaults to {}: {}", FLAG_DEFAULT ? "on" : "off", e.getMessage());
✅ 3 closed
✅ Bug: Static on-demand import flagged unused when only inherited members used

📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/CompilerWarnings.java:670-672 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/CompilerWarnings.java:676-685 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/CompilerWarnings.java:710-718 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/CompilerWarnings.java:566-568
With this PR the SemSitter frontend is on by default, so CompilerWarnings now produces the UNUSED_IMPORT warnings that S1128 reads. For a single static import, uses() calls isMemberOf, which also accepts members the imported type inherits. For a static on-demand import it calls declaredIn, which only accepts a member whose owner is exactly the imported type (line 717). Take import static org.mockito.Mockito.*; in a file that only calls any() or eq(). Those methods are declared in ArgumentMatchers, which Mockito extends, so the import gets a false 'never used' warning. ECJ does not report this. Fix: in the static, non-type branch of declaredIn, use the same inheritance-aware check as isMemberOf.

✅ Bug: Type-import-on-demand counted as used by types from subpackages

📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/CompilerWarnings.java:719-723
For a non-static on-demand import, declaredIn treats the import as used whenever the type's dotted name starts with qualifier + "." (line 723). It never checks that the type sits directly in that package or type, while the static branch above it does (line 715). So import java.util.*; import java.util.concurrent.ConcurrentHashMap; with only new ConcurrentHashMap<>() in the body marks java.util.* as used: java.util.concurrent.ConcurrentHashMap starts with java.util.. The unused import is then never reported, and S1128 misses an issue ECJ would raise. Fix: also require that no further . follows the qualifier, as the static branch does.

✅ Bug: JSymbol equals/hashCode contract violated for id-less symbols

📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/JSymbol.java:133-147 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterTranslator.java:2241
When one of the two symbols has no id, JSymbol.equals compares them by name and owner (lines 141-144). hashCode still hashes id when it is present and name otherwise (line 150). Production code does create id-less symbols, for example the unresolved JMethodSymbol(sema, null, name) in SemSitterTranslator line 2241 and the sema's unknownSymbol. An id-less symbol can therefore equal a symbol whose id is set while having a different hash code. That breaks the Object.hashCode contract and gives inconsistent results in HashMap/HashSet lookups. Fix: base hashCode only on fields that equals always compares, such as kind and name.

🤖 Prompt for agents
Code Review: Flips the SemSitter feature flag default to on and bundles the Linux SemSitter server for PVF runs, so analyses with a known executable parse with SemSitter. Approved with suggestions: the failure log and Javadoc in `SemSitterParserProvider` still say the default frontend is used, which is now wrong when LaunchDarkly is unreachable, and the test `without_property_nor_client_id_the_default_frontend_stays` should be renamed to match.

1. 💡 Quality: Failure log and Javadoc still say the default frontend is used
   Files: java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:33-35, java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:45, java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:89-90, java-frontend-semsitter/src/test/java/org/sonar/java/semsitter/SemSitterParserProviderTest.java:111-116, java-frontend-semsitter/src/test/java/org/sonar/java/semsitter/SemSitterParserProviderTest.java:114-120, java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:47, java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:87-89

   Now that `FLAG_DEFAULT` is `true`, `isFlagOn` returns `true` when LaunchDarkly can't be reached (line 90), so SemSitter is the frontend that runs. The warning on line 89 still says "the default frontend is used", which is the opposite of what happens. The class Javadoc (line 35) also still says "Anything that goes wrong while asking leaves the default frontend in use". Anyone reading the logs or the docs during a ruling or CI run will get the wrong idea about which parser handled the analysis. The test name `without_property_nor_client_id_the_default_frontend_stays` (test line 111) has the same problem, since with no client id the provider now turns SemSitter on. Fix: build the log message and Javadoc from `FLAG_DEFAULT`, or reword them to be neutral, and rename the test.

   Fix (Make the warning match what actually happens, whatever the default value is):
   LOG.warn("The SemSitter frontend flag could not be read, it defaults to {}: {}", FLAG_DEFAULT ? "on" : "off", e.getMessage());

Verification Rules 3/3 met Repos 5 inspected · PRs 2 inspected

Functional validation No results

Rules 3 passed 2 not applicable

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

Broader impact Repos 5 inspected PRs 2 inspected
Cross-repo 5 repositories inspected 0 open impacts

SonarSource/sonar-iac Inspected
SonarSource/sonarlint-vscode Inspected
SonarSource/sonar-lits Inspected
SonarSource/sonarlint-intellij Inspected
SonarSource/sonarlint-eclipse Inspected

Cross-PR 2 PRs inspected 0 open impacts

PR 6547: SONARJAVA-7339 Make the Java frontend switchable between ECJ and SemSitter Inspected
PR 6542: SONARJAVA-7339 Add the SemSitter server client 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

@rombirli

Copy link
Copy Markdown
Contributor Author

/pvf

@sonarqube-next

Copy link
Copy Markdown
Contributor

Quality Gate failed Quality Gate failed

Failed conditions
305 New issues
27.2% Coverage on New Code (required ≥ 90%)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE SonarQube for IDE

@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

📊 Performance Validation complete
🆕 13355 new · 🗑️ 6861 lost issues
View dashboard

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 7 days with no activity. If there is no activity in the next 7 days it will be closed automatically

@github-actions github-actions Bot added the stale label Dec 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant