title: How do i get the Superclasses node in Eclipse jdt ui?
body: <p>I have a code here:</p>
  
  <pre><code>public class TestOverride {
      int foo() {
          return -1;
      }
  }
  
  class B extends TestOverride {
      @Override
      int foo() {
          // error - quick fix to add "return super.foo();"   
      }
  }
  </code></pre>
  
  <p>As you can see I have mentioned the error. I'm trying to create a quickfix for this in eclipse jdt ui. But i'm unable to get the superclass node of the class B that is Class TestOverride.</p>
  
  <p>I tried the following code</p>
  
  <pre><code>if(selectedNode instanceof MethodDeclaration) {
      ASTNode type = selectedNode.getParent();
      if(type instanceof TypeDeclaration) {
          ASTNode parentClass = ((TypeDeclaration) type).getSuperclassType();
      }
  }
  </code></pre>
  
  <p>In here I got parentClass as TestOverride only. But when I checked this is not of the type TypeDeclaration it's not of type SimpleName either. </p>
  
  <p>My query is how I get the class TestOverride node?</p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>  for (IMethodBinding parentMethodBinding :superClassBinding.getDeclaredMethods()){
       if (methodBinding.overrides(parentMethodBinding)){
          ReturnStatement rs = ast.newReturnStatement();
          SuperMethodInvocation smi = ast.newSuperMethodInvocation();
          rs.setExpression(smi);
          Block oldBody = methodDecl.getBody();
          ListRewrite listRewrite = rewriter.getListRewrite(oldBody, Block.STATEMENTS_PROPERTY);
          listRewrite.insertFirst(rs, null);
  }
  </code></pre>