Skip to content

Tutorial adding command#6

Open
yutingzou wants to merge 6 commits into
AY2021S2-CS2103-T14-3:masterfrom
yutingzou:tutorial-adding-command
Open

Tutorial adding command#6
yutingzou wants to merge 6 commits into
AY2021S2-CS2103-T14-3:masterfrom
yutingzou:tutorial-adding-command

Conversation

@yutingzou
Copy link
Copy Markdown

Adding Remark command

assertTrue(standardCommand.equals(standardCommand));

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

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));
Copy link
Copy Markdown

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