Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » Newbiew question: subclassing an aspect belonging to another package
Newbiew question: subclassing an aspect belonging to another package [message #57830] Sat, 22 October 2005 20:57 Go to next message
Mario Scalas is currently offline Mario Scalas
Messages: 32
Registered: July 2009
Member
Hi all,
I'm writing an RCP application and I intend to use aspects to perform some
common tasks among my application views. The one I'm working on now is
ensuring the thread safety in SWT calls ala [1].

I've implemented a generic SwtThreadSafety aspect with some abstract
pointcuts (to be implemented by specific clients). The first clients for
this aspect are a bunch of application views with receive events and need
to update the UI. So far so good: the right join points are captured and
all works ok.

I want the generic SwtThreadSafety aspect to be part of "ui" java package
while the views (and their ad-hoc aspect) belong to the "ui.views" package.

==== Generic aspect ====

package core.ui;

import org.eclipse.ui.PlatformUI;

public abstract aspect SwtThreadSafety {
// Abstract pointcuts and a few around advices
}

==== Views aspect ====

package ui.views;

// Note that this import is marked as "cannot be resolved" :|
import core.ui.SwtThreadSafety;

public aspect ViewsThreadSafety extends SwtThreadSafety {
// Pointcuts definitition
}

The import is not resolved and SwtThreadSafety is not recognized as a type.
Both files are named with the .aj extension.

If I put both of them in the same package, all works ok.

[Sorry for the dumb question] Where am I wrong? :S

Regards
Mario


[1] Swing thread safery aspect from AspectJ in action, chap. 9
Re: Newbiew question: subclassing an aspect belonging to another package [message #57855 is a reply to message #57830] Sat, 22 October 2005 21:57 Go to previous messageGo to next message
Mario Scalas is currently offline Mario Scalas
Messages: 32
Registered: July 2009
Member
Ops, I forgot to say that I'm using eclipse JDT 3.1.1 with the latest AJDT
1.3.0 snapshot (fetched via update manager).

Mario
Re: Newbiew question: subclassing an aspect belonging to another package [message #57879 is a reply to message #57830] Sun, 23 October 2005 14:35 Go to previous message
Mario Scalas is currently offline Mario Scalas
Messages: 32
Registered: July 2009
Member
I'll answer to myself ;) I declared my pointcuts in the abstract aspect as:

public abstract aspect SwtThreadSafety {
abstract pointcut uiMethodCalls();
// other pointcuts and advices
}

Declaring them "protected" fixed the problem.

public abstract aspect SwtThreadSafety {
protected abstract pointcut uiMethodCalls();
// other pointcuts and advices
}

Now I can declare abastract aspects in a package and create implementers in
other packages (keeping the "protected" visibility, of course).

Don't know if it is some kind of a bug or a feature, though :S (I can
replicate everywhere this behaviour).

Hope this will save some time to other people :)

Regards
Mario
Re: Newbiew question: subclassing an aspect belonging to another package [message #590613 is a reply to message #57830] Sat, 22 October 2005 21:57 Go to previous message
Mario Scalas is currently offline Mario Scalas
Messages: 32
Registered: July 2009
Member
Ops, I forgot to say that I'm using eclipse JDT 3.1.1 with the latest AJDT
1.3.0 snapshot (fetched via update manager).

Mario
Re: Newbiew question: subclassing an aspect belonging to another package [message #590632 is a reply to message #57830] Sun, 23 October 2005 14:35 Go to previous message
Mario Scalas is currently offline Mario Scalas
Messages: 32
Registered: July 2009
Member
I'll answer to myself ;) I declared my pointcuts in the abstract aspect as:

public abstract aspect SwtThreadSafety {
abstract pointcut uiMethodCalls();
// other pointcuts and advices
}

Declaring them "protected" fixed the problem.

public abstract aspect SwtThreadSafety {
protected abstract pointcut uiMethodCalls();
// other pointcuts and advices
}

Now I can declare abastract aspects in a package and create implementers in
other packages (keeping the "protected" visibility, of course).

Don't know if it is some kind of a bug or a feature, though :S (I can
replicate everywhere this behaviour).

Hope this will save some time to other people :)

Regards
Mario
Previous Topic:Newbiew question: subclassing an aspect belonging to another package
Next Topic:Problem symbols not shown in Package Explorer
Goto Forum:
  


Current Time: Wed Sep 17 21:42:07 GMT 2014

Powered by FUDForum. Page generated in 0.05152 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software