Skip to content

Commit

Permalink
add getAllRawTypesInvolvedInSignature() for JavaCodeUnit
Browse files Browse the repository at this point in the history
This method returns the union of all raw types involved in the method's return type, all involved raw types of its parameters and its type parameters.

Issue: #723
Signed-off-by: Leonard Husmann <[email protected]>
  • Loading branch information
leonardhusmann committed May 29, 2023
1 parent fcba4e0 commit cc1d801
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
Expand Down Expand Up @@ -169,6 +170,14 @@ public JavaClass getRawReturnType() {
return returnType.getRaw();
}

public Set<JavaClass> getAllRawTypesInvolvedInSignature() {
return ImmutableSet.<JavaClass>builder().addAll(this.returnType.get().getAllInvolvedRawTypes())
.addAll(this.parameters.getParameterTypes().stream().map(JavaType::getAllInvolvedRawTypes).flatMap(Set::stream)
.collect(Collectors.toSet()))
.addAll(this.typeParameters.stream().map(JavaTypeVariable::getAllInvolvedRawTypes).flatMap(Set::stream).collect(Collectors.toSet()))
.build();
}

@PublicAPI(usage = ACCESS)
public Set<JavaFieldAccess> getFieldAccesses() {
return fieldAccesses;
Expand Down

0 comments on commit cc1d801

Please sign in to comment.