Skip to content

Commit

Permalink
getDeclaredTypes() on a type binding loses the parameterized info for…
Browse files Browse the repository at this point in the history
… children

Signed-off-by: Rob Stryker <[email protected]>
  • Loading branch information
Rob Stryker committed Jan 15, 2025
1 parent 7479d40 commit d659d6c
Showing 1 changed file with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,19 @@ private IMethodBinding[] getDeclaredMethodsDefaultImpl(ArrayList<Symbol> l) {
.sorted(Comparator.comparing(IMethodBinding::getName))
.toArray(IMethodBinding[]::new);
}

private ITypeBinding[] getDeclaredTypeDefaultImpl(ArrayList<Symbol> 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<Symbol> l) {
ASTNode node = this.resolver.symbolToDeclaration.get(this.typeSymbol);
Expand Down Expand Up @@ -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<Symbol> l = new ArrayList<>();
for( Symbol s : members.getSymbols()) {
l.add(s);
}
return getDeclaredTypeDefaultImpl(l);
}

@Override
Expand Down

0 comments on commit d659d6c

Please sign in to comment.