JDK-6981185 : com.sun.tools.model.JavacTypes.contains() calls Type.contains instead of Types.containsType
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: unknown
  • Submitted: 2010-08-31
  • Updated: 2011-03-07
  • Resolved: 2011-03-07
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 7
7 b112Fixed
Related Reports
Relates :  
Description
The recent failing test (the one with too much uncontrolled output) fails because Types.contains call with TypeMirrors for
Types.contains( java.util.List<? extends java.lang.String>, java.lang.String );
returns true as of b108.

Comments
SUGGESTED FIX A webrev of this fix is available at the following URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/12d8f7e417fd
07-09-2010

EVALUATION This is due to the fact that the TypeMirror API does not check for type containment as per 4.5.1.1; rather it simply check for type containment like 'this type occurs in this other type'. This latter meaning, of course, has nothing to do with the JLS and, while useful in the compiler implementation, shouldn't be exposed through compiler API. That would explain the failure starting from b108, as, before b107, javac could not see (erroneously) that '? extends String' contained an occurrence of 'String' (this got fixed in 6369605). But, again, this has nothing to do with formal type-containment and JLS. This is a code snipped taken from JavacTypes.contains public boolean contains(TypeMirror t1, TypeMirror t2) { ... return ((Type) t1).contains((Type) t2); } the code should be calling Types.containsType and not Type.contain. This code has always been buggy, and never did what it was supposed to. The recent failure is, in this respect, unrelevant.
31-08-2010