Bug 87042 - Passing null as first vararg makes parameter null (3.1M4)
Summary: Passing null as first vararg makes parameter null (3.1M4)
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M6   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 88581 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-03-02 21:30 EST by Joe Thurbon CLA
Modified: 2005-03-30 23:19 EST (History)
1 user (show)

See Also:


Attachments
Pass null when its the only argument (861 bytes, patch)
2005-03-03 10:56 EST, Michael Fraenkel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Thurbon CLA 2005-03-02 21:30:37 EST
The following method

boolean f(Object ... args) {
  return args == null;
}

should return false for a call f(null, null) but it does not.

In general, passing null as the first vararg makes the argument array within a
vararg method null, rather than an array whose first element is null.
Comment 1 Michael Fraenkel CLA 2005-03-03 10:56:02 EST
Created attachment 18440 [details]
Pass null when its the only argument

This checks the number of arguments passed to the vararg portion of the call to
determine if it should be null or an array of elements which contain null.
Comment 2 Olivier Thomann CLA 2005-03-06 09:46:07 EST
Fixed and released in HEAD.
Thanks for the patch. I prefer to rewrite a big the arguments generation. To
make it easier to read.
Comment 3 Olivier Thomann CLA 2005-03-21 10:10:11 EST
*** Bug 88581 has been marked as a duplicate of this bug. ***
Comment 4 Olivier Thomann CLA 2005-03-30 23:19:38 EST
Verified in 20050330-0500