pombreda / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 1 forks source link

Guice hangs injecting members on objects whose class exteds from abstract classes #754

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to Injector.injectMembers(Object) on an object that extends from an 
abstract class and Guice simply hangs the thread. I tried the same with a 
simple class and it works. Is this a known issue?

Steps to reproduce:
1. Creates an abstract class.
2. Creates a new class that extends from the abstract one and add some @Inject 
members
3. Create an instance of the extending class
4. Try to call injector.injectMembers() on an instance of the class

Original issue reported on code.google.com by rpvi...@gmail.com on 18 Jun 2013 at 6:31

GoogleCodeExporter commented 9 years ago
I can't recreate the hang locally just by following the above steps, the 
instance is injected as expected. Can you add an example testcase that shows 
the problem? ie. a standalone project that can be compiled and run locally.

Original comment by mccu...@gmail.com on 18 Jun 2013 at 6:50

GoogleCodeExporter commented 9 years ago
I'm not sure if it's relavant but when I perform the 
injector.injectMemebers(Object) the inject instance is also injected in another 
class, i.e.:

class A {
@Inject
Injector injector;

// the class to inject the members was created in another class.
void method(SomeClass a) {
  injector.injectMembers(a);
}
}

I'll try to reproduce but I'm really tight on time right now. Sorry!

Original comment by rpvi...@gmail.com on 18 Jun 2013 at 7:04

GoogleCodeExporter commented 9 years ago
You can always take a thread dump which should show whether it's a deadlock or 
livelock. A thread dump should also reveal any cycles in the application/setup 
logic that might be contributing to the problem.

Original comment by mccu...@gmail.com on 18 Jun 2013 at 7:10

GoogleCodeExporter commented 9 years ago
Please ignore this (shame). I was running in an application server and the 
STDERR was being suppressed :/

Original comment by rpvi...@gmail.com on 19 Jun 2013 at 9:10

GoogleCodeExporter commented 9 years ago
OK, no worries

Original comment by mccu...@gmail.com on 19 Jun 2013 at 11:10