Jan,

It works for me in AJDT 1.4.1 in Eclipse 3.2. How are you building your 
code?

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal) 
Email: Matthew Webster/UK/IBM @ IBMGB, [EMAIL PROTECTED]
http://w3.hursley.ibm.com/~websterm/



Jan <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
28/11/2006 13:08
Please respond to
[email protected]


To
[email protected]
cc

Subject
[aspectj-users] Pointcut expression for matching generic interface






Dear AspectJ users,

Considering the following interface:

public interface IFooService<T extends Foo>
{
  public T create();
  public void save (T foo);
}

with object classes:

class Foo {}
class Bar extends Foo {}

and factory implementation

public class BarService implements IFooService<Bar>
{
  public Bar create() { return new Bar(); }
  public void save (Bar bar)
  {
    // save the object
  }
}

How would one formulate a pointcut expression matching "any method on 
implementations of IFooService"?

I tried the following:
execution(* IFooService.*(..))

but that would only match the create() function, not the save() 
function!!! I suspect this is due to the type erasure that comes into 
play when using generics; IFooService will contain a save(Foo) method, 
while BarService implements a save(Bar) method....these don't match 
exactly.

Still, I'd like to formulate "any implementation of IFooService, with 
any generic type".... ideas?

Regards
Jan Ypma


_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to