direct access of non-public field on another object

Currently there is useful inspection "direct access of non-public field on another object".
However, there is special case when another object is of the same class as accessing object.

class C {
private int field;

void a(C another) { int x = another.field; }

The typical usage of peer's fields is equals() method - and it is always marked with yellow stripes because of this inspection..
Class C has obviously all knowledge about itself. Even private fields of such "peers" are accessible, it's specially permitted by java.
What do you think, should this inspection be applied in this case?

Please sign in to leave a comment.