Bug 495499 - InjectorFactory should throw an error when the binding being added isn't of the correct type
Summary: InjectorFactory should throw an error when the binding being added isn't of t...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-05 18:21 EDT by Alex Blewitt CLA
Modified: 2016-06-05 18:21 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 Alex Blewitt CLA 2016-06-05 18:21:54 EDT
I discovered an error in my code when using:

 InjectorFactory.getDefault().
     addBinding(IStringService.class).
      implementedBy(StringService.class);

I had forgotten to add 'class StringService implements IStringService' and so the binding was never going to work. However, I would have expected this to be a compile-time error (assuming that the addBinding was generic) or at the very least a runtime error. However all errors were invisibly swallowed, even though it would never be able to be injected if this were the case.

It would be better if the above could be a runtime or compile time error, which would have identified the problem (for me) much faster.