Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] static crosscutting and type patterns

hi everybody, 

I have a question concerning static crosscutting and type patterns. 
in the docu there is an example which is what I want to achieve: 

aspect A { 
    private Registry otherPackage.*.r; 
    public void otherPackage.*.register(Registry r) { 
        r.register(this); 
        this.r = r; 
    } 
} 

unfortunatelly, though, the [OnType] identifier otherPackage.* does not
work for me :-(

has this changed? 

perhaps there is another way to achieve: 

I have three classes foo.A,foo.B,foo.C and an Interface I. 
The interface implementation is generic, but I don't want to write an
abstract base class, since there is already a base class. 

so I wanted to do the following (which when hard coding the identifier
"OnType" works well ) 

interface I { 

   public void doIt( ); 
} 

aspect { 

  declare parents: foo.* implements I;  /* this works perfectly ! */ 

  /* but now I want to crosscut the methods, which work, if */ 
  public void foo.A.doIt( ) { 
     System.out.println( "finished!" ); 
  } 

  /* but not when I do : */ 
  public void foo.*.doIt( ) { 
     System.out.println( "this won't compile :-(" ); 
  } 

} 

is there a new, or other way to achieve it? 
is there a way to externalize the type declarations (like load type
names from a list, so you don't have to change the aspect, when a new
package, or class is added ) ? 


thank you in advance

-- Jakob 
btw: i am using aspectj 1.1 



Back to the top