Generate toString with parent member variables?

Maybe I am missing something obvious, but I can't seem to make toString generation include parent member variables.

For instance for with the following to classes Foo and Bar, the Intellij IDE generates Bar.toString() which includes b but not a.  How do I fix this?

 
public class Foo {
    private String a;

    public
String getA() {
        return a;
    
}

    public void setA(String a) {
        this.a = a;
    
}
}
  
public class Bar extends Foo {
    private String b;

    public
String getB() {
        return b;
    
}

    public void setB(String b) {
        this.b = b;
    
}

    @Override
    public
String toString() {
        return "Bar{" +
                "b='" + b + '\'' +
                '}';
    
}
}

Please sign in to leave a comment.