Using Guice to configure Axis2 services in aar format

2010-10-14 Thread Eric
I am trying to configure the web services in an Axis2 aar-format
service group using Guice, and I am failing with a very odd error.  I
am using Sagara Gunathunga 's project at
http://ssagara.blogspot.com/2009/05/guice-axis2-integration.html to
initialize an injector and store it in a static variable in a holder
class, while telling Axis2 to initialize services with the injector.
The module looks like
module = new AbstractModule() {
  @Override
  protected void configure() {
bindConstant().annotatedWith(
  Names.named("ibatis.configuration")).to("ibatis.xml");
bind(SqlSession.class).toProvider(SqlSessionProvider.class);
bind(SqlSessionFactory.class).toProvider(
  SqlSessionFactoryProvider.class).in(Scopes.SINGLETON);
bind(IDAO.class).to(DAOI.class).in(Scopes.SINGLETON);
bind(IILocalService.class).to(LocalService.class)
  .in(Scopes.SINGLETON);
bind(IWebServiceA.class).to(WebServiceA.class);
bind(IWebServiceB.class).to(WebServiceB.class);  // CRASH
bind(IWebServiceC.class).to(WebServiceC.class);
bind(IWebServiceD.class).to(WebServiceD.class);
bind(IWebServiceE.class).to(WebServiceE.class);
  }
};

