Bug 340025 - stack trace - Compiler Error Using perthis and @Aspectj annotation in a RCP plugin workspace.
Summary: stack trace - Compiler Error Using perthis and @Aspectj annotation in a RCP p...
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-15 10:09 EDT by Davide Aresta CLA
Modified: 2013-06-24 11:06 EDT (History)
1 user (show)

See Also:


Attachments
workspace Eclipse example which gives the error (69.54 KB, application/x-zip-compressed)
2011-03-15 10:16 EDT, Davide Aresta CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Davide Aresta CLA 2011-03-15 10:09:37 EDT
Build Identifier: 20110301-1815

Having two plugins in an RCP project one containing RCP and the other containing aspects for the first plugin. If using @AspectJ notation in a RCP class that extends one of the aspects described in the Aspects plugin (using "perthis" modifier) it causes a StackOver flow error.

Reproducible: Always

Steps to Reproduce:
1.Create a RCP plugin application and add AspectJ nature to it

2. Create another RCP plugin (with an activator) with Aspects for the first plugin:

3.Create a ThreadSafetyAspects.aj in this last Aspectj plugin

/**
 * Reusable aspect for implementing the thread safety through a mutex.
 */
@Aspect( "perthis( readOperations() || writeOperations() )" )
public abstract class ThreadSafetyAspect {
    /**
     * Defines the read operations (operations that do not change the locked stuff). 
     */
    @Pointcut( "" )
    protected abstract void readOperations();
    
    /**
     * Defines the write operations (operations that do change the locked stuff). 
     */
    @Pointcut( "" )
    protected abstract void writeOperations();
    
    private ReadWriteLock _lock = new ReentrantReadWriteLock();
    
    @Before( "readOperations()" )
    public void beforeRead() {
        _lock.readLock().lock();
    }

    @After( "readOperations()" )
    public void afterRead() {
        _lock.readLock().unlock();
    }

    @Before( "writeOperations()" )
    public void beforeWrite() {
        _lock.writeLock().lock();
    }

    @After( "writeOperations()" )
    public void afterWrite() {
        _lock.writeLock().unlock();
    }
}

4. create a Main class in the first RCP plugin and add this aspect: 
 @Aspect
  public static class OwnThreadSafety extends ThreadSafetyAspect {

      @Pointcut( "")
      protected void readOperations() {}

      @Pointcut( "" )
      protected void writeOperations() {}
  }
Comment 1 Davide Aresta CLA 2011-03-15 10:16:09 EDT
Created attachment 191215 [details]
workspace Eclipse example which gives the error
Comment 2 Davide Aresta CLA 2011-03-15 10:17:16 EDT
5. Add the Aspect plugin project in the Aspect Path of the RCP "Hello World" plugin application.

Then comes the error described...
Comment 3 Andrew Clement CLA 2013-06-24 11:06:40 EDT
unsetting the target field which is currently set for something already released