Bug 198341 - annoated types via declare @type are not always matched in type pattern
Summary: annoated types via declare @type are not always matched in type pattern
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 1.6.2   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-30 21:23 EDT by Vincenz Braun CLA
Modified: 2008-08-22 17:07 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vincenz Braun CLA 2007-07-30 21:23:49 EDT
Take this little Test case:

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface TestAnnotation1 {}

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface TestAnnotation2{}

@TestAnnotation1
public class Annotated {}

public interface Marker {}

public aspect AnnotationAspect {
	
	declare @type: @TestAnnotation1 *: @TestAnnotation2;
	
        // of cource this matches
        // declare parents: (@TestAnnotation1 *)  implements Marker;
        // this matches, too
        // declare parents: (@TestAnnotation2 *)  implements Marker;

        // this does not match on Annotated
	declare parents: (@TestAnnotation2 *) && !java.lang.annotation.Annotation implements Marker;
        // but this does match on annotated
	// declare parents: (@TestAnnotation1 *) && !java.lang.annotation.Annotation implements Marker;
}
Comment 1 Andrew Clement CLA 2008-08-22 17:07:42 EDT
fixed - the implementation of And for type patterns did not defer to its left and right branches when checking whether it represented a '*' annotation pattern.

might still be an issue for ! type patterns involving annotations, but I'll look at that some other time ;)