Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Method call in super class within an around advice

Hi Holger,

I think you can't call super directly this way. The only alternative I can think of is to introduce (with an ITD) a method that does the super call, and call that method from the advice.

Hope this helps,

-- Éric

On May 31, 2010, at 4:10 PM, Holger King wrote:

> Hi,
> 
> I'm new to AspectJ - so I hope this is not a silly question!
> 
> The original question is: is there a way to call methods in super-classes within an "around"-advice? If yes, how? ;)
> 
> I created a named PointCut using a certain parameter list to make them available in the advice context later:
> 
> pointcut logAbstractGenerationContext(String type, String name, Map params, AbstractGenerationContext abstractGenCtx) :
>                execution(public Printable de.subpackage.subpackage.generate.AbstractGenerationContext+.getTemplate(String, String, Map) throws IOException) &&
>                args(type, name, params) && this(abstractGenCtx);
> 
> 
> The advice is defined as follows:
> 
> Printable around(String type, String name, Map params, AbstractGenerationContext abstractGenCtx) throws IOException : logAbstractGenerationContext(type, name, params, abstractGenCtx) {
>    ...        
>    if(type == null)
>        return super.getTemplate(null, name, params);
>    ...
> }
> 
> But the parser always marks the "super" variable. I already tried some flavors - but still no success.
> 
> Hint: the aspect has been declared "privileged" to allow access on private or protected variables of the provided "AbstractGenerationContext" instance.
> 
> Maybe, you can help me to solve that (easy) problem?
> -- 
> ----------------------------
> e-mail:
> HolgerKing@xxxxxxx
> 
> address:
> Eckenhofstr. 36
> 78713 Schramberg
> Germany
> 
> call:
> +49/(0) 74 22/5 34 93
> ----------------------------
> 
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top