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