Bug 81863 - Annotation matching using within() PCD doesn't appear to be working.
Summary: Annotation matching using within() PCD doesn't appear to be working.
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-23 10:54 EST by Andrew Clement CLA
Modified: 2005-01-12 04:08 EST (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 2004-12-23 10:54:16 EST
From discussion on aspectj list:

Hi,

Well, having just done some testing, I think this even simpler case shows 
within() is not behaving correctly for annotations:

@Entity
public class myClass1 {...}

public class myClass2 {...}

public aspect myAspect {
  before():call(* *(..)) && within(@Entity *) {
  }
}

The pointcut matches all the method calls in myClass1 and myClass2 
(effectively it is parsing but then ignoring the annotation specified
in the within()).

So, what you want to do is valid but AspectJ is misbehaving - you get a 
stack overflow because the perthis() clause is also matching on your aspect 
type when obviously that doesnt have the annotation and shouldnt be matched.



Andy.
---
Andy Clement
AspectJ Development



Rifflard Mickaël <Mickael.Rifflard@atosorigin.com> 
Sent by: aspectj-users-admin@eclipse.org
22/12/2004 16:56
Please respond to
aspectj-users@eclipse.org
	
To
<aspectj-users@eclipse.org>
cc

Subject
[aspectj-users] Aspect instance on JDK 1.5 annotation
	

	


Hi all, 
I'm currently trying to get an aspect instance for an object instance with
specific JDK 1.5 annotation. 
Exemple : 
        Create an aspect instance for all object like that : 
        @Entity 
        public class myClass { ... } 
I try 
        public aspect myAspect perthis(within(@Entity *)) {...} 
but this aspect execution lead to a java.lang.StackOverflowError exception. 
Is it possible ? 
Thanks. 
        Mickaël 
        
_______________________________________________ aspectj-users mailing list
aspectj-users@eclipse.org http://dev.eclipse.org/mailman/listinfo/aspectj-users
Comment 1 Andrew Clement CLA 2005-01-12 04:08:14 EST
Fixed, build available:

BUILD COMPLETE -  build.429
Date of build: 01/11/2005 11:52:16
Time to build: 103 minutes 38 seconds
Last changed: 01/11/2005 11:22:16
Latest good AspectJ jar available at:
download.eclipse.org/technology/ajdt/dev/aspectj-DEVELOPMENT.jar