Skip to content

[Suggestion]BoxedPrimitiveEquality supports detection assertSame(foo, bar) is recommended #1661

@wuchiuwong

Description

@wuchiuwong

Description of the problem / feature request:

For rule BoxedPrimitiveEquality, assertSame(foo, bar); is also used to determine whether reference is equalalled. It is recommended that this rule supplement the detection of this case,
This rule is implemented in error_prone_core-2.3.4-sources.jar!\com\google\errorprone\bugpatterns\BoxedPrimitiveEquality.java, which is extended from error_prone_core-2.3.4-sources.jar!\com\google\errorprone\bugpatterns\AbstractReferenceEquality.java
In AbstractReferenceEquality.java, the operations for detecting equality are listed, for example: ==, !=, Objects.equals(a, b), a.equals(b),
but assertSame(foo, bar); is not among them, so this situation can not be detected.

Feature requests: what underlying problem are you trying to solve with this feature?

assertSame(c, converter.coerceToCharacter(c));
Assert.assertSame(3, nodes.size());
Assert.assertSame('H', player.getSymbol());

What version of Error Prone are you using?

2.3.4

Have you found anything relevant by searching the web?

no

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions