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 | |
parent | 8b294d9e4f02625c4c3391612242969fb4b6be57 (diff) | |
download | aspectj-11ab99f1c46007b084873d1050da2f9e78e43c82.tar.gz aspectj-11ab99f1c46007b084873d1050da2f9e78e43c82.zip |
test and fixes for 117681
-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 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java | 1 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/ajc150.xml | 5 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | 4 |
8 files changed, 80 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"/> diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java index 3c7dc1639..9bbd0d49e 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java @@ -1107,6 +1107,10 @@ public class BcelTypeMunger extends ConcreteTypeMunger { body.append(Utility.createGet(fact, munger.getDelegate())); int pos = 0; + if (!introduced.isStatic()) { // skip 'this' + //body.append(InstructionFactory.createThis()); + pos++; + } Type[] paramTypes = BcelWorld.makeBcelTypes(introduced.getParameterTypes()); for (int i = 0, len = paramTypes.length; i < len; i++) { Type paramType = paramTypes[i]; |