compiler aborts with "conflicting dominates orders" with circular declare precedencestags/for_ajdt1_1_12
@@ -7756,5 +7756,18 @@ | |||
<message kind="error" line="2" text="if() pointcut designator cannot be used directly in a per clause"/> | |||
</compile> | |||
</ajc-test> | |||
<ajc-test dir="bugs/bug70619" | |||
pr="70619" title="compiler aborts with 'conflicting dominates orders' with circular declare precedences"> | |||
<compile files="Precedence.java"> | |||
<message kind="error" line="0" text="conflicting declare precedence"/> | |||
</compile> | |||
<compile files="Conflict.java,Order2.aj,Order1.aj"> | |||
<message kind="error" line="0" text="conflicting declare precedence"/> | |||
</compile> | |||
<compile files="Conflict.java,Order1.aj,Order2.aj"> | |||
<message kind="error" line="0" text="conflicting declare precedence"/> | |||
</compile> | |||
</ajc-test> | |||
</suite> |
@@ -0,0 +1,5 @@ | |||
class Conflict { | |||
public static void main(String[] args) { } | |||
} | |||
@@ -0,0 +1,8 @@ | |||
aspect Conflict1 { | |||
declare precedence: Conflict1, Conflict2; | |||
before(): execution(* *(..)) { } | |||
} |
@@ -0,0 +1,6 @@ | |||
aspect Conflict2 { | |||
after(): execution(* *(..)) { } | |||
declare precedence: Conflict2, Conflict1; | |||
} |
@@ -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(* *(..)) { } | |||
} |
@@ -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; | |||
} |