eclipsesource / graphical-lsp

Graphical language server platform for building web-based diagram editors
https://www.eclipse.org/glsp
Eclipse Public License 2.0
36 stars 8 forks source link

Fix wrong Inject imports #242

Closed tortmayr closed 5 years ago

tortmayr commented 5 years ago

Some Java classes were importing the wrong @Inject annotation which could cause issues when consuming the GLSP packages via maven central.

CamilleLetavernier commented 5 years ago

which could cause issues when consuming the GLSP packages via maven central.

What kind of issues? I've never had any issue with javax.inject.Inject with Guice (I only ever use Guice annotations if I need the @Inject(optional=true) attribute, which doesn't exist in javax.inject)

tortmayr commented 5 years ago

Is there a particular downside to use com.google.inject.Inject over javax.Inject?

I had some troubles with dependency resolution/building in https://github.com/eclipsesource/glsp-p2 that got fixed when changing the imports

CamilleLetavernier commented 5 years ago

javax.inject has the benefit of being independent from the injector technology, so it would be easier to reuse a component with a different injector (e.g. E4 DI). Other than that, the Guice one is perfectly fine (And actually slightly more powerful than the javax one, considering the extra 'optional' attribute)

It's just that I've been mixing both for some time and never had any specific issue (But then I'm always using Eclipse, not plain Maven, so I didn't really have to worry about dependency resolution - javax.inject is always present in Eclipse, probably through Orbit P2 Repo)