Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Generic Aspect Inter-Type Method needs access on generic type methods

How about just casting in the ITD?

        ((ConstrainingClass)this)..someConstrainingClassMethod();

I have thought about adding the ability to ITD directly onto type
variables, just haven't gotten around to exploring the finer details
yet:

 public abstract aspect GenericAspect<Type extends ConstrainingClass> {
        public void Type.someMethod() {
                this.someConstrainingClassMethod();
        }
 }

Andy

On 30 June 2010 07:11, Kurt Zitze <Garz@xxxxxxx> wrote:
> Hi,
>
> i want to make inter-type declarations which do not refer to a concrete type. Hence i am using a generic aspect which has a generic type parameter. For inter-type declarations i need to define an interface which will be the target for the inter-type declarations and which the generic type implements. It is just like descibed in the section Generic Aspect here: http://www.eclipse.org/aspectj/doc/next/adk15notebook/generics-inAspectJ5.html
>
> Here is the aspect:
> public abstract aspect GenericAspect<Type extends ConstrainingClass> {
>
>        interface HelperInterface {
>                void someMethod();
>        }
>
>        declare parents: Type implements HelperInterface;
>
>        public void HelperInterface.someMethod() {
>                this.someConstrainingClassMethod();
>        }
> }
>
> As you can see, i want to call ConstrainingClass.someConstrainingClassMethod() which is declared on ConstrainingClass, but this is not possible since HelperInterface does not know about the methods of ConstrainingClass. Maybe i could extend the interface with the interface of ConstrainingClass but the problem is that this class does not implement any interface (its from some foreign library).
>
> Is it possible somehow? In the end i want to have an aspect that can be applied (by binding its generic parameter) to arbitrary classes extending ConstrainingClass while using methods of ConstrainingClass.
>
> Best regards
> garz
> --
> 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