United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6569789 Compiler test lang/TYPE/type153/type15304/type15304.html fails since jdk7 b05
JDK-6569789 : Compiler test lang/TYPE/type153/type15304/type15304.html fails since jdk7 b05

Details
Type:
Bug
Submit Date:
2007-06-14
Status:
Closed
Updated Date:
2012-03-22
Project Name:
JDK
Resolved Date:
2009-11-18
Component:
tools
OS:
generic
Sub-Component:
javac
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Relates:
Relates:

Sub Tasks

Description
JCK            : JCK-COMPILER 6a b14
J2SE           : FAIL - fail JDK 7 b05+, PASS b04, PASS jdk 6u2
Platform[s]    : FAIL - all
switch/Mode    : FAIL - default

The test lang/TYPE/type153/type15304/type15304.html fails since JDK 7 b05 with the message:
type parameters of <W>void cannot be determined; no unique maximal instance exists for type variable W with upper bounds javasoft.sqe.tests.lang.type153.type15304.C,javasoft.sqe.tests.lang.type153.type15304.I,javasoft.sqe.tests.lang.type153.type15304.I1,javasoft.sqe.tests.lang.type153.type15304.I2
        testMethod(ct);
                  ^
1 error


This problem was probably introduced by integrating CR 6192945

                                    

Comments
EVALUATION

This bug is due to the way in which javac calculates glb. When javac computes glb(T1, T2 ... Tn), basically the compiler looks for a type Tk, 1<k<n, such that Tk is a subtype of each Ti, 1<i<n. 

In the example however, we have that W = glb(C, I, I1, I2), so javac looks for a type which is a subtype of both C, I, I1 and I2. Unfortunately among the upper bounds of W there is not such common subtype (the situation will be different with C implementing both I, I1 and I2). So the inference fails and the compiler reports the problem. 

The JLS state that (5.1.10) "... where the glb(V1, V2 ... ,Vm) is the (intersection) type V1 & V2 ... & Vm. So in this case javac should infer the intersection type C&I&I1&I2 for W. As a general rule, such an intersection type should be created whenever is not possible to find a suitable common subtype among the arguments of glb.
                                     
2007-12-21
SUGGESTED FIX

see http://sa.sfbay.sun.com/projects/langtools_data/7/6569789/
                                     
2007-12-21



Hardware and Software, Engineered to Work Together