Thanks for your reply.
So, there's no way to change the pointcut definition or something else
to make my example work?
I'm trying to intercept calls to a method in derived classes and then
call the parent's base method.

Regards,
Karl

On Fri, Oct 6, 2017 at 7:11 PM, Henrique Rebêlo <h...@cin.ufpe.br> wrote:
> Hi Sanders,
>
> This is just because the super you're calling is from the aspect's
> supertype, which is the type object in this case...
>
> Em sex, 6 de out de 2017 às 13:37, Karl Sanders <karlsander...@gmail.com>
> escreveu:
>>
>> Hi,
>> I have this example code:
>>
>>
>> public class A {
>>     public String getName() { return "A"; }
>> }
>>
>> public class B extends A {
>>     @Override
>>     public String getName() { return "B";}
>> }
>>
>> public aspect Test {
>>     String around(): execution(public String A+.getName())
>>                      && !within(A) {
>>         String text = "advice";
>>         // text = super.getName();
>>         System.out.println(text);
>>         return proceed();
>>     }
>> }
>>
>> public class Main {
>>     public static void main(String[] args) {
>>         System.out.println(new B().getName());
>>     }
>> }
>>
>>
>> If I run the main method I get this output:
>>     advice
>>     B
>>
>> Now I hoped that by removing the comment from the line inside
>> the advice I would get:
>>     A
>>     B
>>
>> But the code simply doesn't compile, with this message:
>>     The method getName() is undefined for the type Object
>>
>> I found this message:
>>     https://dev.eclipse.org/mhonarc/lists/aspectj-users/msg12163.html
>> and it seems quite clearly to explain what's the issue with my example.
>> Since some time has passed I would like to ask if it's still not possible
>> to call the base method using super.
>>
>> Regards,
>> Karl
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@eclipse.org
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
> --
> ...............................................................................................................................
> Henrique Rebelo
> http://www.cin.ufpe.br/~hemr
> Centro de Informática
> Universidade Federal de Pernambuco , Brazil
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@eclipse.org
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to