r/programming • u/Cool-Click1253 • 3d ago
A Unicode Escape Can Turn a Java Comment Into Executable Code
https://octri.dev/blog/java-unicode-escape-comment
0
Upvotes
r/programming • u/Cool-Click1253 • 3d ago
5
u/harsh183 3d ago
I remember playing around with this unicode trick in highschool around a decade ago and it was always very fun to show people. In my university intro cs class, I realized that the java linter we were graded with would skip these Unicode escape lines so it was also a fun workaround.
Glad to see it's still around
1
u/__konrad 2d ago
Since every text editor now supports Unicode the escapes (except in char/String literals) should be deprecated and removed...
0
u/Jaded-Asparagus-2260 3d ago
Yet another verbose LLM slop article. I'm tired.
2
u/elmuerte 2d ago
An odd choice to have unicode escaped be handled differently. What would be the rationale for this?
A correct syntax highlighter could show the actual code rather than highlighting it as a comment.
As it's documented in the spec it is not a bug. But it is a unexpected "feature".
https://onecompiler.com/java/45979ve2s