Skip to content

Commit

Permalink
compare descriptor to find call origins
Browse files Browse the repository at this point in the history
Since we meanwhile have the descriptor both on the search target and the code unit candidates, we can simply compare that instead of comparing raw parameter types and return type individually.

Note that this by itself would have already fixed the bug where call origins cannot be identified if descriptor and signature mismatch, but nevertheless the API would have been behaving wrongly when deriving the raw return type from the erasure of the generic return type.

Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
  • Loading branch information
codecholeric committed Feb 27, 2022
1 parent 63618cb commit 87f1b15
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.tngtech.archunit.core.domain.JavaClassDescriptor;
import com.tngtech.archunit.core.domain.JavaCodeUnit;
import com.tngtech.archunit.core.domain.JavaFieldAccess.AccessType;
import com.tngtech.archunit.core.domain.properties.HasName;

import static com.google.common.base.Preconditions.checkNotNull;

Expand Down Expand Up @@ -139,8 +138,7 @@ public String toString() {

public boolean is(JavaCodeUnit method) {
return getName().equals(method.getName())
&& getRawParameterTypeNames().equals(HasName.Utils.namesOf(method.getRawParameterTypes()))
&& returnType.getFullyQualifiedClassName().equals(method.getRawReturnType().getName())
&& descriptor.equals(method.getDescriptor())
&& getDeclaringClassName().equals(method.getOwner().getName());
}
}
Expand Down

0 comments on commit 87f1b15

Please sign in to comment.