All five web services depend on ILocalService (using setter
injection). When the marked line executes, Guice fails in
AbstractModule.configure(Binder), which is quite odd:
  public final synchronized void configure(Binder builder) {
try {
  if (this.builder != null) {
throw new IllegalStateException("Re-entry is not allowed.");
  }
  this.builder = Objects.nonNull(builder, "builder");

  configure();

}

I don't know how this is happening; I've taken measures to insure that
even if multiple instances of the init class are created, the module
is only created once.  I don't see why there would be any class loader
issues either.  In short, I'm confused.

Respectfully,
Eric Jablow

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to google-gu...@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.



Re: "Parameter based singleton scope" in AssistedInject factory?

2010-10-14 Thread Dhanji R. Prasanna
Interesting problem. I've heard this referred to as the "Multiton" pattern.

Dhanji.

On Fri, Oct 15, 2010 at 3:27 AM, Fred Faber  wrote:

> Basically you have a factory that should return a singleton instance for
> each unique string value passed into it?
>
> FactoryProvider won't do this for you out of the box, as it will create a
> new instance per invocation (as you've illustrated).
>
> What I would do in this case is to decorate your factory with an
> implementation that controls singletonness:
>
> interface CacheFactory {
>   // This can be named anything you want, not just "create"
>   NamedCache create(String name);
> }
>
> class CachingCacheFactory implements CacheFactory {
>
>  private final CacheFactory underlyingFactory;
>
>  //
> http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/collect/MapMaker.html
>  private final Map caches = new MapMaker()
>   .makeComputingMap(new Function(){
>@Override public NamedCache apply(String name) {
> return underlyingFactory.create(name);
>   }
>   });
>
>   @Inject
>   CachingCacheFactory {
>   @AlwaysCreatesNewInstances CacheFactory cacheFactory) {
>  this.underlyingFactory = cacheFactory;
>}
>
>   @Override
>   NamedCache create(String name) {
>   return caches.get(name);
>   }
> }
>
>
> * * *
>
> public class YourModule extends AbstractModule {
>
>@Override protected void configure() {
>// as an alternative to binding this as a singleton, you could
> inject the map of caches
>// as a singleton instance.  6 or 1/2 dozen, unless you want to
> unittest your
>// implementation, in which case you'll want to inject the singleton
> map
>bind(CacheFactory.class)
>.to(CachingCacheFactory.class)
>.in(Singleton.class);
>
>//
> http://google-guice.googlecode.com/svn/trunk/javadoc/com/google/inject/assistedinject/FactoryModuleBuilder.html
>// this binds a "CacheFactory" instance, annotated with
> @AlwaysCreatesNewInstances, to
>// a default factory implementation which will return instances of
> NamedCacheLocal when
>// its create() method is invoked
>install(new FactoryModuleBuilder()
>.implement(NamedCache, NamedCacheLocal)
>.build(Key.get(NamedCache.class,
> AlwaysCreatesNewInstances.class));
> }
> }
>
> That should do the trick.
>
> -Fred
>
>
> On Thu, Oct 14, 2010 at 4:25 AM, Sondre Bjornebekk <
> sondre.bjorneb...@gmail.com> wrote:
>
>> Hi,
>>
>> Trying to use assisted inject and find it pretty neat, the minor
>> detail is that it does not quite work for me yet :-)
>>
>> I have created a Map wrapper to ease switching of caches (typically to
>> something like Coherence) for my application. I want the Map to be
>> returned "in a Singleton scope, based on the value of the (assisted)
>> parameter". I am doing:
>>
>> bind(CacheFactory.class).toProvider(
>> FactoryProvider.newFactory(CacheFactory.class,
>> NamedCacheLocal.class) );
>>
>> And I have:
>> /**
>>  * A factory for named caches, that later might hide its
>> implementation using a cluster wide storage.
>>  */
>>
>> public interface CacheFactory {
>>//had to be named create to work with guice assisted inject, so
>> renamed from getNamedCache
>>public NamedCache create(String name);
>> }
>>
>> public interface NamedCache extends Map {
>>public int getHitPercent();
>>public String getHitPercentString();
>>...
>> }
>>
>> /**
>>  * A named cache with a local map as implementation for storage.
>>  */
>>
>> public class NamedCacheLocal implements NamedCache {
>> ...
>>
>>/**
>> * Constructs a NamedCacheLocal with its dependencies.
>> */
>>@Inject
>>public NamedCacheLocal(@Assisted String cacheName) {
>> ...
>> }
>>
>> I have this (failing) unit test that checks that the same cache is
>> used for the same name:
>>
>>System.out.println("doing put / get test");
>>NamedCache namedCache =
>> namedCacheFactory.create("myCache");
>>namedCache.put("fisk","fesk");
>>for(int i=0;i<10; i++){
>>Object o = namedCache.get("non-hit");
>>namedCache.put("test"+i,"testval"+i);
>>}
>>Object hit = namedCache.get("fisk");
>>System.out.println("cache " + namedCache + " delivered value "
>> + hit + " to a hit percent of " + namedCache.getHitPercentString());
>>assertTrue(namedCache.getHitPercent() > 8 &&
>> namedCache.getHitPercent() < 10);
>>NamedCache namedCacheWithSameName =
>> namedCacheFactory.create("myCache");
>>for(int i=0;i<10; i++){
>>String val = namedCacheWithSameName.get("test"+i);
>>System.out.println("got val from cache: " + val);
>>}
>>//should have used the same reference, thus hit pct now higher
>>System.out.println("done with cache " +
>> namedCacheWithSameName);
>>assertTrue(namedCache.getHitPercent() > 10);
>> 

Re: Injecting a factory for generics

2010-10-14 Thread Chris Conway
Sam,

Thanks for your response. It arrived when I was on vacation, so I
apologize for this late reply.

The approach I've taken is to just write out the Factory boilerplate:

class BarFactoryImpl implements BarFactory {
  public  Bar create(Foo f) {
return new BarImpl(f);
  }
}

which then works with the simple binding

bind(BarFactory.class).to(BarFactoryImpl.class);

Regards,
Chris

On Oct 4, 8:54 am, Sam Berlin  wrote:
> See issue 218 .
> An assisted inject factory itself can be genericized, but its methods cannot
> introduce their own generic types right now.  So assuming you have a limited
> number of types T, you can workaround this by changing BarFactory to
> BarFactory and registering a BarFactory for each T.
>
>  sam
>
> On Mon, Sep 27, 2010 at 10:58 AM, Chris Conway <
>
>
>
>
>
>
>
> christopherleecon...@gmail.com> wrote:
> > The following code is an example of a factory that produces a `Bar`
> > given a `Foo`. The factory doesn't care what `T` is: for any type
> > `T`, it can make a `Bar` from a `Foo`.
>
> >    import com.google.inject.*;
> >    import com.google.inject.assistedinject.*;
>
> >    class Foo {
> >      public void flip(T x) { System.out.println("flip: " + x); }
> >    }
>
> >    interface Bar {
> >      void flipflop(T x);
> >    }
>
> >    class BarImpl implements Bar {
> >      Foo foo;
>
> >     �...@inject
> >      BarImpl(Foo foo) { this.foo = foo; }
>
> >      public void flipflop(T x) { foo.flip(x);
> > System.out.println("flop: " + x); }
> >    }
>
> >    interface BarFactory {
> >       Bar create(Foo f);
> >    }
>
> >    class Module extends AbstractModule {
> >      public void configure() {
> >        bind(BarFactory.class)
> >          .toProvider(
> >              FactoryProvider.newFactory( BarFactory.class,
> > BarImpl.class )
> >                       );
> >      }
> >    }
>
> >    public class GenericInject {
> >      public static void main(String[] args) {
> >        Injector injector = Guice.createInjector(new Module());
>
> >        Foo foo = new Foo();
> >        Bar bar =
> > injector.getInstance(BarFactory.class).create(foo);
> >        bar.flipflop(0);
> >      }
> >    }
>
> > When I run the code, I get the following errors from Guice:
>
> >    1) No implementation for BarFactory was bound.
> >      at Module.configure(GenericInject.java:38)
>
> >    2) Bar cannot be used as a key; It is not fully specified.
>
> > I guess the problem is that the BarFactory.create() method doesn't
> > match the pattern expected by FactoryProvider, because of the type
> > quantifier . But there isn't a real problem here: BarImpl.class
> > (with no type literal) is exactly what we need to create a Bar
> > given a Foo. Is there a way to configure Guice to generate a
> > BarFactory instance for me, or do I just need to write the BarFactory
> > instance by hand?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "google-guice" group.
> > To post to this group, send email to google-gu...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-guice+unsubscr...@googlegroups.com > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-guice?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to google-gu...@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.



Re: Guice not intercepting annotations on superclass methods

2010-10-14 Thread Dmitriy Litvak
Ok, I figured it out.  My abstract base/sub class had default access on it.
 Once I set it to public, it all started to work.
I am curious why would that be?

In my case I had:
abstract class A {

@Transactional
 aMethod() {
 //DO something
 }
}

public class B extends A {

}

main () {
   A obj = (A) guicifyObject(B.class);
   obj.aMethod();// @Transactional does not work!  Works only if A is
declared public
}

Looking under the hood, I saw that Guice called element.getAnnotation() (element is java.reflection.Method).
With the default access level on subclass (A in eg.), getAnnotations
returned an empty array, even though the method had @Transactional
annotation.  getDeclaringClass returned the name of the topmost/super class
(B in eg.) for the method.
Once I changed subclass to public access level (public abstract class A in
eg.), getDeclaringClass started to return subclass (A in eg.) and
getAnnotaions returned proper annotation list.

It used to work till I switched computer and eclipse (upgrade to helios).
Not sure what has caused this issue.  I tried this with the older version of
java and it ran the same way.

Gotta be some magic here, for sure :)
Thank you

