Bug 315651 - wacky program causes unhelpful infinite loop
Summary: wacky program causes unhelpful infinite loop
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.6.9   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 1.6.9   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-03 15:02 EDT by Andrew Clement CLA
Modified: 2010-06-03 15:36 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2010-06-03 15:02:38 EDT
reported on the list by Eric Tanter:

package test;
public aspect Profiling {
       pointcut profile(): execution(* *.*(..)) ;

       private pointcut scope() :
                       if(condition())
                       //&& !(execution(* *.condition())) <- uncomment and infinite loop disappears
                       && !cflow(execution(* *.condition()));

       public static boolean condition(){
               return (Math.random()<2); //always true
       }
       before(): profile() && scope() {
               System.out.println("Entering method "+thisJoinPointStaticPart.getSignature());
       }
}

package test;
public class Main {

       private static int plus(int first, int second){
               return first + second;
       }
       public static void main(String[] args) {
               int num = plus(42,13);
               System.out.println(num);
       }
}

this loops infinitely unless the commented out section is uncommented.
Comment 1 Andrew Clement CLA 2010-06-03 15:36:14 EDT
test and fix committed.  adjusted pointcut sorting order to make cflow ahead of if.  We were failing to consider the 'ConcreteCflowPointcut' class in PointcutEvaluationExpenseComparator.getScore()