Source:
protected boolean compareConsideringTypeParameters(ResolvedReferenceType other) { if (other.equals(this)) { return true; } if (this.getQualifiedName().equals(other.getQualifiedName())) { if (this.isRawType() || other.isRawType()) { return true; } if (this.typeParametersValues().size() != other.typeParametersValues().size()) { throw new IllegalStateException(); } for (int i = 0; i < typeParametersValues().size(); i++) { ResolvedType thisParam = typeParametersValues().get(i); ResolvedType otherParam = other.typeParametersValues().get(i); if(thisParam.describe().equals(otherParam.describe())) return true; if (!thisParam.equals(otherParam)) { if (thisParam instanceof ResolvedWildcard) { ResolvedWildcard thisParamAsWildcard = (ResolvedWildcard) thisParam; if (thisParamAsWildcard.isSuper() && otherParam.isAssignableBy(thisParamAsWildcard.getBoundedType())) { } else if (thisParamAsWildcard.isExtends() && thisParamAsWildcard.getBoundedType().isAssignableBy(otherParam)) { } else if (!thisParamAsWildcard.isBounded()) { } else { return false; } } else { if (thisParam instanceof ResolvedTypeVariable && otherParam instanceof ResolvedTypeVariable) { List<ResolvedType> thisBounds = thisParam.asTypeVariable().asTypeParameter().getBounds().stream().map(ResolvedTypeParameterDeclaration.Bound::getType).collect(Collectors.toList()); List<ResolvedType> otherBounds = otherParam.asTypeVariable().asTypeParameter().getBounds().stream().map(ResolvedTypeParameterDeclaration.Bound::getType).collect(Collectors.toList()); return thisBounds.size() == otherBounds.size() && otherBounds.containsAll(thisBounds); } return false; } } } return true; } return false; }

Target:
protected boolean compareConsideringTypeParameters(ResolvedReferenceType other) { if (other.equals(this)) { return true; } if (this.getQualifiedName().equals(other.getQualifiedName())) { if (this.isRawType() || other.isRawType()) { return true; } if (this.typeParametersValues().size() != other.typeParametersValues().size()) { throw new IllegalStateException(); } for (int i = 0; i < typeParametersValues().size(); i++) { ResolvedType thisParam = typeParametersValues().get(i); ResolvedType otherParam = other.typeParametersValues().get(i); if (thisParam.isReferenceType() && otherParam.isReferenceType() && thisParam.asReferenceType().getQualifiedName().equals(otherParam.asReferenceType().getQualifiedName())) { return true; } if (!thisParam.equals(otherParam)) { if (thisParam instanceof ResolvedWildcard) { ResolvedWildcard thisParamAsWildcard = (ResolvedWildcard) thisParam; if (thisParamAsWildcard.isSuper() && otherParam.isAssignableBy(thisParamAsWildcard.getBoundedType())) { } else if (thisParamAsWildcard.isExtends() && thisParamAsWildcard.getBoundedType().isAssignableBy(otherParam)) { } else if (!thisParamAsWildcard.isBounded()) { } else { return false; } } else { if (thisParam instanceof ResolvedTypeVariable && otherParam instanceof ResolvedTypeVariable) { List<ResolvedType> thisBounds = thisParam.asTypeVariable().asTypeParameter().getBounds().stream().map(ResolvedTypeParameterDeclaration.Bound::getType).collect(Collectors.toList()); List<ResolvedType> otherBounds = otherParam.asTypeVariable().asTypeParameter().getBounds().stream().map(ResolvedTypeParameterDeclaration.Bound::getType).collect(Collectors.toList()); return thisBounds.size() == otherBounds.size() && otherBounds.containsAll(thisBounds); } return false; } } } return true; } return false; }