Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] LTW, inter-type fields and pertarget() aspects

With the example you sent everything goes fine. So I tried what happens if I run my real app with aj5 instead of through a run configuration in Eclipse using the -javaagent parameter. Unfortunately the result is the same, no ITDs. The base class I'm trying to instrument is abstract, can that be the problem? Or am I maybe using the combination of ITD and "target()" wrongly?


Do you really need to use call() rather than execution() in your pointcuts? call() with ltw tends to only be suitable for catching calls to system libraries that are not easy to weave with execution().

What's the significant difference?
Right now I don't see any reason why I cannot use "execution" instead. "call" just felt more tidy, because I didn't know about "this()" for execution pointcuts.

Jochen




public aspect JspIdConsumerUnique {

private boolean UIComponentClassicTagBase.lumi_uniquePropertySet = false;
       private Object UIComponentClassicTagBase.uniqueProperty = null;

pointcut instanceCreation( UIComponentClassicTagBase _consumer ): this(_consumer) && execution( UIComponentClassicTagBase +.new(..) );


after(UIComponentClassicTagBase _consumer) : instanceCreation( _consumer ) {
               safeAddObject( _consumer );
       }

pointcut setUniqueProperty( UIComponentClassicTagBase _consumer ): target(_consumer) &&
               call( * UIComponentClassicTagBase+.setJspId(..) );

// ITD USED HERE

before( UIComponentClassicTagBase _consumer ): setUniqueProperty( _consumer ) {
               if ( _consumer.lumi_uniquePropertySet ) {
_consumer.uniqueProperty = _consumer.getJspId();
               }
       }

//AND HERE

after( UIComponentClassicTagBase _consumer ): setUniqueProperty( _consumer ) { if ( propertyHasChanged( _consumer.uniqueProperty, _consumer.getJspId() ) ) {
                       _consumer.lumi_uniquePropertySet = true;
updateContainer( _consumer.uniqueProperty, _consumer );
               }
       }

       //private methods go here
}



Back to the top