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

javax.lang.model.util.Types.isSameType(...) returns true on wildcards

XMLWordPrintable

    • b126
    • 9
    • b130
    • Verified

      javax.lang.model.util.Types.isSameType(...) API spec states:

      Caveat: if either of the arguments to this method represents a wildcard, this method will return false. As a consequence, a wildcard is not the same type as itself.

      However on JDK 9 build 126 isSameType returns true while false should be returned. The minimized testcase is attached, it produces following output on build 126:

      Root class: Test22
      Method: getList()
      Return type: java.util.List<?>
      Type argument: ta=?
      processingEnv.getTypeUtils().isSameType(ta, ta)=true

      In order to reproduce it, please:

      1. Unzip attached archive on some Unix/Linux machine to a directory, say A.
      2. Modify A/Test22/test.sh by setting JDK_HOME environment variable to your JDK installation.
      3. Run A/Test22/test.sh.

            vromero Vicente Arturo Romero Zaldivar
            grakov Georgiy Rakov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: