Fix WMI_WRONG_MAP_ITERATOR in JSONParser and make SpotBugs fail CI#5048
Merged
Conversation
ed4b3ca to
770e1c0
Compare
Contributor
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |
Collaborator
Author
|
Compared 116 screenshots: 116 matched. Native Android coverage
✅ Native Android screenshot tests passed. Native Android coverage
Benchmark ResultsDetailed Performance Metrics
|
Collaborator
Author
|
Compared 11 screenshots: 11 matched. |
Collaborator
Author
|
Compared 115 screenshots: 115 matched. Benchmark Results
Build and Run Timing
Detailed Performance Metrics
|
Contributor
Cloudflare Preview
|
Collaborator
Author
|
Compared 23 screenshots: 23 matched. |
Contributor
✅ ByteCodeTranslator Quality ReportTest & Coverage
Benchmark Results
Static Analysis
Generated automatically by the PR CI workflow. |
Collaborator
Author
|
Compared 116 screenshots: 116 matched. Benchmark Results
Build and Run Timing
Detailed Performance Metrics
|
JSONParser.writeJsonValue iterated the Map via keySet() and re-resolved each value with m.get(key), tripping SpotBugs' WMI_WRONG_MAP_ITERATOR (performance). Switched to entrySet() iteration so the hash lookup is done once per entry; the null-drop semantics and surrounding comment are preserved. The SpotBugs execution in maven/core-unittests was only bound to the `spotbugs` goal, which generates the XML report but does not break the build on findings regardless of `failOnError`. Added the `check` goal to the same execution so any reported bug (>= Low priority, per the existing threshold) aborts CI. The `spotbugs` goal stays bound so the quality-artifact pipeline still receives the XML report on success. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
79e070d to
9b39e7e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
keySet()+m.get(key)iteration inJSONParser.writeJsonValuewithentrySet()iteration, clearing the SpotBugs WMI_WRONG_MAP_ITERATOR warning atCodenameOne/src/com/codename1/io/JSONParser.java:853. Null-drop semantics and the surrounding comment are preserved.checkgoal to the SpotBugs execution inmaven/core-unittests/pom.xml. The previous binding only ran thespotbugsgoal, which generates the XML report but does not abort the build on findings regardless offailOnError.checkhonors the existingLowthreshold andfailOnError=true, so any new violation (such as another WMI_WRONG_MAP_ITERATOR) will fail CI instead of being silently uploaded as a quality artifact. Thespotbugsgoal stays bound so the quality-artifact pipeline still receives the XML report on success.Test plan
mvn -DunitTests=true -pl core-unittests -am -DskipTests -Plocal-dev-javase verify(JDK 8) — SpotBugscheckreportsBugInstance size is 0and build succeeds.checkruns and does not regress other modules.🤖 Generated with Claude Code