Issue 31 in guiceyfruit: add method.setAccessible(true)

1 view
Skip to first unread message

codesite...@google.com

unread,
Oct 24, 2009, 6:16:51 PM10/24/09
to guiceyf...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 31 by mathieu.carbou: add method.setAccessible(true)
http://code.google.com/p/guiceyfruit/issues/detail?id=31

In the PreDestroyCloser class plus in the JSR250Module I would add

method.setAccessible(true);

I have a lot of classes in package local and also some method and some need
lifecycle management through jsr250.

Currently, calling non public methods or not in a public class fail... I
think it would be nice to allow best of both world.

Here is a failing use case:

final class PreDestroyInChildInjector {
public static void main(String... args) throws CloseFailedException {
Injector parent = Guice.createInjector(new Jsr250Module());
Injector child = parent.createChildInjector(new AbstractModule() {
@Override
protected void configure() {
bind(MyClass.class).in(Singleton.class);
}
});
child.getInstance(MyClass.class);
Injectors.close(child);
}

static class MyClass {
@PostConstruct
void start() { System.out.println("start called"); }
@PreDestroy
void stop() { System.out.println("stop called"); }
}
}

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

Reply all
Reply to author
Forward
0 new messages