Conversation
| class IdentityHashMapBoxedKeyCheckGuavaSample { | ||
|
|
||
| void boxedKeys() { | ||
| Map<Boolean, String> booleans = Maps.newIdentityHashMap(); // Noncompliant |
There was a problem hiding this comment.
We should show the precise location where the issue is raised, and the issue message on at least one instance.
There was a problem hiding this comment.
Addressed in 3de3f09. The first Guava case now asserts the complete issue message and underlines the precise Maps.newIdentityHashMap() invocation. The focused IdentityHashMapBoxedKeyCheckTest suite passes.
| <code>null</code> even when the map contains a key with the same primitive value.</p> | ||
| <p>Use a map implementation that compares keys by value when the key represents a primitive value. If reference equality is required, use key objects | ||
| whose identity is deliberate and stable.</p> | ||
| <pre data-diff-id="1" data-diff-type="noncompliant"> |
There was a problem hiding this comment.
There should be an "How to fix" and compliant non-compliant subsection. Did you use RIS 😜
There was a problem hiding this comment.
My skill explicitly asks to use RIS but after looking at the substeps the agent took, I had a recently expired token so it decided to write the RSPEC manually. This should be fixed in newer PRs of mine.
Code Review ✅ Approved 2 resolved / 2 findingsImplements S9401 to detect boxed primitive types used as keys in ✅ 2 resolved✅ Quality: test_guava puts two Guava versions on analysis classpath
✅ Quality: Issue message advises a fix the rule description does not recommend
Review coverageFunctional validation 1 of 1 objectives covered Implementation Status ✅ 1 of 1 objectives covered✅ SONARJAVA-6777 - 1 of 1 objectives coveredThis PR implements the S9401 rule checking that IdentityHashMap keys are not boxed primitive types. ✅ 1 covered here
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 |
|




Summary
IdentityHashMapconstructors and GuavaMaps.newIdentityHashMap().Links
AI disclosure