Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Annotations and assertion failed

Hello Andy,
unluckly enough, my program still fails, even with latest dev release.
I'll patiently wait for a fix.

BTW, when launching the same stuff in Eclipse 3.1, with AJDT build id: 20050713112740, while building my project i get this message (in the shell from which i launched eclipse):
"annotation model reportine problems"

note that it's "reportine" and not "reporting".

I haven't noticed this in previous releases.

Thanks again for your work, we all appreciate what your team is doing for aop.

Valerio

Andy Clement ha scritto:

Hi Valerio,

As I mentioned in my previous post, there are a number of cases where
annotations currently fail to reach the target type/method/field/etc. These are all *bugs* and are discussed in bug 98901. I did fix one
case for another user, but have not fixed the other 30 that are
described in that bug.  If you are lucky then your situation is
covered by the *one* fix I put in - to discover if it is, please
download the latest dev build of AspectJ and try your program again
(download from http://www.eclipse.org/aspectj/downloads.php ).  If
your program still fails when using that version of AspectJ then you
will need to wait until I integrate the fix for 98901 - this should
happen in the next couple of weeks.

Andy.

On 13/07/05, Valerio Schiavoni <ervalerio@xxxxxxxxxx> wrote:
I still an AssertError with the following code
(http://veleno.pastebin.com/312459 for highlight):

public aspect AnnotatorAspect {

           declare @method: public * Pusher+.*(..):
@ManagedResourceAnnotation;

}

/****************************************/
import java.lang.reflect.Method;

class AnnotatorTest {

   public static void main(String[] args){

       Pusher p = new PusherImpl();

       Class<Pusher> clazz = Pusher.class;
       try{
       Method method = clazz.getMethod("push", String.class);
       assert method.getAnnotation(ManagedResourceAnnotation.class) !=
null;

      /*I GET NULL */

System.out.println(method.getAnnotation(ManagedResourceAnnotation.class));


       }catch (NoSuchMethodException e){
           e.printStackTrace();
       }
   }

}

/****************************************/
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.annotation.ElementType;

/**
* Marker annotation to indicate that a resource has to be monitored
*/

/*meta-annotation target only methods */
@Target({ElementType.METHOD})

/*meta-annotation to change default retention policy to runtime*/
@Retention(RetentionPolicy.RUNTIME)

public @interface ManagedResourceAnnotation  {

}
/****************************************/
public class PusherImpl implements Pusher {
       public void push(String s) {

       }

}
/****************************************/
public interface Pusher {

       void push (String s);

}

ajc -version:
AspectJ Compiler 1.5.0M2 built on Thursday Apr 7, 2005 at 12:53:37 GMT

compiling without problems  with:
ajc -1.5 -argfile test.lst

launghing with:
java -ea AnnotatorTest

(to be sure that assertions are enabled)

i get :
Exception in thread "main" java.lang.AssertionError
       at AnnotatorTest.main(AnnotatorTest.java:13)


Anyone with suggestions or comments?

Thanks
Valerio



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users




Back to the top