Skip to content

JAVA-7419 Read SemSitter array terms as the arrays of their element - #6587

Open
rombirli wants to merge 1 commit into
rombirli/semsitter-semantic-modelfrom
rombirli/semsitter-array-terms
Open

rombirli wants to merge 1 commit into
rombirli/semsitter-semantic-modelfrom
rombirli/semsitter-array-terms

Conversation

@rombirli

@rombirli rombirli commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Part 5 of 17 of JAVA-7392. Ticket: JAVA-7419.

Intent

Since SonarSource/semsitter#5876 and #5950, the server names array types with a term id spelled over their element, java::byte[], instead of a plain byte[]. FactTypes read such a term as a class literally named java::byte[], with no element, so no signature with an array parameter matched its overridden method.

flowchart LR
  T["java::byte[][]"] --> A["array of"] --> B["java::byte[]"] --> C["array of"] --> P["byte"]
  H["java::{a1b2}"] --> U["unknown"]
Loading
public class RedissonConnection extends AbstractRedisConnection {
  public Boolean exists(byte[] key) { ... }   // overrides a deprecated DefaultedRedisConnection method (S1874, S1161)
}

A hashed term, java::{...}, spells no element and stays unknown.

redisson probe, RedissonConnection.exists(byte[]) before after
parameter type class java::byte[] byte[]
overridden methods none DefaultedRedisConnection (deprecated), RedisKeyCommands

This explains part of the issues lost on the last PVF compared to the earlier stack.

State on master

FactTypes does not exist on master: it comes with part 4.

Test plan

  • FactTypesTest.array_terms_are_the_arrays_of_their_element: java::byte[], java::int[][], generic and type variable elements, hashed terms stay unknown

@rombirli rombirli self-assigned this Nov 25, 2026
@hashicorp-vault-sonar-prod

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

Copy link
Copy Markdown
Contributor

JAVA-7419

@rombirli
rombirli added this pull request to stack #6589 November 25, 2026 20:48
@datadog-sonarsource

datadog-sonarsource Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Pipelines

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: eadab5a | Docs | Give us feedback!

@rombirli
rombirli force-pushed the rombirli/semsitter-array-terms branch 2 times, most recently from 2c894b0 to b7c0217 Compare November 27, 2026 09:24
@rombirli
rombirli force-pushed the rombirli/semsitter-array-terms branch 3 times, most recently from fdaf06a to 640c98d Compare November 30, 2026 07:24
@rombirli
rombirli force-pushed the rombirli/semsitter-array-terms branch from 640c98d to a131d61 Compare November 30, 2026 15:47
@rombirli
rombirli force-pushed the rombirli/semsitter-array-terms branch from a131d61 to 2a1e795 Compare November 30, 2026 15:51
@rombirli
rombirli removed this pull request from stack #6589 December 1, 2026 11:07
@rombirli
rombirli added this pull request to stack #6607 December 1, 2026 11:08
@rombirli
rombirli force-pushed the rombirli/semsitter-array-terms branch from 2a1e795 to 83ad75a Compare December 2, 2026 13:35
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.
@rombirli
rombirli force-pushed the rombirli/semsitter-array-terms branch from 83ad75a to eadab5a Compare December 2, 2026 14:01
@gitar-bot

gitar-bot Bot commented Dec 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Resolving SemSitter array terms as element arrays changes Java type matching; incorrect resolution could misidentify overridden methods and affect related analysis results.

Teaches FactTypes to read SemSitter array terms such as java::byte[] as arrays of their element type, so overrides with array parameters now match their overridden methods. Hashed terms like java::{...} remain unknown. No issues found.

Verification Rules 3/3 met Repos 4 inspected · PRs 4 inspected

Functional validation No results

Rules 3 passed 2 not applicable

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

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

SonarSource/sonar-java-symbolic-execution Inspected
SonarSource/sonarlint-intellij Inspected
SonarSource/sonarlint-language-server Inspected
SonarSource/sonar-iac Inspected

Cross-PR 4 PRs inspected 0 open impacts

PR 6579: JAVA-7402 Expose annotations and nullability through symbol metadata Inspected
PR 6578: JAVA-7401 Rank library overloads to pick the most specific method Inspected
PR 6575: JAVA-7398 Translate SemSitter documents into the Java syntax tree Inspected
PR 6573: JAVA-7396 Add the SemSitter semantic model of types, symbols and members Inspected

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

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

sonarqube-next Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@david-schroeter david-schroeter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! One question about HASHED_TERM: I couldn’t reproduce a hashed type ID locally. When does the SemSitter server emit one?

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants