diff --git a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacTypeBinding.java b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacTypeBinding.java index a2d25cf5727..e060f9a41b8 100644 --- a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacTypeBinding.java +++ b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacTypeBinding.java @@ -592,6 +592,19 @@ private IMethodBinding[] getDeclaredMethodsDefaultImpl(ArrayList l) { .sorted(Comparator.comparing(IMethodBinding::getName)) .toArray(IMethodBinding[]::new); } + + private ITypeBinding[] getDeclaredTypeDefaultImpl(ArrayList l) { + return StreamSupport.stream(l.spliterator(), false) + .filter(ClassSymbol.class::isInstance) + .map(ClassSymbol.class::cast) + .map(sym -> { + Type t = this.types.memberType(this.type, sym); + return this.resolver.bindings.getTypeBinding(t, isGeneric); + }) + .filter(Objects::nonNull) + .sorted(Comparator.comparing(ITypeBinding::getName)) + .toArray(ITypeBinding[]::new); + } private IMethodBinding[] getDeclaredMethodsForRecords(ArrayList l) { ASTNode node = this.resolver.symbolToDeclaration.get(this.typeSymbol); @@ -637,11 +650,11 @@ public ITypeBinding[] getDeclaredTypes() { if (members == null) { return new ITypeBinding[0]; } - return StreamSupport.stream(members.getSymbols().spliterator(), false) - .filter(TypeSymbol.class::isInstance) - .map(TypeSymbol.class::cast) - .map(sym -> this.resolver.bindings.getTypeBinding(sym.type)) - .toArray(ITypeBinding[]::new); + ArrayList l = new ArrayList<>(); + for( Symbol s : members.getSymbols()) { + l.add(s); + } + return getDeclaredTypeDefaultImpl(l); } @Override