On Thu, Oct 14, 2010 at 3:40 AM, Kazimierz Pogoda  wrote:

> Maybe these matchers will work for your interceptors:
>
>
> http://code.google.com/p/tadedon/source/browse/tadedon-guice-utils/src/main/java/com/xemantic/tadedon/guice/matcher/AnnotationMatchers.java
>
> Here are unit tests:
>
> http://code.google.com/p/tadedon/source/browse/tadedon-guice-utils/src/test/java/com/xemantic/tadedon/guice/matcher/AnnotationMatchersTest.java
>
> These matchers use AnnotationUtils from spring framework:
>
>
> http://static.springsource.org/spring/docs/3.0.4.RELEASE/javadoc-api/org/springframework/core/annotation/AnnotationUtils.html
>
> The question is if guice should take similar approach to annotation
> matching? Now only getAnnotation() method is called.
>
>
> On Thu, Oct 14, 2010 at 4:49 AM, Dmitriy  wrote:
> > Hi!
> >
> > It seems that Guice is not intercepting annotations on superclass
> > methods.
> > I wrote a suite of tests where each class under test inherits one
> > method from a base test.
> > That base test method is declared @Transactional, which we intercept
> > ourselves.
> >
> > This has worked great until recently! Unfortunately something happened
> > where that method is not intercepted anymore.
> > The methods that are not in superclass and annotated ARE still
> > intercepted.  I dug in a little deeper and it appears that
> > ..getAnnotation() does not return the
> > annotation if the method is inherited.  That is what causes Guice to
> > not intercept.
> >
> > But what has changed?
> > The only thing I can think of was that we upgraded Java to
> > jdk1.6.0_20.
> >
> > Seems like this issue already appeared in 2008 though:
> >
> http://code.google.com/p/google-guice/issues/detail?id=201&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary%20Extension
> >
> > Please help.
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> > To post to this group, send email to google-gu...@googlegroups.com.
> > To unsubscribe from this group, send email to
> google-guice+unsubscr...@googlegroups.com
> .
> > For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
> >
> >
>
>
>
> --
> "Meaning is differential not referential"
>
> kazik 'morisil' pogoda
> http://www.xemantic.com/ http://blog.xemantic.com/
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To post to this group, send email to google-gu...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-guice+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to google-gu...@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.



