Java effectively does a pre-pass over a source file to replace all \u0000 sequences with the actual character that the escape references to. That it's in a comment is irrelevant; the escape sequences are parsed through the entire source file independent of any other context.
It's pretty idiotic, but it's Java so some level of brain damage is to be expected.
I don't care if it's a "pre-pass" or not, commented lines should always be ignored.1
Don't get me started on nonsense like those PHP interpreting engines that use fucking docblocks programmatically for database definitions and shit. I almost had an anyuerism when I started reading about that.
// \u000d System.out.println("Hello World!"); Is a line. It only becomes 2 lines after Java parses the unicode in this line. The fact that it reaches the point where it could be considered 2 lines is the problem in the first place.
3
u/drysart May 11 '18
Java effectively does a pre-pass over a source file to replace all \u0000 sequences with the actual character that the escape references to. That it's in a comment is irrelevant; the escape sequences are parsed through the entire source file independent of any other context.
It's pretty idiotic, but it's Java so some level of brain damage is to be expected.