Summary:

  • Switched from direct reference (!=) to Objects.equals() for string comparisons to ensure consistent content comparison, null safety, and clearer code intention.
  • Remove unused imports

Comment From: sbrannen

The proposed modification to SpringExtension has already been rejected twice: in #30962 and #30456.

There was in fact nothing wrong with the implementation, and it worked as designed.

Switched from direct reference (!=) to Objects.equals() for string comparisons to ensure consistent content comparison, null safety, and clearer code intention.

There was no issue with null safety, and there was no need to compare the content of the strings.

NO_VIOLATIONS_DETECTED is only intended to serve as a marker String (or a null object in the sense of the "Null Object Pattern") which in SpringExtension serves the purpose of a boolean false value without the need to compare the content of two strings for every single test method invocation in a test suite.

However, since this is the 3rd PR to suggest a change to this code, I concede that the intention could be clearer.

In light of that, I'm repurposing this PR to address the removal of the unused imports, and I'll push a different revision to SpringExtension to make the intention clearer.

Comment From: sbrannen

See commit 7aae97bcd469105ac2f2aa76ce93f38df455e3b9.