Re: "Parameter based singleton scope" in AssistedInject factory?

2010-10-14 Thread Fred Faber
Basically you have a factory that should return a singleton instance for
each unique string value passed into it?

FactoryProvider won't do this for you out of the box, as it will create a
new instance per invocation (as you've illustrated).

What I would do in this case is to decorate your factory with an
implementation that controls singletonness:

interface CacheFactory {
  // This can be named anything you want, not just "create"
  NamedCache create(String name);
}

class CachingCacheFactory implements CacheFactory {

 private final CacheFactory underlyingFactory;

 //
http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/collect/MapMaker.html
 private final Map caches = new MapMaker()
  .makeComputingMap(new Function(){
   @Override public NamedCache apply(String name) {
return underlyingFactory.create(name);
  }
  });

  @Inject
  CachingCacheFactory {
  @AlwaysCreatesNewInstances CacheFactory cacheFactory) {
 this.underlyingFactory = cacheFactory;
   }

  @Override
  NamedCache create(String name) {
  return caches.get(name);
  }
}


* * *

public class YourModule extends AbstractModule {

   @Override protected void configure() {
   // as an alternative to binding this as a singleton, you could inject
the map of caches
   // as a singleton instance.  6 or 1/2 dozen, unless you want to
unittest your
   // implementation, in which case you'll want to inject the singleton
map
   bind(CacheFactory.class)
   .to(CachingCacheFactory.class)
   .in(Singleton.class);

   //
http://google-guice.googlecode.com/svn/trunk/javadoc/com/google/inject/assistedinject/FactoryModuleBuilder.html
   // this binds a "CacheFactory" instance, annotated with
@AlwaysCreatesNewInstances, to
   // a default factory implementation which will return instances of
NamedCacheLocal when
   // its create() method is invoked
   install(new FactoryModuleBuilder()
   .implement(NamedCache, NamedCacheLocal)
   .build(Key.get(NamedCache.class,
AlwaysCreatesNewInstances.class));
}
}

That should do the trick.

-Fred


On Thu, Oct 14, 2010 at 4:25 AM, Sondre Bjornebekk <
sondre.bjorneb...@gmail.com> wrote:

> Hi,
>
> Trying to use assisted inject and find it pretty neat, the minor
> detail is that it does not quite work for me yet :-)
>
> I have created a Map wrapper to ease switching of caches (typically to
> something like Coherence) for my application. I want the Map to be
> returned "in a Singleton scope, based on the value of the (assisted)
> parameter". I am doing:
>
> bind(CacheFactory.class).toProvider(
> FactoryProvider.newFactory(CacheFactory.class,
> NamedCacheLocal.class) );
>
> And I have:
> /**
>  * A factory for named caches, that later might hide its
> implementation using a cluster wide storage.
>  */
>
> public interface CacheFactory {
>//had to be named create to work with guice assisted inject, so
> renamed from getNamedCache
>public NamedCache create(String name);
> }
>
> public interface NamedCache extends Map {
>public int getHitPercent();
>public String getHitPercentString();
>...
> }
>
> /**
>  * A named cache with a local map as implementation for storage.
>  */
>
> public class NamedCacheLocal implements NamedCache {
> ...
>
>/**
> * Constructs a NamedCacheLocal with its dependencies.
> */
>@Inject
>public NamedCacheLocal(@Assisted String cacheName) {
> ...
> }
>
> I have this (failing) unit test that checks that the same cache is
> used for the same name:
>
>System.out.println("doing put / get test");
>NamedCache namedCache =
> namedCacheFactory.create("myCache");
>namedCache.put("fisk","fesk");
>for(int i=0;i<10; i++){
>Object o = namedCache.get("non-hit");
>namedCache.put("test"+i,"testval"+i);
>}
>Object hit = namedCache.get("fisk");
>System.out.println("cache " + namedCache + " delivered value "
> + hit + " to a hit percent of " + namedCache.getHitPercentString());
>assertTrue(namedCache.getHitPercent() > 8 &&
> namedCache.getHitPercent() < 10);
>NamedCache namedCacheWithSameName =
> namedCacheFactory.create("myCache");
>for(int i=0;i<10; i++){
>String val = namedCacheWithSameName.get("test"+i);
>System.out.println("got val from cache: " + val);
>}
>//should have used the same reference, thus hit pct now higher
>System.out.println("done with cache " +
> namedCacheWithSameName);
>assertTrue(namedCache.getHitPercent() > 10);
>assertTrue(namedCache.equals(namedCacheWithSameName));
>
>
> So is the thing I put in quotation marks in the intro ("in a Singleton
> scope, based on the value of the (assisted) parameter") even possible
> just by Guice config, or do I have to go two steps back and one
> forward and just implement the CacheFactory myself with this logic?
> The 

Re: Guice not intercepting annotations on superclass methods

2010-10-14 Thread Kazimierz Pogoda
Maybe these matchers will work for your interceptors:

http://code.google.com/p/tadedon/source/browse/tadedon-guice-utils/src/main/java/com/xemantic/tadedon/guice/matcher/AnnotationMatchers.java

Here are unit tests:
http://code.google.com/p/tadedon/source/browse/tadedon-guice-utils/src/test/java/com/xemantic/tadedon/guice/matcher/AnnotationMatchersTest.java

These matchers use AnnotationUtils from spring framework:

http://static.springsource.org/spring/docs/3.0.4.RELEASE/javadoc-api/org/springframework/core/annotation/AnnotationUtils.html

The question is if guice should take similar approach to annotation
matching? Now only getAnnotation() method is called.


On Thu, Oct 14, 2010 at 4:49 AM, Dmitriy  wrote:
> Hi!
>
> It seems that Guice is not intercepting annotations on superclass
> methods.
> I wrote a suite of tests where each class under test inherits one
> method from a base test.
> That base test method is declared @Transactional, which we intercept
> ourselves.
>
> This has worked great until recently! Unfortunately something happened
> where that method is not intercepted anymore.
> The methods that are not in superclass and annotated ARE still
> intercepted.  I dug in a little deeper and it appears that
> ..getAnnotation() does not return the
> annotation if the method is inherited.  That is what causes Guice to
> not intercept.
>
> But what has changed?
> The only thing I can think of was that we upgraded Java to
> jdk1.6.0_20.
>
> Seems like this issue already appeared in 2008 though:
> http://code.google.com/p/google-guice/issues/detail?id=201&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary%20Extension
>
> Please help.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "google-guice" group.
> To post to this group, send email to google-gu...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-guice+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-guice?hl=en.
>
>



-- 
"Meaning is differential not referential"

kazik 'morisil' pogoda
http://www.xemantic.com/ http://blog.xemantic.com/

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to google-gu...@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.



"Parameter based singleton scope" in AssistedInject factory?

2010-10-14 Thread Sondre Bjornebekk
Hi,

Trying to use assisted inject and find it pretty neat, the minor
detail is that it does not quite work for me yet :-)

I have created a Map wrapper to ease switching of caches (typically to
something like Coherence) for my application. I want the Map to be
returned "in a Singleton scope, based on the value of the (assisted)
parameter". I am doing:

bind(CacheFactory.class).toProvider( 
FactoryProvider.newFactory(CacheFactory.class,
NamedCacheLocal.class) );

And I have:
/**
 * A factory for named caches, that later might hide its
implementation using a cluster wide storage.
 */

public interface CacheFactory {
//had to be named create to work with guice assisted inject, so
renamed from getNamedCache
public NamedCache create(String name);
}

public interface NamedCache extends Map {
public int getHitPercent();
public String getHitPercentString();
...
}

/**
 * A named cache with a local map as implementation for storage.
 */

public class NamedCacheLocal implements NamedCache {
...

/**
 * Constructs a NamedCacheLocal with its dependencies.
 */
@Inject
public NamedCacheLocal(@Assisted String cacheName) {
...
}

I have this (failing) unit test that checks that the same cache is
used for the same name:

System.out.println("doing put / get test");
NamedCache namedCache =
namedCacheFactory.create("myCache");
namedCache.put("fisk","fesk");
for(int i=0;i<10; i++){
Object o = namedCache.get("non-hit");
namedCache.put("test"+i,"testval"+i);
}
Object hit = namedCache.get("fisk");
System.out.println("cache " + namedCache + " delivered value "
+ hit + " to a hit percent of " + namedCache.getHitPercentString());
assertTrue(namedCache.getHitPercent() > 8 &&
namedCache.getHitPercent() < 10);
NamedCache namedCacheWithSameName =
namedCacheFactory.create("myCache");
for(int i=0;i<10; i++){
String val = namedCacheWithSameName.get("test"+i);
System.out.println("got val from cache: " + val);
}
//should have used the same reference, thus hit pct now higher
System.out.println("done with cache " +
namedCacheWithSameName);
assertTrue(namedCache.getHitPercent() > 10);
assertTrue(namedCache.equals(namedCacheWithSameName));


So is the thing I put in quotation marks in the intro ("in a Singleton
scope, based on the value of the (assisted) parameter") even possible
just by Guice config, or do I have to go two steps back and one
forward and just implement the CacheFactory myself with this logic?
The first thing I tried was

bind( CacheFactory.class ).
toProvider( FactoryProvider.newFactory(CacheFactory.class,
NamedCacheLocal.class) ) .
in ( Singleton.class );

But that (of course) just gives me a singleton CacheFactory, not the
NamedCacheLocal "singleton" based on the assisted factory parameter.

Cheers,

Sondre

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to google-gu...@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.



Guice not intercepting annotations on superclass methods

2010-10-14 Thread Dmitriy
Hi!

It seems that Guice is not intercepting annotations on superclass
methods.
I wrote a suite of tests where each class under test inherits one
method from a base test.
That base test method is declared @Transactional, which we intercept
ourselves.

This has worked great until recently! Unfortunately something happened
where that method is not intercepted anymore.
The methods that are not in superclass and annotated ARE still
intercepted.  I dug in a little deeper and it appears that
..getAnnotation() does not return the
annotation if the method is inherited.  That is what causes Guice to
not intercept.

But what has changed?
The only thing I can think of was that we upgraded Java to
jdk1.6.0_20.

Seems like this issue already appeared in 2008 though:
http://code.google.com/p/google-guice/issues/detail?id=201&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary%20Extension

Please help.

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to google-gu...@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.