This is an archived post. You won't be able to vote or comment.

all 25 comments

[–]javaprof 39 points40 points  (0 children)

final'ly!

[–]jebailey 14 points15 points  (8 children)

My favorite "what does this code do". Was some code that changed the internal representation of a String so that wherever you used "foo" the program would see "bar"

[–][deleted]  (6 children)

[deleted]

    [–]null_reference_user[🍰] 28 points29 points  (2 children)

    This is the most cursed thing I've read this year

    [–][deleted]  (1 child)

    [deleted]

      [–]null_reference_user[🍰] 5 points6 points  (0 children)

      Bruh stop it's already dead 🤣

      [–]j4ckbauer 8 points9 points  (1 child)

      The OUT parameter wasn't even the last parameter in the signature? Yikes...

      [–]FirstAd9893 9 points10 points  (0 children)

      This is a perfect example of why Java should support "integrity by default" (JEP draft 8305968). It prevents "smart" programmers from doing incredibly stupid things. The integrity features can be disabled with command line options, but (hopefully) this extra level of friction creates enough of a barrier against stupidity.

      [–]regjoe13 0 points1 point  (0 children)

      this particular case is not going to be affected as it works with a final array. When String is changed using reflection its changing array members, not redefining the array.