Repository navigation
Conversation
ec0a1c5 to
6ea490c
Compare
6ea490c to
0d30589
Compare
e1dd447 to
7f19e82
Compare
7f19e82 to
1feaaeb
Compare
1feaaeb to
556a74d
Compare
556a74d to
db43847
Compare
0b15779 to
b267f48
Compare
b267f48 to
04712e9
Compare
04712e9 to
1230f53
Compare
…version of major 2
… instead of a round trip
476c2ff to
a5e6114
Compare
|
Code Review ✅ Approved 🟡 Medium risk 8 closed / 8 findingsThe new SemSitter subprocess client adds non-trivial protocol and document handling, but no callers are added, limiting its current runtime impact. Adds the ✅ 8 closed✅ Bug: getFile/getTypes bypass the lock that send() takes
✅ Bug: License-check and dogfooding builds don't install analyzer-wire
✅ Edge Case: Truncated payload is accepted without a length check
✅ Edge Case: Unlimited protobuf recursion turns deep trees into StackOverflowError
✅ Quality: ProtocolTest tests delimited framing, which the client never uses
...and 3 more closed from earlier reviews Verification Rules 3/3 met Knowledge ✅ 1 Repos 4 inspected · PRs 4 inspectedFunctional validation No results Rules 3 passed
Broader impact Repos 4 inspected PRs 4 inspectedCross-repo 4 repositories inspected 0 open impacts
Cross-PR 4 PRs 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 |
david-schroeter
left a comment
There was a problem hiding this comment.
Thanks for this PR!
I left a few comments that I think should be addressed before merging.
| JsonObject values = new JsonObject(); | ||
| settings.forEach((key, list) -> { | ||
| JsonArray array = new JsonArray(); | ||
| list.forEach(array::add); | ||
| values.add(key, array); | ||
| }); |
There was a problem hiding this comment.
| JsonObject values = new JsonObject(); | |
| settings.forEach((key, list) -> { | |
| JsonArray array = new JsonArray(); | |
| list.forEach(array::add); | |
| values.add(key, array); | |
| }); | |
| var gson = new Gson(); | |
| gson.toJsonTree(settings); |
Here could we use the suggested Gson library to transform the map into a JsonElement? I think that would avoid boilerplate code and make it easier to understand the implementation.
The same logic could be applied to the other methods in the class that creates JsonElement.
| return line.toString(StandardCharsets.UTF_8); | ||
| } | ||
|
|
||
| private static final class Answer { |
There was a problem hiding this comment.
Nit: Could Answer be transformed into a record? It just carries header and payload.
| return id; | ||
| } | ||
|
|
||
| private synchronized Answer exchange(JsonObject request) throws IOException { |
There was a problem hiding this comment.
Can exchange and quit be called from different threads? It looks like the usage is sequential so I'm wondering if there is a concurrent case where the synchronized is required or if it could be dropped?
|
|
||
| private final Process process; | ||
| private final BufferedWriter toServer; | ||
| private final InputStream fromServer; |
There was a problem hiding this comment.
The fromServer InputStream is never closed. Could we explicitly close it in the close() method maybe?
| JsonArray array = new JsonArray(); | ||
| names.forEach(array::add); | ||
| request.add("names", array); | ||
| Map<String, Boolean> found = new LinkedHashMap<>(); |
There was a problem hiding this comment.
Nit: Is preserving the server’s response order intentional here? If callers aren’t meant to rely on it, could we use a simple HashMap?
| * Drives the real udg-java-server, whose path is given by {@code -Dsemsitter.executable}. | ||
| */ | ||
| @EnabledIfSystemProperty(named = "semsitter.executable", matches = ".+") | ||
| class SemSitterClientE2ETest { |
There was a problem hiding this comment.
This test is currently only run on the user machine if we properly configure the semsitter.executable property. Would there be a possibility to add this test as part of the CI run to ensure that we actually run against the real semsitter version we intend to ship and ensure that everything works as expected?
| return client; | ||
| } | ||
|
|
||
| static List<String> command(List<String> launcher, Path projectRoot) { |
There was a problem hiding this comment.
Nit: Could we rename this method to buildServerCommand? That would make it clearer what the returned arguments are for.




Part 2 of 17 of JAVA-7392. Ticket: JAVA-7394.
Intent
Add the new
java-frontend-semsittermodule and the client that talks to the SemSitter server. Nothing calls it yet.org.sonarsource.semsitter:analyzer-wire, declared in the module only, at any version of major 2 ([2,3-alpha), which also excludes the pre-releases of 3). It is built withbuild-mavenand promoted by SonarSource/semsitter#5821ProtocolTestchecks that the wire classes still read a document written by the real server (a snapshot)sonarsourcevirtual repository on Repox, so CI needs no install stepState on master
Nothing in the plugin calls the client. ECJ parses exactly as today.
Test plan
SemSitterClientTestagainst an in-process fake server: every command, errors, malformed answers, nested documents, and a close that never waits on an unanswered quitProtocolTestreads a snapshot of a real server document,SemSitterClientTeston the framing (header, payload size, truncation, depth limit)SemSitterClientE2ETestruns only with-Dsemsitter.executable