Repository navigation
Conversation
Main sources still compile against empty trees and symbols. Tests are expected to fail until a semsitter parser fills them in.
Run one SemSitter scan (with the classpath) and its semantic dump over the batch, then parse each file with tree-sitter-java and attach symbols, resolved occurrences, graph call targets and graph facts by byte span.
…uery it Rust: a serve mode answering analyze, cst, parse and quit requests, and cst and parse commands printing the CST of files. Java: SemsitterBridge client.
… wire the parser
A new expression whose type reference is not a constructor used to leave a class or enum-field symbol on the identifier, and rules that cast it aborted the analysis.
…range Leaf primitive types and braces nested under a block were turned into tokens at the wrong place, so highlighting and issue ranges fell outside the line.
scoped_type_identifier was not a type kind, so a generic type like Map.Entry<K, V> reached type() with a null child and the translator threw.
Top-level methods were emitted as compilation-unit members, so visitors that look up the enclosing class crashed on Java 25 compact files.
The scanner drops issues whose location has no text range, which discarded every file-level finding such as S105.
Catch-clause variables had no "type" field in the CST, so every catch parameter fell back to an inferred "var" token at line 1, corrupting highlighting and file offsets downstream. Multi-catch types are now translated as a union type. Type parameters were also registered in the declarations map used by Symbol.declaration(). A field or variable typed with a type parameter resolves its type symbol to that type parameter, and TypeSymbol.declaration() unconditionally casts to ClassTree, so any check reading annotations on such a type crashed. The ECJ-based parser never declared type-parameter bindings; do the same here.
Member lookup matched a call's actual argument count against a method's declared parameter count exactly, so any varargs call passing more arguments than declared parameters (e.g. String.format with several arguments) failed to resolve, leaving parameterTypes() empty and crashing every check that indexes into it. Matching now falls back to a varargs-aware comparison when no exact-arity member is found. The semsitter bridge's type dump never reports whether a method is varargs, so isVarArgsMethod() stayed false even for genuine varargs library methods. It's now inferred from the declaration's last parameter (ellipsis token) when available, or from the last parameter type being an array otherwise.
A variable or field typed with a type parameter resolves its type symbol to that type parameter's own TypeSymbol. declaration() unconditionally cast the stored declaration tree to ClassTree, which crashed for such symbols. Now declaration() checks the tree type and returns null instead of casting blindly, matching the API's @nullable contract.
… empty statements
…evel semicolons
…heritance cycles
The pipe only carries a ping byte so the frontend blocks until the document is ready, and the CST, semantic dump and graph facts stay in the shared mapping. --dump-json still writes them as JSON for debugging.
…s of a class of the file
…on, field, return and creation types
…ssigned as effectively final
…ookup into smaller methods
13fe6f2 to
1df8a88
Compare
|
⚖️ Ruling update ready for review: #6438 |
Methods declared in a local or anonymous class were owned by a field symbol, so owner() could not be cast to a TypeSymbol and enclosingClass() returned null. This crashed S2061 on guava and S5961 on wicket, which aborts the whole analysis under fail-fast.
Only a parameter that was itself a type variable was substituted, so a parameter such as ContextConsumer<A> stayed raw and left a lambda with no type arguments. This crashed S2699 on activiti, initializr and netflix-conductor. The receiver is now also matched against the declaring type through its supertypes, so a method inherited from a generic base class resolves its arguments.
…d parameters Arguments were typed from the declared parameters, so a lambda passed to a generic method kept a raw target type when the receiver supplied the type arguments.
Picks up the generic parameter types emitted for classpath members.
1df8a88 to
045c9a3
Compare
|
⚖️ Ruling update ready for review: #6438 |
…error A syntax error used to discard the file and fail the analysis. The recovered tree is now checked, and a parse error is reported only when nothing is left to analyze, so the other files keep going.
The benchmark runs the ECJ frontend and this frontend on the same sources and writes absolute counts, proportions, and each mismatch.
Input files were keyed by base name, so files with the same name in different directories overwrote each other and 196 samples were never compared.
…ples compare.py also splits the dumps on line feeds only, so a string literal holding a Unicode next-line character no longer breaks a record. bucket_sample.py samples 1000 AST and 1000 semantic mismatches evenly across files, groups them by underlying issue, and says whether the fix belongs to the bridge or to SemSitter.
045c9a3 to
3fe5877
Compare
CI failed: Two unrelated CI test failures in the Plugin QA and Sanity Test jobs: six integration-test assertion failures (JSP, modular-JDK classpath, tutorial telemetry, SonarLint parse-error) and a Surefire forked-JVM OutOfMemoryError in SanityTest. Neither is attributed to this PR's benchmark-only changes.OverviewTwo unique error templates were analyzed from 2 of the 60 logs in the run (commit 3fe5877). Both failures are in the test stage. The analyzers found no evidence linking either to this PR, which only adds standalone benchmark tooling and corpus files under FailuresPlugin QA integration-test assertion failures (confidence: high)
Sanity Test OutOfMemoryError in Surefire fork (confidence: high)
Summary
Code Review
|
| Auto-apply | Compact | Unblock |
|
|
|
Was this helpful? React with 👍 / 👎 | Gitar
|
⚖️ Ruling update ready for review: #6438 |
6e1afdb to
bade0fb
Compare
Summary
benchmark/out/mismatches.txt, plussummary.jsonandmismatches.jsonl).--ecj, default../sonar-java). Both checkouts needjava-frontendalready compiled.Test plan
python3 benchmark/compare.py --ecj ~/Documents/sonar-java --semsitter <v2 checkout> --corpus benchmark/corpus--corpusat a larger tree (check samples) once both frontends are compiled in the checkouts you want to score.Summary by Gitar
bucket_sample.pyto sample and bucket AST and semantic mismatches per fileAstSemanticDump.javato dump SonarJava trees with symbols and types for ECJ and SemSitterSample.javaandUse.javasample sources underbenchmark/corpus/benchast-issue-buckets.csv/semantic-issue-buckets.csvoutputs;out/ignored via.gitignoreThis will update automatically on new commits.