Project: AspectJ
Bug 46280 compiler issues error on inner aspects when privilieged
Reported: 2003-11-07 11:32:21 | Status: resolved fixed

The compiler complains that "inner aspects must be static" whenever I try to qualify an inner (and static) aspect as privileged, no matter what the enclosing type is (aspect, interface or class). I was using j2sdk1.4.0_02, AspectJ 1.1, eclipse 2.1 (with AJDT 1.1.3). Test case: ------------------ BASE CLASS: public class Capsule { private int hidden; public int visible; public Capsule(int priv, int pub) { hidden = priv; visible = pub; } public void doSomething() { System.out.println(""" + hidden + ", " + visible + """); } public static void main(String[] args) { Capsule capsule = new Capsule(1, 1); capsule.doSomething(); } } ------------------ ASPECT: public aspect Outer { static //privileged <== JUST TRY TO UNCOMMENT THIS! aspect Inner { pointcut call2doSomething(Capsule capsule): call(void Capsule.doSomething()) && target(capsule); before(Capsule capsule): call2doSomething(capsule) { capsule.visible++; //capsule.hidden++; } } } ------------------ INTERFACE: public interface Marker { static //privileged <== JUST TRY TO UNCOMMENT THIS! aspect Inner { pointcut call2doSomething(Capsule capsule): call(void Capsule.doSomething()) && target(capsule); before(Capsule capsule): call2doSomething(capsule) { capsule.visible++; //capsule.hidden++; } } }

Files changed in fix:
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/AjParser.java tests/bugs/PrivilegedParsing.java