--- /dev/null
+public aspect Pr88652 {
+
+ pointcut p(): call(Touple.new(..));
+
+ declare warning: p() : "should match";
+
+ public static void main(String[] args) {
+ Touple t = new Touple(new Object());
+ Touple t2 = new Touple(new Object(),new Object());
+ }
+}
+
+
+class Touple {
+
+ public Touple(Object formulaHandle, Object... propositions) {
+ ; // empty
+ }
+
+}
\ No newline at end of file
runTest("invalid cons syntax");
}
+ public void testVarargsInConsBug() {
+ runTest("varargs in constructor sig");
+ }
+
// helper methods.....
public SyntheticRepository createRepos(File cpentry) {
<compile files="Rainbow.java" options="-emacssym,-1.5"/>
</ajc-test>
+ <ajc-test dir="java5/varargs" title="varargs in constructor sig" vm="1.5">
+ <compile files="Pr88652.aj" options="-1.5">
+ <message kind="warning" line="8" text="should match"/>
+ <message kind="warning" line="9" text="should match"/>
+ </compile>
+ </ajc-test>
+
<ajc-test dir="java5/annotations" title="invalid cons syntax" vm="1.5">
<compile files="SyntaxError.aj" options="-1.5">
<message kind="error" line="3" text="Syntax error on token "new", "method name (not constructor)" expected"/>
this.type = type;
}
+ public boolean isArray() {
+ return type.isArray();
+ }
+
/* (non-Javadoc)
* @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern)
*/
* was declared with varargs (Object...). We shouldn't be matching if this is the case.
*/
private boolean isNotMatchBecauseOfVarargsIssue(TypePatternList params,int modifiers) {
- if (params.size()>0 && (modifiers & Constants.ACC_VARARGS)!=0 && // XXX Promote this to an isVarargs() on MethodSignature?
- !params.get(params.size()-1).isVarArgs) {
- return true;
+ if (params.size()>0 && (modifiers & Constants.ACC_VARARGS)!=0) {
+ // we have at least one parameter in the pattern list, and the method has a varargs signature
+ TypePattern lastPattern = params.get(params.size()-1);
+ if (lastPattern.isArray() && !lastPattern.isVarArgs) return true;
}
- return false;
+ return false;
}
public AnnotationTypePattern getAnnotationPattern() {
return annotationPattern == AnnotationTypePattern.ANY;
}
+ public boolean isArray() {
+ return false;
+ }
+
protected TypePattern(boolean includeSubtypes) {
this(includeSubtypes,false);
}
return dim;
}
+ public boolean isArray() {
+ return dim > 1;
+ }
+
/**
* @param targetTypeName
* @return