Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Generics(?) causes class not be lt-weaved

This example is contrived, but it is a simplified version of a real
production scenario. 

I have two simple classes, AbstractFoo and Foo:

public abstract class AbstractFoo<T> { /* empty */ }

public class Foo extends AbstractFoo<Integer> {

    @Transactional  // could be any pointcut annotation 
    public void whatever() {
        System.err.println("*** I'm Foo");
    }
}


Then I have two classes for the test:

public abstract class AbstractFooTest<TYPE> {
    protected abstract AbstractFoo<TYPE> getFoo();
}

public class FooTest extends AbstractFooTest<Integer> {

    protected Foo getFoo() {return null;}
    
    private Foo foo = new Foo();
    
    @Test
    public void nothing() { 
        foo.doit();
    }
}


In the above scenario the method Foo.whatever() should be weaved, but is
not. If the signatures of the abstract/protected method in the test/subtest
are changed to:

protected abstract Object AbstractFooTest.getFoo();
protected Object FooTest.getFoo() { .. }

Then Foo is weaved.

I have tried this with 1.5.4 and 1.6.0m1 with the same results. How could a
signature on a method not even in the target class effect whether the
pointcut is matched?

-barry




-- 
View this message in context: http://www.nabble.com/Generics%28-%29-causes-class-not-be-lt-weaved-tp15032820p15032820.html
Sent from the AspectJ - users mailing list archive at Nabble.com.



Back to the top