Newbiew question: subclassing an aspect belonging to another package [message #57830] |
Sat, 22 October 2005 16:57  |
Eclipse User |
|
|
|
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 #57879 is a reply to message #57830] |
Sun, 23 October 2005 10:35  |
Eclipse User |
|
|
|
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 #590632 is a reply to message #57830] |
Sun, 23 October 2005 10:35  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.06866 seconds