Re: [aspectwerkz-dev] Re: RES: [aspectwerkz-user] Aspects Inheritance error
the_mindstorm <[email protected]> Thu, 28 Oct 2004 01:23:16 +0300
| Newsgroups | gmane.comp.java.aspectwerkz.devel |
|---|---|
| Message-ID | <[email protected]> |
Quote [Alexandre Vasseur]:
> yes i do
> is there really a need to provide a fix ? I don't see a bug there.
> Protected advice just don't makes sense at all.
>
agree with you. but you have pointed before that a package advice should be allowed. so having a
simple example like:
package foo.bar;
public class Foo {
void beforeAdvice(JoinPoint jp) throws Exception {
}
}
package foo.bar;
public class Bar extends Foo {
}
and considering a class in the same foo.bar package, Bar will fail advicing it.
(createCompleteSortedMethodList returns only the public methods from the parents).
So to conclude I would prefere to stick to the documenation and keep all advice methods public ;-).
:the_mindstorm
> Alex
>
>
> On Thu, 28 Oct 2004 01:06:13 +0300, the_mindstorm
> <[email protected]> wrote:
>> Quote [Alexandre Vasseur]:
>>
>> > good point !
>> >
>> > A protected advice cannot be invoked when the joinpoint is reached so
>> > this is not allowed.
>> > A private one is not neither.
>> > A package private advice is allowed.
>>
>> I am not sure I got the last one. I guess you are thinking of the case where the aspect and the
>> target are in the same package, ain't it?
>>
>> So should I go for changing those methods?
>>
>> :the_mindstorm
>>
>>
>>
>> >
>> > A protected / private / etc pointcut makes sense. It s quite different.
>> >
>> > Alex
>> >
>> >
>> > On Wed, 27 Oct 2004 23:15:16 +0300, the_mindstorm
>> > <[email protected]> wrote:
>> >> Quote [Alexandre Vasseur]:
>> >>
>> >> > yes I know the issue is there - good digging
>> >> > I d rather have a test case first, that covers protected pointcut as well.
>> >> > Please discuss these kind of thing on dev@
>> >> >
>> >>
>> >> Alex according to documentation it seems that the behavior is correct :-).
>> >>
>> >> [quote]
>> >> In the aspect class the advice are regular methods. The methods needs to conform to a specfic
>> >> signature unless args() selector is used in the pointcut the advice is bounded to.
>> >>
>> >> * For Around advice:
>> >> public Object <name of method>(JoinPoint joinPoint) throws Throwable signature.
>> >>
>> >> * For Before and After advice:
>> >> public void <name of method>(JoinPoint joinPoint) throws Throwable signature.
>> >> [/quote]
>> >>
>> >> Andre reported the problem while using protected methods as advice. Please confirm me if we should
>> >> change this to accept also protected methods (or any other scheme).
>> >>
>> >> If we consider pure java inheritance the problem may become delicate in what regards the package
>> >> protected methods.
>> >>
>> >> :the_mindstorm
>> >>
>> >>
>> >>
>> >>
>> >> >
>> >> > On Wed, 27 Oct 2004 14:12:52 +0300, the_mindstorm
>> >> > <[email protected]> wrote:
>> >> >> I think I have tracked down the problem:
>> >> >>
>> >> >> ReflectHelper.createCompleteSortedMethodList use Class.getMethods and Class.getDeclaredMethods to
>> >> >> create the list of available advice methods. But _neither_ of these will return an inherited
>> >> >> protected method.
>> >> >>
>> >> >> I think that by evening I can send you a patch. Is it oke?
>> >> >>
>> >> >> :the_mindstorm
>> >> >>
>> >> >
>> >>
>> >>
>> >
>>
>>
>