Repository navigation
JAVA-7407 DO NOT MERGE Log how long the SemSitter graph build takes - #6610
leo-geoffroy-sonarsource wants to merge 31 commits into
Conversation
The server now names the type of an array parameter, result or field with an array term, java::byte[], instead of the written byte[]. Read the element of the term so these types keep the name of the array the code declares; a hashed term spells no element and stays unknown.
…ed fields When the enclosing class has a supertype the server cannot read, it leaves the names a static import brings in unresolved. Look the name up as a field of the enclosing types first, since a declared or inherited field shadows a static import, then as a static field of the single static import, then of each static import on demand, as ECJ does.
…he replay goldens
…ate the replay goldens
…of SonarQube Cloud
…is on, and fail when no server is known
…SonarQube Cloud use that frontend
…x-only bundled server
SemSitterParser now logs one INFO line per server it opens, with the time spent listing the graph files, starting the server, sending the settings and running full-gen, plus what the server reports for full-gen: its own elapsed time, the files it failed to scan and its peak RSS. The client used to drop those fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code Review 👍 Approved with suggestions 🔴 High risk 0 closed / 1 findingsChanging public SemSitterApi.fullGen from int to FullGenStats breaks existing callers and implementations compiled against the old signature. Adds an INFO log line to One open minor finding: 💡 Edge Case: Malformed optional full-gen measure escapes as raw RuntimeException📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterClient.java:116-125 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParser.java:169 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParser.java:177-181
Treat a measure that is not a number as unreported, so a diagnostic-only field cannot fail the analysis.🤖 Prompt for agentsVerification Rules 3/3 met Knowledge 🔎 1 Repos 4 inspected · PRs 2 inspectedFunctional validation No results Rules 3 passed 2 not applicable
Knowledge 🔎 1 informed a finding
Broader impact Repos 4 inspected PRs 2 inspectedCross-repo 4 repositories inspected 0 open impacts
Auto-approval Not enabledFor more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
| JsonObject header = send(request); | ||
| return new FullGenStats(header.get("files").getAsInt(), longOrNull(header, "elapsed_ms"), longOrNull(header, "failures"), | ||
| longOrNull(header, "peak_rss_kb")); | ||
| } | ||
|
|
||
| @Nullable | ||
| private static Long longOrNull(JsonObject header, String name) { | ||
| JsonElement value = header.get(name); | ||
| return value == null || value.isJsonNull() ? null : value.getAsLong(); | ||
| } |
There was a problem hiding this comment.
💡 Edge Case: Malformed optional full-gen measure escapes as raw RuntimeException
longOrNull runs in fullGen after send(...) has returned, so it is outside the try in exchange() that turns runtime parse failures into IOException("SemSitter server sent a malformed answer: ..."). If the server sends a value that is not a number for elapsed_ms, failures or peak_rss_kb (for example a string like "abc", an object or an array), getAsLong() throws a raw NumberFormatException, IllegalStateException or UnsupportedOperationException. That breaks the contract that malformed answers become IOExceptions. It also means a measure that only feeds a log line aborts the whole analysis: open() wraps the exception as "The SemSitter server could not start". The fix is to parse the optional measures leniently and return null when a value is not a number, or to wrap the failure as an IOException the way exchange does.
Treat a measure that is not a number as unreported, so a diagnostic-only field cannot fail the analysis.:
@Nullable
private static Long longOrNull(JsonObject header, String name) {
JsonElement value = header.get(name);
if (value == null || !value.isJsonPrimitive() || !value.getAsJsonPrimitive().isNumber()) {
return null;
}
return value.getAsLong();
}
Was this helpful? React with 👍 / 👎
|
74dcfab to
334ede0
Compare



Stacked on #6584. Experiment only, used to measure the UDG build in the A3S benchmarks on Dev22.
SemSitterParsernow logs one INFO line each time it opens a server:elapsed_ms,failuresandpeak_rss_kbfields of the server's full-gen answer, which the client used to drop. Shown asn/awhen the server leaves them out.To carry these fields,
SemSitterApi.fullGennow returns aFullGenStatsrecord instead of anint.Tests: the 591 tests of
org.sonar.java.semsitterpass locally (3 skipped, which need the Linux server).🤖 Generated with Claude Code