Bug 91467

Summary: [1.5][compiler] Eclipse asks for and then complains about unnecessary cast
Product: [Eclipse Project] JDT Reporter: Claudio Nieder <private>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:

Description Claudio Nieder CLA 2005-04-14 17:26:40 EDT
/**
 * Whatever you do, eclipse doesn't like it.
 */
public class Test
{

 /**
  * Passing a String vararg to a method needing an Object array makes eclipse
  * either ask for a cast or complain that it is unnecessary. You cannot do it
  * right.
  * 
  * @param s
  */
 public static void q(String... s)
 {
  System.out.printf("",s); // reports: Varargs argument String[] should be cast
                           // to Object[] when passed to the method
                           // printf(String, Object...) from type PrintStream
  System.out.printf("",(Object[])s); // reports: Unnecessary cast from String[]
                                     // to Object[]
 }
}
Comment 1 Philipe Mulet CLA 2005-04-29 06:27:22 EDT
Tuned diagnosis for unnecessary cast to be more resilient with varargs method
invocation.
Added VarargsTest#test029.
Fixed
Comment 2 Olivier Thomann CLA 2005-05-11 12:00:42 EDT
Verified in I20050510-0010