News for hackers. Stuff that matters.
Re:Data Classes for Java by kevingadd on Wednesday November 01, 2017 @09:33PM (#15607136)
This isn't true. For structs you can use 'this = ...' to overwrite yourself (including readonly fields) and reflection lets you set them too.

fwiw those are both gross but I've run into both in production code (not written by me, naturally)

Re:Data Classes for Java by flukus on Wednesday November 01, 2017 @09:50PM (#15607199)
The same can be said for setters and getters with a backing field, you can access them through reflection. I can't remember how it works for properties with implicit backing fields but I thought they could be set via reflection as well?
Re:Data Classes for Java by kevingadd on Thursday November 02, 2017 @04:17PM (#15613871)
You can find the backing field and set it, yes, but the name is at least not predictable because the compiler mangles it (which discourages doing this because getting a grip on the field is harder)