lixy

Posted on Aug 27

AI-assisted

javac does not care what your code looks like. Whitespace carries zero meaning in the Java Language Specification, so the compiler reads your file as a stream of tokens and skips every space you typed. Fine for the machine. A problem for you, because indentation is the part of the code that talks to humans. When the layout says one thing and the braces say another, the reader trusts the layout, and the bug ships.

Here are four bugs I have either shipped, reviewed, or nearly missed. Every snippet compiles, and in every one the indentation is lying.