Java coding notes: the JVM, and writing software that lasts
Types that quietly promise the wrong thing
Most of the bugs in this section are not logic errors. They are a type or a signature that made a promise the code could not keep: a wrapper used where a plain field belonged, a record treated as a struct, a view mistaken for a copy, two strings that render identically and are not equal, an interface widened for the second case and wrong by the third. The compiler is satisfied in every one of them, which is exactly why they survive review.
20 September 2026 · equals() compares code points, not glyphs. A filename from macOS and the same name typed on Windows can differ, and the map lookup that fails will not tell you why.