aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs150/pr117681/Audit.java4
-rw-r--r--tests/bugs150/pr117681/AuditImpl.java10
-rw-r--r--tests/bugs150/pr117681/MoodIndicator.java42
-rw-r--r--tests/bugs150/pr117681/Test.java7
-rw-r--r--tests/bugs150/pr117681/TestAspect.java7
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java1
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml5
7 files changed, 76 insertions, 0 deletions
diff --git a/tests/bugs150/pr117681/Audit.java b/tests/bugs150/pr117681/Audit.java
new file mode 100644
index 000000000..b575cef0c
--- /dev/null
+++ b/tests/bugs150/pr117681/Audit.java
@@ -0,0 +1,4 @@
+public interface Audit {
+ public String getLastUpdatedBy();
+ public void setLastUpdatedBy(String un);
+}
diff --git a/tests/bugs150/pr117681/AuditImpl.java b/tests/bugs150/pr117681/AuditImpl.java
new file mode 100644
index 000000000..314321811
--- /dev/null
+++ b/tests/bugs150/pr117681/AuditImpl.java
@@ -0,0 +1,10 @@
+public class AuditImpl implements Audit {
+ private String lastUpdatedBy;
+ public String getLastUpdatedBy() {
+ return lastUpdatedBy;
+ }
+ public void setLastUpdatedBy(String un) {
+ lastUpdatedBy = un;
+ }
+}
+
diff --git a/tests/bugs150/pr117681/MoodIndicator.java b/tests/bugs150/pr117681/MoodIndicator.java
new file mode 100644
index 000000000..ec420ad86
--- /dev/null
+++ b/tests/bugs150/pr117681/MoodIndicator.java
@@ -0,0 +1,42 @@
+import org.aspectj.lang.annotation.*;
+
+class Mood {
+ public final static Mood HAPPY=new Mood();
+}
+ // this interface can be outside of the aspect
+ interface Moody {
+ Mood getMood(int i);
+ };
+
+ // this implementation can be outside of the aspect
+ class MoodyImpl implements Moody {
+ private Mood mood = Mood.HAPPY;
+
+ public Mood getMood(int i) {
+ return mood;
+ }
+ }
+@Aspect
+public class MoodIndicator {
+
+
+ // here is the actual ITD syntax when using @AspectJ
+ // public static is mandatory
+ // the field type must be the introduced interface. It can't be a class.
+ @DeclareParents("C")
+ public static Moody introduced = new MoodyImpl();
+
+// @Before("execution(* *.*(..)) && this(m)")
+// public void feelingMoody(Moody m) {
+// System.out.println("I'm feeling " + m.getMood());
+// }
+
+ public static void main(String []argv) {
+ ((Moody)new C()).getMood(7);
+ }
+}
+
+
+class C {
+
+}
diff --git a/tests/bugs150/pr117681/Test.java b/tests/bugs150/pr117681/Test.java
new file mode 100644
index 000000000..6c7f326a9
--- /dev/null
+++ b/tests/bugs150/pr117681/Test.java
@@ -0,0 +1,7 @@
+public class Test {
+ public static void main(String[] args) {
+ Audit a = (Audit)new Test();
+ a.setLastUpdatedBy("username");
+ System.out.println("Username ="+a.getLastUpdatedBy());
+ }
+}
diff --git a/tests/bugs150/pr117681/TestAspect.java b/tests/bugs150/pr117681/TestAspect.java
new file mode 100644
index 000000000..331677476
--- /dev/null
+++ b/tests/bugs150/pr117681/TestAspect.java
@@ -0,0 +1,7 @@
+import org.aspectj.lang.annotation.*;
+
+@Aspect
+public class TestAspect {
+ @DeclareParents("Test")
+ public static Audit introduced = new AuditImpl();
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
index abec35200..be703cb03 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
@@ -49,6 +49,7 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
public void testGenericITDsAndAbstractMethodError_pr102357() { runTest("generic itds and abstract method error");}
*/
+ public void testAtDeclareParents_pr117681() { runTest("at declare parents");}
public void testPrivilegeProblem_pr87525() { runTest("privilege problem with switch");}
public void testGenericAspects_pr115237() { runTest("aspectOf and generic aspects");}
public void testClassFormatError_pr114436() { runTest("ClassFormatError binary weaving perthis");}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index 373a56a0a..5b072abf7 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -53,6 +53,11 @@
<compile files="Pr112756.aj" options="-warn:assertIdentifier -Xdev:Pinpoint"/>
</ajc-test>
+ <ajc-test dir="bugs150/pr117681" pr="117681" title="at declare parents">
+ <compile files="Test.java,TestAspect.java,Audit.java,AuditImpl.java" options="-1.5"/>
+ <run class="Test"/>
+ </ajc-test>
+
<ajc-test dir="bugs150/pr117296" pr="117296" title="self bounding generic types">
<compile files="PropertySupport.java" options="-1.5"/>
<run class="PropertySupport"/>