From a378bdbeeb2f6fe19befbb45d2b44f1afb77ab44 Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 26 Feb 2009 17:12:47 +0000 Subject: [PATCH] 265729: testing ctor/field/method itds --- tests/bugs164/pr265729/Aspect.java | 8 +++ tests/bugs164/pr265729/Fruit.java | 3 + tests/bugs164/pr265729/Orange.java | 4 ++ tests/bugs164/pr265729/Strawberry.java | 4 ++ .../systemtest/ajc164/Ajc164Tests.java | 66 +++++++++++++++++++ .../org/aspectj/systemtest/ajc164/ajc164.xml | 6 ++ 6 files changed, 91 insertions(+) create mode 100644 tests/bugs164/pr265729/Aspect.java create mode 100644 tests/bugs164/pr265729/Fruit.java create mode 100644 tests/bugs164/pr265729/Orange.java create mode 100644 tests/bugs164/pr265729/Strawberry.java diff --git a/tests/bugs164/pr265729/Aspect.java b/tests/bugs164/pr265729/Aspect.java new file mode 100644 index 000000000..5e48a1ca3 --- /dev/null +++ b/tests/bugs164/pr265729/Aspect.java @@ -0,0 +1,8 @@ +import java.awt.*; +import demo.*; + +public aspect Aspect { + public Color Orange.getColor() { return Color.orange; } + public Color Strawberry.color = Color.red; + public Fruit.new(Color c,String name) {this();} +} diff --git a/tests/bugs164/pr265729/Fruit.java b/tests/bugs164/pr265729/Fruit.java new file mode 100644 index 000000000..ffe4d54e9 --- /dev/null +++ b/tests/bugs164/pr265729/Fruit.java @@ -0,0 +1,3 @@ +package demo; +public class Fruit { +} diff --git a/tests/bugs164/pr265729/Orange.java b/tests/bugs164/pr265729/Orange.java new file mode 100644 index 000000000..60c1dbff4 --- /dev/null +++ b/tests/bugs164/pr265729/Orange.java @@ -0,0 +1,4 @@ +package demo; + +public class Orange { +} diff --git a/tests/bugs164/pr265729/Strawberry.java b/tests/bugs164/pr265729/Strawberry.java new file mode 100644 index 000000000..5547e3e36 --- /dev/null +++ b/tests/bugs164/pr265729/Strawberry.java @@ -0,0 +1,4 @@ +package demo; + +public class Strawberry { +} diff --git a/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java b/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java index cfc86fce9..74175ea6a 100644 --- a/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java @@ -11,6 +11,7 @@ package org.aspectj.systemtest.ajc164; import java.io.File; +import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -28,10 +29,75 @@ import org.aspectj.apache.bcel.util.SyntheticRepository; import org.aspectj.asm.AsmManager; import org.aspectj.asm.IHierarchy; import org.aspectj.asm.IProgramElement; +import org.aspectj.asm.IRelationship; import org.aspectj.testing.XMLBasedAjcTestCase; public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + /** + * This test program can be used to compare handles for faulted in binary + * aspects with handles that would be used if the aspect was available as + * source. There are two compile steps in the xml for the test - commenting + * out the first will allow the source handles to be seen, leaving it in + * will switch to binary. Effectively the only difference should be that in + * the binary case the handles are prefixed 'binaries'. + */ + public void testItdsAspectPathModel_pr265729_1() { + runTest("aspectpath model"); + AsmManager model = AsmManager.lastActiveStructureModel; + IHierarchy top = model.getHierarchy(); + printModel(model); + IProgramElement ipe = null; + + // ITD METHOD + // should be the ITD method from the binary aspect: + // public Color Orange.getColor() { return Color.orange; } + ipe = top.findElementForType("demo", "Orange"); + assertNotNull(ipe); + assertEquals(" + + + + + -- 2.39.5