this = this in decompiled Java
-
11-09-2019 - |
Question
I tried decompiling a Java application to which I do not have the source code and a strange thing showed up. At the top of the constructor for a class, there is a line that says
this = this
What does this (not this) mean? Is this just an artifact of the decompilation process? Or is it just some ugly hack? Can this be assigned to something else? If so, what does
this = null
mean?
Solution
this
is final. You definitely cannot assign it. I'd guess this is a disassembler artifact.
There's some potential goofy-ness with inner classes (which hold this
pointers to the outer class), but those lines as written are not valid Java.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow