From: jhugunin Date: Wed, 14 Jan 2004 11:28:13 +0000 (+0000) Subject: Fix for Bugzilla Bug 46280 X-Git-Tag: v_preCompileLoopAlteration~100 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7bbd1f419239dc9e8b46e7fd912b2bc007bbd76a;p=aspectj.git Fix for Bugzilla Bug 46280 compiler issues error on inner aspects when privilieged --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/AjParser.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/AjParser.java index 1b1512d28..be36f8dca 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/AjParser.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/AjParser.java @@ -230,6 +230,10 @@ public class AjParser extends Parser { } aspectDecl.modifiersSourceStart = intStack[intPtr--]; aspectDecl.modifiers = intStack[intPtr--]; + if (isPrivileged) { + aspectDecl.modifiersSourceStart = intStack[intPtr--]; + aspectDecl.modifiers |= intStack[intPtr--]; + } if (aspectDecl.modifiersSourceStart >= 0) { aspectDecl.declarationSourceStart = aspectDecl.modifiersSourceStart; } diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 8b48f4cda..6a68bc4a6 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -6964,6 +6964,13 @@ + + + + + diff --git a/tests/bugs/PrivilegedParsing.java b/tests/bugs/PrivilegedParsing.java new file mode 100644 index 000000000..4fd0e66eb --- /dev/null +++ b/tests/bugs/PrivilegedParsing.java @@ -0,0 +1,41 @@ +public class PrivilegedParsing { + private int hidden; + public int visible; + public PrivilegedParsing(int priv, int pub) { + hidden = priv; + visible = pub; + } + public void doSomething() { + System.out.println("" + hidden + ", " + visible + ""); + } + public static void main(String[] args) { + PrivilegedParsing capsule = new PrivilegedParsing(1, 1); + capsule.doSomething(); + } +} + +aspect Outer { + static privileged //<== JUST TRY TO UNCOMMENT THIS! + aspect Inner { + pointcut call2doSomething(PrivilegedParsing capsule): + call(void PrivilegedParsing.doSomething()) + && target(capsule); + before(PrivilegedParsing capsule): call2doSomething(capsule) { + capsule.visible++; + capsule.hidden++; + } + } +} + +interface Marker { + static privileged //<== JUST TRY TO UNCOMMENT THIS! + aspect Inner { + pointcut call2doSomething(PrivilegedParsing capsule): + call(void PrivilegedParsing.doSomething()) + && target(capsule); + before(PrivilegedParsing capsule): call2doSomething(capsule) { + capsule.visible++; + capsule.hidden++; + } + } +} \ No newline at end of file