class Foo { static class Nested {}; } class Bar extends Foo<Bar.Nested> {} interface FooI { interface Nested {}; } interface BarI extends FooI<BarI.Nested> {}