Skip to main content

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

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


Back to the top