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

Tutorial adding command #6

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

yutingzou
Copy link

Adding Remark command

assertTrue(standardCommand.equals(standardCommand));

// null -> returns false
assertFalse(standardCommand.equals(null));

Choose a reason for hiding this comment

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

I detect that this code is problematic. According to the Correctness (CORRECTNESS), EC: Call to equals(null) (EC_NULL_ARG).
This method calls equals(Object), passing a null value as the argument. According to the contract of the equals() method, this call should always return false.

assertTrue(standardCommand.equals(commandWithSameValues));

// same object -> returns true
assertTrue(standardCommand.equals(standardCommand));

Choose a reason for hiding this comment

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

I detect that this code is problematic. According to the Correctness (CORRECTNESS), SA: Self comparison of value with itself (SA_LOCAL_SELF_COMPARISON).
This method compares a local variable with itself, and may indicate a typo or a logic error. Make sure that you are comparing the right things.

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