diff options
author | aclement <aclement> | 2005-11-23 12:54:02 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-11-23 12:54:02 +0000 |
commit | 11ab99f1c46007b084873d1050da2f9e78e43c82 (patch) | |
tree | cf099635fac570cdadfede9d9d8a174339df2119 /tests/bugs150 | |
parent | 8b294d9e4f02625c4c3391612242969fb4b6be57 (diff) | |
download | aspectj-11ab99f1c46007b084873d1050da2f9e78e43c82.tar.gz aspectj-11ab99f1c46007b084873d1050da2f9e78e43c82.zip |
test and fixes for 117681
Diffstat (limited to 'tests/bugs150')
-rw-r--r-- | tests/bugs150/pr117681/Audit.java | 4 | ||||
-rw-r--r-- | tests/bugs150/pr117681/AuditImpl.java | 10 | ||||
-rw-r--r-- | tests/bugs150/pr117681/MoodIndicator.java | 42 | ||||
-rw-r--r-- | tests/bugs150/pr117681/Test.java | 7 | ||||
-rw-r--r-- | tests/bugs150/pr117681/TestAspect.java | 7 |
5 files changed, 70 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(); +} |