Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-dev] Potential bug: Problem with switch statement

I can’t resist adding aspects like this to our source base much longer.  Why don’t we eat our own adoption strategy and start in a lightweight way now?  I’ve integrated the aspect below into my local workspace, and suggest we do the following:

  • Make a “<module>/ajsrc” directory for auxiliary aspects.  Don’t add that directory to the build includes.
  • Add a build target that compiles the module sources along with those “ajsrc”.  Include compilation of rule checking aspects to an ajc compile that is a part of the build/test process.   
  • When working in Eclipse convert the project to have an AspectJ nature, and add “ajsrc” as a source folder.  Don’t overwrite the module’s “.project” file with the new one so that the default for now is a Java project (I’m using separate workspaces for the converted projects and it works well).  

 

The “ajsrc” directory can be ignored by developers and won’t get in the way of how we work now.  However, it lets those of us that feel the need declare API rules do so.  I know that there is a bunch in AJDE that I would like to make explicit.

 

If others agree I would like to commit the weaver aspect that Jim wrote.  Let me know if don’t, or have other suggestions for accomplishing this.

 

Mik

 


From: aspectj-dev-admin@xxxxxxxxxxx [mailto:aspectj-dev-admin@xxxxxxxxxxx] On Behalf Of Jim.Hugunin@xxxxxxxx
Sent: Friday, July 18, 2003 9:24 AM
To: aspectj-dev@xxxxxxxxxxx

 

To close this off, I've applied Andy's patch to the tree in the general form he describes below.  All calls to Instruction.copy() now go through a Utility.copyInstruction() method to work-around the problem with Select.  We should have a rule in the code of the following form:

 

* declare error:

*     call(* Instruction.copy()) && within(org.aspectj.weaver)

*       && !withincode(* Utility.copyInstruction(Instruction)):

*     "use Utility.copyInstruction to work-around bug in Select.copy()";

 

-Jim

 

-----Original Message-----
From: Andrew Clement [mailto:CLEMAS@xxxxxxxxxx]
Sent: Tuesday, July 15, 2003 8:22 AM
To: aspectj-dev@xxxxxxxxxxx
Cc: czhang@xxxxxxxxxxxxxxxx
Subject: Re: [aspectj-dev] Potential bug: Problem with switch statement

 


Hi,

I've just spent the morning looking at bug 39479 - which is to do with inlining constructors that contain switch statements.  I've fixed it - and then saw this note which talks about advice that contains switch statements - I think the code below demonstrates another case of the same bcel bug.  It is to do with Select instructions not supporting copy() correctly.  I've created a patch for the problem and verified it fixes the problem that appears when compiling the sample code below - and the patch doesn't cause any of the existing tests to fail.  Basically, wherever there is a bcel instruction copy() we have to check if its a Select instruction and do something special, until BCEL is fixed.

Have you raised a bugzilla report for it Charles? So I can attach the patch to it?

regards,
- Andy.


 

Wes Isberg <wes@xxxxxxxxxxxxxx>
Sent by: aspectj-users-admin@xxxxxxxxxxx

15/07/2003 07:02
Please respond to aspectj-users

       
        To:        aspectj-users@xxxxxxxxxxx
        cc:        
        Subject:        Re: [aspectj-users] Potential bug: Problem with switch statement




Thanks - would you enter this to the bug database?

Wes

Charles Zhang wrote:

> Hi, AspectJ hackers, here is what I got tonight as a reproducable error.
> Sorry, I searched a bit of the bugzilla but couldn't find anything
> similar. It has something to do with a switch statement in the aspect
> code. Thanks for any information.
>
> To re-produce, compile the following on ajc1.1, ajc1.0, however, is OK.
> Test.java
> public class Test {
>                  public String method1(){
>                                   System.out.println("method1");
>                                   return "method1";
>                  }
>                  
>                  
>                  
>                  public static void  main(String [] args)
>                  {
>                                   System.out.println(new Test().method1());
>                  }
> }
>
> ===========TestAspect.java================
> String around(Test t):target(t)&&
>                  call(public String method1())
>                  {
>                                   int flag = 1;
>                                   switch(flag)
>                                   {
>                                                    case 1:
>                                   }
>                                   return null;
>                  }
>
>
> C:\eclipse\workspace\Test>c:\aspectj1.1\bin\ajc *.java > out
> trouble in:
> public class Test extends java.lang.Object:

> -------8<  SNIP  8<------------
>
> Charles Zhang                                   (http://www.eecg.utoronto.ca/~czhang)
> Computer Group, Dept. of Elec. & Comp. Engineering
> U. of Toronto, Ontario, Canada
> *********************************************************
> " Yawn!!" (Charles Zhang)
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top