Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor: do not check details if checker suppression is unstable #12211

Closed
wants to merge 1 commit into from

Conversation

nrmancuso
Copy link
Member

This is a quick hack until we come up with better idea for #12210

@nrmancuso nrmancuso self-assigned this Sep 18, 2022
@nrmancuso nrmancuso force-pushed the checker-hack branch 3 times, most recently from 7d12f2e to f631e97 Compare September 18, 2022 02:33
@nrmancuso nrmancuso assigned romani and unassigned nrmancuso Sep 18, 2022
@Vyom-Yadav
Copy link
Member

Unfortunately, this will not work, we got a new changing variable:

Message: "@MustCall method close may not have been invoked on temp-var-20910 or any of its aliases."

temp-var-\d+ and this one is present in Message so ignoring Details for unstable errors won't work.

result = (fileName != null ? fileName.hashCode() : 0)
result = 31 * result + (specifier != null ? specifier.hashCode() : 0)
result = 31 * result + (message != null ? message.hashCode() : 0)
result = 31 * result + (details != null ? details.hashCode() : 0)
Copy link
Member

Choose a reason for hiding this comment

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

This won't work if hashCode is actually required and used.

If two objects are equal according to equals() method, then their hash code must be same.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed.

Copy link
Member

Choose a reason for hiding this comment

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

As long as you override hashCode and don't implement similar logic between it and equals, it will be an issue. Removing details and message from just this method won't "Fix" the underlying issue.

Is this hashCode actually used/needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I just figured codenarc or something else would have a warning about overriding equals but not hashcode.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've removed it, let's see if there are any warnings.

Copy link
Member

Choose a reason for hiding this comment

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

Another question, do we actually have a reason for it to be equals or can it be it's own thing like fuzzyEquals?

Copy link
Member

Choose a reason for hiding this comment

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

https://github.com/checkstyle/checkstyle/blob/master/.ci/checker-framework.groovy#L163

final Set<CheckerFrameworkError> errors = new HashSet<>()

It is a hash object. You will need a valid hashCode and equals.

Copy link
Member Author

Choose a reason for hiding this comment

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

Another question, do we actually have a reason for it to be equals or can it be it's own thing like fuzzyEquals?

Set.contains relies on equals.

@nrmancuso nrmancuso force-pushed the checker-hack branch 2 times, most recently from 2428c4e to aaf78cf Compare September 18, 2022 13:13
@romani
Copy link
Member

romani commented Sep 18, 2022

temp-var-\d+ and this one is present in Message so ignoring Details for unstable errors won't work.

we can not ignore message, better to apply regexp to it to remove variable part.

Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

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

items:

.ci/checker-framework.groovy Show resolved Hide resolved
@nrmancuso
Copy link
Member Author

Closing in favor of #12215

@nrmancuso nrmancuso closed this Sep 19, 2022
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.

None yet

4 participants