JDK-6845686 : basic and raw formatters do not display captured var id properly when javac runs in -XDoldDiags mode
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: unknown
  • Submitted: 2009-05-27
  • Updated: 2012-01-13
  • Resolved: 2012-01-13
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 b64Fixed
Related Reports
Relates :  
Relates :  
Description
Compiling the following program:

interface List<E> {}

class Test {
   <T> void merge(List<T> l1, List<T> l2) {}
   void test(List<? extends Test> list) {
    merge(list, list);
   }
}

produces the following bad output if the compatibility mode flag (-XDoldDiags) is set:

TestX.java:6: method merge in class Test cannot be applied to given types
    merge(list, list);
    ^
  required: List<T>,List<T>
  found: List<capture#0 of ? extends Test>,List<capture#0 of ? extends Test>
1 error

That is, captured var indexes are not generated correctly.

Comments
SUGGESTED FIX A webrev of this fix is available at the following URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/a9c04a57a39f
16-06-2009

EVALUATION This problem has been caused by the rich diagnostic formatter work. Abstract diagnostic formatter's printer should override visitCapturedType and add a captured type to the allCaptured list. Currently the logic that adds captured types to such list is flawed and needs to be fixed.
27-05-2009