Skip to content

Conversation

@anton-haubner-sonarsource
Copy link
Contributor

@anton-haubner-sonarsource anton-haubner-sonarsource commented Oct 28, 2025

SONARJAVA-5818

Two nullability issues have been accepted for this PR:

  • The issues were pre-existing and were only triggered because the code was slightly re-arranged
  • Fixing the issues would require changing the construction API for DefaultJavaFileScannerContext and related classes which is way out of scope for this PR.

Because of these concerns, I have decided to accept these issues for now.
Let me know if you have objections.

Reviewing commit-by-commit is strongly recommended

@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod bot changed the title Fix FPs caused by state reset bug in CipherBlockChainingCheck SONARJAVA-5818 Fix FPs caused by state reset bug in CipherBlockChainingCheck Oct 28, 2025
public void leaveNode(Tree tree) {
if (tree == outermostClass) {
ivFactoryFinder.clear();
outermostClass = null;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the actual change fixing the bug that we observed on Peach

@anton-haubner-sonarsource anton-haubner-sonarsource force-pushed the ahbnr/fix-S3329-state-reset branch 3 times, most recently from cd6ae3c to 2e96038 Compare October 28, 2025 16:33

addComments(verifier, commentLinesVisitor);

JavaFileScannerContextForTests testJavaFileScannerContext = visitorsBridge.lastCreatedTestContext();
Copy link
Contributor Author

@anton-haubner-sonarsource anton-haubner-sonarsource Oct 28, 2025

Choose a reason for hiding this comment

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

The main change here is that all file scanner contexts are now considered by the JavaCheckVerifier when dealing with multiple files, instead of just the last one.

Otherwise, issues in all but the last file will not be found by the verifier.

@anton-haubner-sonarsource anton-haubner-sonarsource force-pushed the ahbnr/fix-S3329-state-reset branch 2 times, most recently from c35962a to 8a1b82a Compare October 29, 2025 08:50
@anton-haubner-sonarsource anton-haubner-sonarsource marked this pull request as ready for review October 29, 2025 09:14
@anton-haubner-sonarsource
Copy link
Contributor Author

There is again an auto-formatting commit:
40f743a

I am isolating the auto-formatting into a separate commit to make it clear which parts of the PR are actually changing behaviour and which are just formatting.

That being said, from a previous review, I got the impression that you would prefer to always keep auto-formatting in a separate PR.
My concern here is, that this will create a lot of overhead, because auto-formatting seems to affect every file that I change, meaning, that there will be a lot of additional PRs.
If you would still prefer to keep formatting out of PRs that make functional changes, I will drop it though.

Copy link
Contributor

Choose a reason for hiding this comment

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

The change looks good overall to me. Let's rework the branch so that we can split the work between 2 tickets: SONARJAVA-5819 to fix the check verifier and SONARJAVA-5818 to fix the check itself

SonarComponents sonarComponents, InputFile inputFile, JavaVersion javaVersion, boolean inAndroidContext, CacheContext cacheContext
) {
testContext = new JavaFileScannerContextForTests(null, inputFile, null, sonarComponents, javaVersion, false, inAndroidContext, cacheContext);
SonarComponents sonarComponents, InputFile inputFile, JavaVersion javaVersion, boolean inAndroidContext, CacheContext cacheContext) {

Choose a reason for hiding this comment

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

Suggested change
SonarComponents sonarComponents, InputFile inputFile, JavaVersion javaVersion, boolean inAndroidContext, CacheContext cacheContext) {
SonarComponents sonarComponents, InputFile inputFile, JavaVersion javaVersion, boolean inAndroidContext, CacheContext cacheContext
) {

@anton-haubner-sonarsource anton-haubner-sonarsource changed the title SONARJAVA-5818 Fix FPs caused by state reset bug in CipherBlockChainingCheck SONARJAVA-5819 SONARJAVA-5818 Fix FPs caused by state reset bug in CipherBlockChainingCheck Oct 29, 2025
@sonarqube-next
Copy link

@anton-haubner-sonarsource anton-haubner-sonarsource merged commit 991bf5f into master Oct 29, 2025
17 checks passed
@anton-haubner-sonarsource anton-haubner-sonarsource deleted the ahbnr/fix-S3329-state-reset branch October 29, 2025 13:38
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