Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327508 - [Polymorphic Dispatcher] null values should be handled as compatible by default
Summary: [Polymorphic Dispatcher] null values should be handled as compatible by default
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: M3   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-12 02:28 EDT by Sven Efftinge CLA
Modified: 2017-09-19 17:36 EDT (History)
1 user (show)

See Also:
sven.efftinge: indigo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Efftinge CLA 2010-10-12 02:28:12 EDT
In case a null reference is passed as an argument to invoke, getDefaultClass(int) is called in order to
allow to map null to a certain default type. 
That might be useful, but mapping any nulls to Object.class by default is wrong, since null is a member of any reference type. Instead the method should return null by default and the dispatcher should handle
null as compatible to any reference type.
Comment 1 Sebastian Zarnekow CLA 2010-10-12 02:51:54 EDT
Should be dispatch null-params to method(Void v) ?
Comment 2 Sebastian Zarnekow CLA 2010-10-12 02:52:17 EDT
Sorry, typo:

Should we dispatch null-params to method(Void v) ?
Comment 3 Sven Efftinge CLA 2010-10-12 03:11:29 EDT
If we would assume Void.class for any nulls in Java, the client would always have to specify such a method signature. This is because Void has no super type (other than Object).
We could of course mimic that Void is a subtype of everything, but that would complicate things and I'm not sure it is worth it.
Comment 4 Sebastian Zarnekow CLA 2010-10-12 03:18:50 EDT
Agreed.

So by default you'd actually not call any method if null is passed to the dispatcher and more than one possibility exists?
Comment 5 Sven Efftinge CLA 2010-10-12 03:22:55 EDT
By default the most specific signature is called (like it is with any other arguments) and in case there is no single most specific and error is raised.

I'm not completely sure that being able to explicitly fetch null arguments by adding a signature for Void couldn't be useful. In Xtend I used that feature quite often. Maybe we should do it someday...
Comment 6 Sven Efftinge CLA 2010-10-12 04:40:51 EDT
Changed the semantics, such that Void can be used to fetch null arguments.
Comment 7 Karsten Thoms CLA 2017-09-19 17:24:52 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 8 Karsten Thoms CLA 2017-09-19 17:36:33 EDT
Closing all bugs that were set to RESOLVED before Neon.0