Bug 531819 - Negative parameter annotation matching not behaving
Summary: Negative parameter annotation matching not behaving
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.9.0.RC1   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 1.9.0   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-28 15:02 EST by Andrew Clement CLA
Modified: 2018-02-28 15:17 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 2018-02-28 15:02:04 EST
In this program:

import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME)
@interface Anno {}

public class Code {
        public Code(@Anno String boo) {}
        public Code(Object boo) {}
}

aspect X {
        before(): execution(new(!@Anno (*))) { }
}

It is incorrectly advising both constructors.
Comment 1 Andrew Clement CLA 2018-02-28 15:05:13 EST
There is a behaviour in SignaturePattern.matchesExactlyMethod() that needs copying to matchesExactlyConstructor() - to pass the parameters annotations through on a second call to parameterTypes.matches() when considering the generic form of the parameters. Without that it is matching !@Anno against an empty set of annotations which is considered a valid match.
Comment 2 Andrew Clement CLA 2018-02-28 15:17:48 EST
Fixed