--- /dev/null
+import java.io.*;
+
+class SomeClass {
+ public void doSomething() { }
+}
+
+aspect DoesntCompile {
+
+ declare parents : SomeClass implements Serializable;
+
+ pointcut doSomething(SomeClass someClass) :
+ execution(void SomeClass.doSomething()) &&
+ this(someClass);
+
+ void around(Serializable myWorld) : doSomething(myWorld) { }
+
+}
\ No newline at end of file
runTest("parameterized generic methods");
}
+ public void testIllegalChangeToPointcutDeclaration_pr111915() {
+ runTest("test illegal change to pointcut declaration");
+ }
+
public void testCantProvideDefaultImplViaITD_pr110307_1() {runTest("Cant provide default implementation via ITD - 1");}
public void testCantProvideDefaultImplViaITD_pr110307_2() {runTest("Cant provide default implementation via ITD - 2");}
public void testCantProvideDefaultImplViaITD_pr110307_3() {runTest("Cant provide default implementation via ITD - 3");}
<ajc-test dir="java5/staticImports" title="import static java.lang.System.out">
<compile files="StaticImport.aj" options="-1.5"/>
</ajc-test>
+
+ <ajc-test dir="bugs150" title="test illegal change to pointcut declaration">
+ <compile files="pr111915.java" options="-1.5 -showWeaveInfo">
+ <message kind="weave" text="Join point 'method-execution(void SomeClass.doSomething())' in Type 'SomeClass' (pr111915.java:4) advised by around advice from 'DoesntCompile' (pr111915.java:15)"/>
+ <message kind="weave" text="Extending interface set for type 'SomeClass' (pr111915.java) to include 'java.io.Serializable' (pr111915.java)"/>
+ </compile>
+ </ajc-test>
<ajc-test dir="java5/bridgeMethods" pr="72766" title="Ignore bridge methods">
<compile files="AspectX.aj" inpath="testcode.jar" options="-showWeaveInfo">
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.MessageUtil;
import org.aspectj.util.FuzzyBoolean;
-import org.aspectj.weaver.BCException;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedPointcutDefinition;
!p.getExactType().equals(UnresolvedType.OBJECT))
{
scope.message(IMessage.ERROR, p, "incompatible type, expected " +
- parameterTypes[i].getName() + " found " + p);
+ parameterTypes[i].getName() + " found " + p +". Check the type specified in your pointcut");
return;
}
}
for (int i=0,len=arguments.size(); i < len; i++) {
TypePattern p = arguments.get(i);
if (p == TypePattern.NO) continue;
- //we are allowed to bind to pointcuts which use subtypes as this is type safe
- if (!p.matchesSubtypes(parameterTypes[i]) &&
- !p.getExactType().equals(UnresolvedType.OBJECT))
- {
- throw new BCException("illegal change to pointcut declaration: " + this);
- }
-
+ // we are allowed to bind to pointcuts which use subtypes as this is type safe
+ // this will be checked in ReferencePointcut.resolveBindings(). Can't check it here
+ // as we don't know about any new parents added via decp.
if (p instanceof BindingTypePattern) {
newBindings.put(i, ((BindingTypePattern)p).getFormalIndex());
}
}
-
+
if (searchStart.isParameterizedType()) {
// build a type map mapping type variable names in the generic type to
// the type parameters presented