--- /dev/null
+package patterntesting.check.runtime;
+
+public @interface NotNull { }
--- /dev/null
+package patterntesting.check.runtime;
+
+public aspect NotNullAspect {
+
+ pointcut ctorWithNotNullArg() :
+ execution(*..*.new(*)) && @args(NotNull);
+
+ before() : ctorWithNotNullArg() {
+ Object[] args = thisJoinPoint.getArgs();
+ if (args[0] == null) {
+ throw new AssertionError("@NotNull constraint violated");
+ }
+ }
+
+}
--- /dev/null
+package patterntesting.check.runtime;
+
+
+public class NotNullTest {
+
+ private String s2;
+ private static final String nullString = null;
+
+ public NotNullTest() {
+ }
+
+ public NotNullTest(@NotNull String s) {
+ s2 = s;
+ }
+
+ public static void main(String []argv) {
+ new NotNullTest("something");
+ new NotNullTest(nullString);
+ }
+
+}
public class Ajc163Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+ public void testNonNullAtArgs_pr257833() {
+ runTest("param annos and at args");
+ }
+
// public void testAtAspectJDecp_pr164016() {
// runTest("ataspectj decp");
// }
<message kind="warning" line="4" text="has not been applied"/>
</compile>
</ajc-test>
+
+ <ajc-test dir="bugs163/pr257833" title="param annos and at args">
+ <compile files="NotNull.java NotNullAspect.java NotNullTest.java" options="-1.5 -showWeaveInfo">
+ <message kind="weave" text="Join point 'constructor-execution(void patterntesting.check.runtime.NotNullTest.<init>(java.lang.String))' in Type"/>
+ </compile>
+ <run class="patterntesting.check.runtime.NotNullTest"/>
+ </ajc-test>
<ajc-test dir="bugs163/pr253109" title="generic pointcuts - 2">
<compile files="CodeTwo.java" options="-1.5"/>