Comment by sedro

3 days ago

That's another gotcha-- interning of strings and boxed primitives.

Are there linters for this sort of thing? I don't write Java much any more.

> Are there linters for this sort of thing?

Yes and they're pretty good so it's rarely an issue in practice. Using == on object references will indeed usually get you yelled at by the linter.

  • I’ll say from experience that even if your IDE highlights that by default people won’t pay any attention to it and the bug will get in.

    I’ll be happy when it’s fixed.