Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8282483

Ensure that Utils.getAllInterfaces returns unique instances

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 19
    • 19
    • 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>.

            prappo Pavel Rappo (Inactive)
            prappo Pavel Rappo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: