]> source.dussan.org Git - aspectj.git/commitdiff
commented jar target from bcel-builder/build.xml since broken (can someone comment ?)
authoravasseur <avasseur>
Wed, 20 Apr 2005 14:58:14 +0000 (14:58 +0000)
committeravasseur <avasseur>
Wed, 20 Apr 2005 14:58:14 +0000 (14:58 +0000)
impl @Aspect("issingleton")
fixed error reporting on readPerClause from @AJ

bcel-builder/build.xml
runtime/build.xml
tests/java5/ataspectj/ataspectj/IfPointcutTest.java
tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java
tests/src/org/aspectj/systemtest/ajc150/ataspectj/atajc150-tests.xml
weaver/src/org/aspectj/weaver/ataspectj/Aj5Attributes.java

index 476b8eb693dc4c006e267f21ee110ba80032657e..55b28f624140c881baa6fbef692f8c0a5b942677 100644 (file)
        <target name="packageAndPush" depends="buildTheJars,push"/>
        
   <target name="jar" depends="pack">
-    <copy file="../lib/regexp/jakarta-regexp-1.2.jar"
-        tofile="bcel/lib/Regex.jar" />
-    <ant dir="bcel" target="jar" />
-    <copy file="bcel/bin/bcel.jar" toDir="." />
+      <!-- FIXME AV: someone fix this target since it is broken... looks for bcel/build.xml that does not exist -->
+<!--    <copy file="../lib/regexp/jakarta-regexp-1.2.jar"-->
+<!--        tofile="bcel/lib/Regex.jar" />-->
+<!--    <ant dir="bcel" target="jar" />-->
+<!--    <copy file="bcel/bin/bcel.jar" toDir="." />-->
   </target>
   
   <target name="srcjar" depends="pack">
index fb36d8957d86f7cb28b2ee62d4348c6a05e81019..3dd22e1ed40f11c53b84140c55afe1ef9adbf38f 100644 (file)
@@ -28,9 +28,9 @@
     <target name="all" depends="init, compile, test:compile"/>
 
     <target name="jar" depends="compile">
-        <delete file="${build.ajdir}/jars/aspectjrt.jar"/>
+        <delete file="${build.ajdir}/jars/runtime.jar"/>
         <copy file="runtime.mf.txt" todir="${build.ajdir}/temp" filtering="yes"/>
-        <jar destfile="${build.ajdir}/jars/aspectjrt.jar" manifest="${build.ajdir}/temp/runtime.mf.txt">
+        <jar destfile="${build.ajdir}/jars/runtime.jar" manifest="${build.ajdir}/temp/runtime.mf.txt">
             <fileset dir="bin">
                 <include name="**/*"/>
             </fileset>
