Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » New to AspectJ(Having trouble getting Aspect recognised)
New to AspectJ [message #639273] Mon, 15 November 2010 20:05
Mark Gallagher is currently offline Mark GallagherFriend
Messages: 1
Registered: November 2010
Junior Member
Hi, New here

I am just starting to have a go at adding basic aspects to my java code in eclipse 3.6, i've added the Aspect add on to my eclipse editor and have also converted the files to aspect files and im sure that i have converted the project to AspectJ as well. im getting the error "Syntax error on token "aspect", interface expected", does anyone have any other ideas on why this might be happening and how to fix it, i've included my code where i have tried to add the first aspect below, is there anything else i should by adding?

Thanks in advance

import java.util.ArrayList; 

public class RaceSim { 

        public static void main(String[] args) { 
                
                

        //Creating 8 heats 
                Heat heat1Round1 = new Heat1(); 
                Heat heat2Round1 = new Heat2(); 
                Heat heat3Round1 = new Heat3(); 
                Heat heat4Round1 = new Heat4(); 
                Heat heat5Round1 = new Heat5(); 
                Heat heat6Round1 = new Heat6(); 
                Heat heat7Round1 = new Heat7(); 
                Heat heat8Round1 = new Heat8(); 
                
                
                  Runner[] r = new Runner[65];   
              
                  
        for(int i = 1; i <= 64; i++) {   
        
               r[i] = new Runner("firstname "+i, "lastname "+i, 0.00); 
          
                 }   

                
        int count=1; 
        
        for(int i=1; i<=64;i++){ 
        
        if(count<=8){ 
        heat1Round1.addRunner(r[i]); 
        } 
        else if(count<=16){ 
        
        
        heat2Round1.addRunner(r[i]); 
        
        }else if(count<=24){ 
        
        heat3Round1.addRunner(r[i]); 
        
        }else if(count<=32){ 
        
        
        heat4Round1.addRunner(r[i]); 
        
        }else if(count<=40){ 
        
        heat5Round1.addRunner(r[i]); 
        
        }else if(count<=48){ 
        
        heat6Round1.addRunner(r[i]); 
        
        }else if(count<=56){ 
        
        heat7Round1.addRunner(r[i]); 
        
        }else { 
        
        heat8Round1.addRunner(r[i]); 
        
        } 
        
        
        
        count+=1; 
         } 
    Round round1 = new Round1(); 
    
    
    round1.addHeat(heat1Round1); 
                round1.addHeat(heat2Round1); 
                round1.addHeat(heat3Round1); 
                round1.addHeat(heat4Round1); 
                round1.addHeat(heat5Round1); 
                round1.addHeat(heat6Round1); 
                round1.addHeat(heat7Round1); 
                round1.addHeat(heat8Round1); 
    round1.displayRunners();   
        
                heat1Round1.runRace(); 
                heat2Round1.runRace(); 
                heat3Round1.runRace(); 
                heat4Round1.runRace(); 
                heat5Round1.runRace(); 
                heat6Round1.runRace(); 
                heat7Round1.runRace(); 
                heat8Round1.runRace(); 
                                
                //Finding winners for heats 
                heat1Round1.getWinnersFromHeat(); 
                heat2Round1.getWinnersFromHeat(); 
                heat3Round1.getWinnersFromHeat(); 
                heat4Round1.getWinnersFromHeat(); 
                heat5Round1.getWinnersFromHeat(); 
                heat6Round1.getWinnersFromHeat(); 
                heat7Round1.getWinnersFromHeat(); 
                heat8Round1.getWinnersFromHeat(); 
                
                aspect SimpleTracing { 
                    pointcut tracedCall(): 
                        call(void round1.displayHeats()); 
                        

                    before(): traceCall() { 
                    System.out.println("Entering: " + thisJoinPoint); 
                    } 
    } 
                

                
                //creating heats for round2 
                Heat heat1Round2 =new Heat1(); 
                Heat heat2Round2 =new Heat2(); 
                Heat heat3Round2 =new Heat3(); 
                Heat heat4Round2 =new Heat4(); 
                //getting previous winners form heats from round 1 
                heat1Round2.getWinnersFromPreviousRound(heat1Round1); 
                heat1Round2.getWinnersFromPreviousRound(heat2Round1); 
                heat2Round2.getWinnersFromPreviousRound(heat3Round1); 
                heat2Round2.getWinnersFromPreviousRound(heat4Round1); 
                heat3Round2.getWinnersFromPreviousRound(heat5Round1); 
                heat3Round2.getWinnersFromPreviousRound(heat6Round1); 
                heat4Round2.getWinnersFromPreviousRound(heat7Round1); 
                heat4Round2.getWinnersFromPreviousRound(heat8Round1); 
                
                //running race with combined winners of first heats from round 1 
                heat1Round2.runRace(); 
                heat2Round2.runRace(); 
                heat3Round2.runRace(); 
                heat4Round2.runRace(); 
                
                //getting winners 
                heat1Round2.getWinnersFromHeat(); 
                heat2Round2.getWinnersFromHeat(); 
                heat3Round2.getWinnersFromHeat(); 
                heat4Round2.getWinnersFromHeat(); 
                
                //creating round 2 
                Round round2 = new Round2(); 
                //adding heat 1 to round 2 
                round2.addHeat(heat1Round2); 
                round2.addHeat(heat2Round2); 
                round2.addHeat(heat3Round2); 
                round2.addHeat(heat4Round2); 
                //displaying heat 1 round 2 
                round2.displayHeats(); 

                Heat semiFinal1 =new Heat1(); 
                Heat semiFinal2 =new Heat2(); 
                
                semiFinal1.getWinnersFromPreviousRound(heat1Round2); 
                semiFinal1.getWinnersFromPreviousRound(heat2Round2); 
                semiFinal2.getWinnersFromPreviousRound(heat3Round2); 
                semiFinal2.getWinnersFromPreviousRound(heat4Round2); 
        
                semiFinal1.runRace(); 
                semiFinal2.runRace(); 
                
                semiFinal1.getWinnersFromHeat(); 
                semiFinal2.getWinnersFromHeat(); 
                
                Round semiFinal = new semiFinal(); 
        
                semiFinal.addHeat(semiFinal1); 
                semiFinal.addHeat(semiFinal2); 
                
                
                semiFinal.displayHeats(); 
                
                
                Heat Final =new Heat1(); 
        
                
                Final.getWinnersFromPreviousRound(semiFinal1); 
                Final.getWinnersFromPreviousRound(semiFinal2); 
                
                Final.runRace(); 
                
                
                Final.getWinnersFromFinal(); 
                
                Round round4 = new Round4(); 
                
                round4.addHeat(Final); 
                                
                round4.displayHeats(); 
                
                } 
}  
]

Previous Topic:Equinox Weaving with @Aspect
Next Topic:Problem with "Eclipse-SupplementBundle: *"
Goto Forum:
  


Current Time: Sat Apr 27 03:18:22 GMT 2024

Powered by FUDForum. Page generated in 0.02808 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top