Here is my problem actually I'm facing now. 
I have a class, let's say Foo and this class defines a method called getBar that returns a Bar instance. The class Bar is defined inside Foo and and is declared public static final. What I want to do is to define a class MyFoo that extends Foo but I also want to extend Bar with MyBar by adding my own functionalities (methods, properties,etc). 
I also want getBar to return MyBar.
The problem is Bar is final. Here is an illustration of what I want to do :
public class Foo {
  Bar bar = new Bar();
  public Bar getBar(){
      return bar;
  } 
   ....
   public static final class Bar {
    } 
}
What I want to do is :
public class MyFoo extends Foo {
   public MyBar getBar(){ // here I want to return an instance of MyBar
   }
  public static final class MyBar extends Bar { // That's impossible since Bar is final
  } 
}
How can I achieve that?
[EDIT] I am adding more details to my question. 
I am actually developing a plugin for Jenkins and after searching, I realize there is a plugin that offers the base functionalities that I want to do, Foo and Bar. I want to custom Foo and Bar,  so it can fits my needs. 
Foo is the main class of the plugin and extends a class called Builder. Foo defines a method called perform which contains all the operations for performing a build. 
Bar contains operations for configurations purposes and Foo needs Bar to get those informations. 
So what I want to do is to extend Foo with MyFoo and add some configurations with MyBar. And as you see, MyFoo will need to get those configuations by calling getBar();
The second thing is I have no control of the instanciation of MyFoo and MyBar
What blocks me, is that I cannot extend Bar. How can I achieve that?