Ensure that Utils.getAllInterfaces returns unique instances

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 19
    • Affects Version/s: 19
    • Component/s: tools
    • None

      Instances of TypeMirror that are equal (TypeMirror::equals), aren't necessarily same (Types::isSameType). If care is not taken when putting instances of TypeMirror into a set, that set might end up containing same instances.

      If Utils.getAllInterfaces is called on a type that extends or implements a particular interface multiple times (on different levels of its hierarchy), the returned set might contain multiple representations of that interface. For example, I've seen a case where getAllInterfaces that was passed a TypeElement corresponding to java.util.ArrayList returned a set containing 3 instances of TypeMirror corresponding to java.util.Collection<E>.

            Assignee:
            Pavel Rappo
            Reporter:
            Pavel Rappo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: