JDK-8161277 : javax.lang.model.util.Types.isSameType(...) returns true on wildcards
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 9
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2016-07-13
  • Updated: 2016-08-05
  • Resolved: 2016-07-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b130Fixed
Related Reports
Relates :  
Description
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.

Comments
this change was provoked by: JDK-8159970
26-07-2016