Bug 91467 - [1.5][compiler] Eclipse asks for and then complains about unnecessary cast
Summary: [1.5][compiler] Eclipse asks for and then complains about unnecessary cast
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-14 17:26 EDT by Claudio Nieder CLA
Modified: 2005-05-11 12:00 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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