saurabh kumar saurabh kumar - 2 months ago 5x
Java Question

Can't see Super () in .class file after decompiling

class p {
class Student extends p{
Student() {

public static void main(String[] args) {
Student s = new Student();

As I have provided super() explicitly, but after de-compiling using jd-gui I am not able see super() where I have placed, as super() should be provided by compiler itself. I just want to see where this, super keyword and other things are provided by compiler implicitly. I googled and found that .class file I can see with jd-gui but I am not able to see super() and this() in that, is there any other way for the same?


In Java, any constructor that does not start with an explicit super(...) or this(...) chaining constructor call will automatically get (the bytecode equivalent of) super(); inserted as its first instruction by the compiler. Therefore when the decompiler sees the bytecode for super() at the start of a constructor it has no way of knowing whether the original source code included an explicit super() or whether the instruction was inserted implicitly by the compiler. Both versions compile to the same bytecode so there's no particular reason for it to prefer one over the other.