index 66693ec4a460e9be9777f13d6b6d7933d960f9ed..1073a730bfacd53edafb572e29078005bda840d5 100644 (file)
@@ -30,6 +30,7 @@ public class IfPointcutTest extends TestCase {
     }
 
     public void testIf() {
+        fail("FIXME AV: see below, TestAspect has its advice and pointcut commented out");
         IfPointcutTest me = new IfPointcutTest();
         me.hello(1);
         me.hello(-1);
index c60ffb2ba9944b0355c2347dc55e472b91338f82..ecb517ab426d5074093b80627527a0a4f3894767 100644 (file)
@@ -31,10 +31,9 @@ public class AtAjSyntaxTests extends XMLBasedAjcTestCase {
          return new File("../tests/src/org/aspectj/systemtest/ajc150/ataspectj/atajc150.xml");
        }
        
-// FIXME ATAJ Crashes because of specifying issingleton
-//    public void testSimpleBefore() {
-//        runTest("SimpleBefore");
-//    }
+    public void testSimpleBefore() {
+        runTest("SimpleBefore");
+    }
        
     public void testSimpleAfter() {
         runTest("SimpleAfter");
@@ -65,12 +64,11 @@ public class AtAjSyntaxTests extends XMLBasedAjcTestCase {
 //        runTest("AfterXTest");
 //    }
 
-// FIXME alex @AJ impl + test
-// FIXME andy is this working or not Alex? It was commented out in the branch but uncommenting it - it
-//       runs fine for me.
-    public void testIfPointcut() {
-        runTest("IfPointcutTest");
-    }
+    //FIXME AV uncomment when IfPointcutTest.TestAspect can be compiled ie if() pcd can be parsed.
+    // right now the aspect is commented out.
+//    public void testIfPointcut() {
+//        runTest("IfPointcutTest");
+//    }
 
 // FIXME alex java.lang.VerifyError: (class: ataspectj/BindingTest, method: dup_aroundBody5$advice signature: (ILorg/aspectj/lang/JoinPoint;Lataspectj/BindingTest$TestAspect_1;ILorg/aspectj/lang/ProceedingJoinPoint;)Ljava/lang/Object;) Register 0 contains wrong type
 //    public void testBindings() {
index 39668594eacd0fa433b1c4923e9b5f79efdfb529..3a89a1290dcd24d93ee64f11982802487c7dd61f 100644 (file)
@@ -1,7 +1,9 @@
 <!-- @AspectJ v1.5.0 Tests -->
 
     <ajc-test dir="java5/ataspectj" title="SimpleBefore">
-        <compile files="SimpleBefore.java" options="-1.5 -showWeaveInfo -XnoInline"/>
+        <compile files="SimpleBefore.java" options="-1.5 -showWeaveInfo -XnoInline">
+            <message kind="weave" text="(SimpleBefore.java:13) advised by before advice from 'SimpleBefore$X' (SimpleBefore.java:1)"/>
+        </compile>
         <run class="SimpleBefore"/>
     </ajc-test>
     
index f9c921f7dd5b2b8d0ea24b1bf5f2e53e883577ac..f708b6f8f27fac776354fec5b255f8d6226463d8 100644 (file)
@@ -27,6 +27,8 @@ import org.aspectj.apache.bcel.classfile.annotation.ElementNameValuePair;
 import org.aspectj.apache.bcel.classfile.annotation.RuntimeAnnotations;
 import org.aspectj.apache.bcel.generic.Type;
 import org.aspectj.bridge.IMessageHandler;
+import org.aspectj.bridge.IMessage;
+import org.aspectj.bridge.Message;
 import org.aspectj.lang.JoinPoint;
 import org.aspectj.lang.ProceedingJoinPoint;
 import org.aspectj.weaver.Advice;
@@ -81,14 +83,15 @@ public class Aj5Attributes {
         /**
          * The resolved type (class) for which we are reading @AJ for (be it class, method, field annotations)
          */
-        ResolvedTypeX enclosingType;
+        final ResolvedTypeX enclosingType;
 
-        ISourceContext context;
-        IMessageHandler handler;
+        final ISourceContext context;
+        final IMessageHandler handler;
 
-        public AjAttributeStruct(ResolvedTypeX type, ISourceContext sourceContext) {
+        public AjAttributeStruct(ResolvedTypeX type, ISourceContext sourceContext, IMessageHandler messageHandler) {
             enclosingType = type;
             context = sourceContext;
+            handler = messageHandler;
         }
     }
 
@@ -105,10 +108,10 @@ public class Aj5Attributes {
          */
         private String[] m_argumentNamesLazy = null;
 
-        Method method;
+        final Method method;
 
-        public AjAttributeMethodStruct(Method method, ResolvedTypeX type, ISourceContext sourceContext) {
-            super(type, sourceContext);
+        public AjAttributeMethodStruct(Method method, ResolvedTypeX type, ISourceContext sourceContext, IMessageHandler messageHandler) {
+            super(type, sourceContext, messageHandler);
             this.method = method;
         }
 
@@ -140,7 +143,7 @@ public class Aj5Attributes {
      * @return list of AjAttributes
      */
     public static List readAj5ClassAttributes(JavaClass javaClass, ResolvedTypeX type, ISourceContext context,IMessageHandler msgHandler) {
-        AjAttributeStruct struct = new AjAttributeStruct(type, context);
+        AjAttributeStruct struct = new AjAttributeStruct(type, context, msgHandler);
         Attribute[] attributes = javaClass.getAttributes();
         for (int i = 0; i < attributes.length; i++) {
             Attribute attribute = attributes[i];
@@ -159,7 +162,7 @@ public class Aj5Attributes {
         for (int m = 0; m < javaClass.getMethods().length; m++) {
             Method method = javaClass.getMethods()[m];
             //FIXME alex optimize, this method struct will gets recreated for advice extraction
-            AjAttributeMethodStruct mstruct = new AjAttributeMethodStruct(method, type, context);
+            AjAttributeMethodStruct mstruct = new AjAttributeMethodStruct(method, type, context, msgHandler);
             Attribute[] mattributes = method.getAttributes();
 
             for (int i = 0; i < mattributes.length; i++) {
@@ -185,7 +188,7 @@ public class Aj5Attributes {
      * @return list of AjAttributes
      */
     public static List readAj5MethodAttributes(Method method, ResolvedTypeX type, ISourceContext context,IMessageHandler msgHandler) {
-        AjAttributeMethodStruct struct = new AjAttributeMethodStruct(method, type, context);
+        AjAttributeMethodStruct struct = new AjAttributeMethodStruct(method, type, context, msgHandler);
         Attribute[] attributes = method.getAttributes();
 
         for (int i = 0; i < attributes.length; i++) {
@@ -236,7 +239,7 @@ public class Aj5Attributes {
                 if (perX == null || perX.length()<=0) {
                      clause = new PerSingleton();
                 } else {
-                    clause = readPerClausePointcut(perX);
+                    clause = parsePerClausePointcut(perX, struct);
                 }
                 clause.setLocation(struct.context, -1, -1);
                 struct.ajAttributes.add(new AjAttribute.Aspect(clause));
@@ -248,10 +251,11 @@ public class Aj5Attributes {
      * Read a perClause
      *
      * @param perClause like "pertarget(.....)"
+     * @param struct for which we are parsing the per clause
      * @return a PerClause instance
      */
-    private static PerClause readPerClausePointcut(String perClause) {
-        String pointcut;
+    private static PerClause parsePerClausePointcut(String perClause, AjAttributeStruct struct) {
+        final String pointcut;
         if (perClause.startsWith(PerClause.KindAnnotationPrefix.PERCFLOW.getName())) {
             pointcut = PerClause.KindAnnotationPrefix.PERCFLOW.extractPointcut(perClause);
             return new PerCflow(Pointcut.fromString(pointcut), false);
@@ -267,7 +271,17 @@ public class Aj5Attributes {
         } else if (perClause.startsWith(PerClause.KindAnnotationPrefix.PERTYPEWITHIN.getName())) {
             pointcut = PerClause.KindAnnotationPrefix.PERTYPEWITHIN.extractPointcut(perClause);
             return new PerTypeWithin(new PatternParser(pointcut).parseTypePattern());
+        } else if (perClause.equalsIgnoreCase(PerClause.SINGLETON.getName())) {
+            return new PerSingleton();
         }
+        // could not parse the @AJ perclause
+        struct.handler.handleMessage(
+                new Message(
+                        "cannot read per clause from @Aspect: " + perClause,
+                        null,//TODO
+                        true
+                )
+        );
         throw new RuntimeException("cannot read perclause " + perClause);
     }