JDK-6456971 : Varargs and inference problem
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2006-08-03
  • Updated: 2010-04-02
  • Resolved: 2006-10-19
Related Reports
Duplicate :  
Description
This program does not compile:

import java.util.List;

public class Main {
     static <T> T[] makeArray(T... args) {
         return args;
     }

     public static <S> void test() {
         S[] stringLists = makeArray(null, null);
     }
}

Comments
EVALUATION A bug. The compiler should infer S for T.
16-10-2006