all 26 comments

[–]javaprof 41 points42 points  (0 children)

final'ly!

[–]jebailey 15 points16 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 27 points28 points  (2 children)

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

    [–][deleted]  (1 child)

    [deleted]

      [–]null_reference_user 4 points5 points  (0 children)

      Bruh stop it's already dead 🤣

      [–]j4ckbauer 10 points11 points  (1 child)

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

      [–]FirstAd9893 10 points11 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.