From 75852d7b1915cddfd4ba3dea272324617abdaa60 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 26 Jul 2004 13:28:20 +0000 Subject: [PATCH] Fix for Bug 70619 compiler aborts with "conflicting dominates orders" with circular declare precedences --- tests/ajcTests.xml | 13 +++++++++++++ tests/bugs/bug70619/Conflict.java | 5 +++++ tests/bugs/bug70619/Order1.aj | 8 ++++++++ tests/bugs/bug70619/Order2.aj | 6 ++++++ tests/bugs/bug70619/Precedence.java | 13 +++++++++++++ weaver/src/org/aspectj/weaver/World.java | 11 ++++++++++- 6 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 tests/bugs/bug70619/Conflict.java create mode 100644 tests/bugs/bug70619/Order1.aj create mode 100644 tests/bugs/bug70619/Order2.aj create mode 100644 tests/bugs/bug70619/Precedence.java diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index e540a046e..08d856f20 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -7756,5 +7756,18 @@ + + + + + + + + + + + + diff --git a/tests/bugs/bug70619/Conflict.java b/tests/bugs/bug70619/Conflict.java new file mode 100644 index 000000000..11364ced9 --- /dev/null +++ b/tests/bugs/bug70619/Conflict.java @@ -0,0 +1,5 @@ + +class Conflict { + public static void main(String[] args) { } +} + diff --git a/tests/bugs/bug70619/Order1.aj b/tests/bugs/bug70619/Order1.aj new file mode 100644 index 000000000..01459565f --- /dev/null +++ b/tests/bugs/bug70619/Order1.aj @@ -0,0 +1,8 @@ +aspect Conflict1 { + + + + declare precedence: Conflict1, Conflict2; + + before(): execution(* *(..)) { } +} \ No newline at end of file diff --git a/tests/bugs/bug70619/Order2.aj b/tests/bugs/bug70619/Order2.aj new file mode 100644 index 000000000..9ee9c55cb --- /dev/null +++ b/tests/bugs/bug70619/Order2.aj @@ -0,0 +1,6 @@ +aspect Conflict2 { + after(): execution(* *(..)) { } + declare precedence: Conflict2, Conflict1; + + +} \ No newline at end of file diff --git a/tests/bugs/bug70619/Precedence.java b/tests/bugs/bug70619/Precedence.java new file mode 100644 index 000000000..306801867 --- /dev/null +++ b/tests/bugs/bug70619/Precedence.java @@ -0,0 +1,13 @@ +class Conflict { public static void main(String[] args) { } } + +aspect Conflict1 { + declare precedence: Conflict1,Conflict2; + + before(): execution(* *(..)) { } +} + +aspect Conflict2 { + declare precedence: Conflict2, Conflict1; + + after(): execution(* *(..)) { } +} \ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/World.java b/weaver/src/org/aspectj/weaver/World.java index 0d019fd1c..6da90ebca 100644 --- a/weaver/src/org/aspectj/weaver/World.java +++ b/weaver/src/org/aspectj/weaver/World.java @@ -300,13 +300,22 @@ public abstract class World { //??? number of dominates declares in the whole system. //??? This method can be called a large number of times. int order = 0; + DeclarePrecedence orderer = null; // Records the declare precedence statement that gives the first ordering for (Iterator i = crosscuttingMembersSet.getDeclareDominates().iterator(); i.hasNext(); ) { DeclarePrecedence d = (DeclarePrecedence)i.next(); int thisOrder = d.compare(aspect1, aspect2); //System.out.println("comparing: " + thisOrder + ": " + d); if (thisOrder != 0) { + if (orderer==null) orderer = d; if (order != 0 && order != thisOrder) { - throw new BCException("conflicting dominates orders"); + ISourceLocation[] isls = new ISourceLocation[2]; + isls[0]=orderer.getSourceLocation(); + isls[1]=d.getSourceLocation(); + Message m = + new Message("conflicting declare precedence orderings for aspects: "+ + aspect1.getName()+" and "+aspect2.getName(),null,true,isls); + messageHandler.handleMessage(m); + // throw new BCException("conflicting dominates orders"+d.getSourceLocation()); } else { order = thisOrder; } -- 2.39.5