United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4941882 : incorrect inference for result of lub(int[], float[])

Details
Type:
Bug
Submit Date:
2003-10-22
Status:
Closed
Updated Date:
2006-03-15
Project Name:
JDK
Resolved Date:
2005-12-17
Component:
tools
OS:
solaris_9,solaris_8,linux,generic,windows_xp
Sub-Component:
javac
CPU:
x86,sparc,generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
5.0,6
Fixed Versions:

Related Reports
Backport:
Backport:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Duplicate:

Sub Tasks

Description
The following program is improperly accepted by javac.

class Z {
    static <T> T f(T a, T b) {
        return a;
    }
    static Object[] main(int[] a, float[] b) {
        return f(a, b);
    }
}

                                    

Comments
SUGGESTED FIX

Webrev: http://sa.sfbay/projects/langtools_data/mustang/6332204/
                                     
2005-12-05
EVALUATION

This fixes all the following issues (of which some are regressions):

4942040 improper handling of lub type for arrays, classes
5070671 Arrays.binarySearch can't infer int[]
6222762 Primitive arrays and varargs inference leads to crash in TreeMaker.Type(TreeMaker.java:531)
6332204 com.sun.tools.javac.code.Types.lub() throws NPE
6346876 Java compiler (javac) crashes on ternary operator type mismatch.
6355728 javac crashes with NullPointerException
                                     
2005-12-05
EVALUATION

This leads to a number of related problems which can cause the compiler
to reject incorrect programs or crash.
                                     
2005-11-24
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
dragon
mustang


                                     
2004-09-07
EVALUATION

Correct.  This is a loophole in the implementation of the type system, not the spec.

###@###.### 2003-10-22
                                     
2003-10-22



Hardware and Software, Engineered to Work Together