diff options
author | aclement <aclement> | 2009-09-23 21:00:59 +0000 |
---|---|---|
committer | aclement <aclement> | 2009-09-23 21:00:59 +0000 |
commit | 81638e94f858bae3ff5ea6e6aceb3df90d58d07e (patch) | |
tree | bc6575eff52a7d8e9fa6d8c9f01858444537b0b5 /tests | |
parent | ede8a85199614e13e431721d4d90b602f0e116cb (diff) | |
download | aspectj-81638e94f858bae3ff5ea6e6aceb3df90d58d07e.tar.gz aspectj-81638e94f858bae3ff5ea6e6aceb3df90d58d07e.zip |
286473: tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bugs166/pr286473/Anno.java | 11 | ||||
-rw-r--r-- | tests/bugs166/pr286473/Bottom.java | 5 | ||||
-rw-r--r-- | tests/bugs166/pr286473/LTWTest.java | 56 | ||||
-rw-r--r-- | tests/bugs166/pr286473/Mark.java | 13 | ||||
-rw-r--r-- | tests/bugs166/pr286473/Middle.java | 5 | ||||
-rw-r--r-- | tests/bugs166/pr286473/Top.java | 5 | ||||
-rw-r--r-- | tests/bugs166/pr286473/aop.xml | 6 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc166/Ajc166Tests.java | 8 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc166/ajc166.xml | 45 |
9 files changed, 154 insertions, 0 deletions
diff --git a/tests/bugs166/pr286473/Anno.java b/tests/bugs166/pr286473/Anno.java new file mode 100644 index 000000000..d7fce2edc --- /dev/null +++ b/tests/bugs166/pr286473/Anno.java @@ -0,0 +1,11 @@ + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface Anno { + +} diff --git a/tests/bugs166/pr286473/Bottom.java b/tests/bugs166/pr286473/Bottom.java new file mode 100644 index 000000000..531cf417d --- /dev/null +++ b/tests/bugs166/pr286473/Bottom.java @@ -0,0 +1,5 @@ + +@Anno +public class Bottom extends Middle { + public void bottom() {} +} diff --git a/tests/bugs166/pr286473/LTWTest.java b/tests/bugs166/pr286473/LTWTest.java new file mode 100644 index 000000000..59b596f86 --- /dev/null +++ b/tests/bugs166/pr286473/LTWTest.java @@ -0,0 +1,56 @@ + +import java.lang.reflect.Method; +import java.util.*; + +public class LTWTest { + + public void noDoubles() throws Exception { + Method[] methods = Bottom.class.getMethods(); + System.out.println("Bottom.getMethods()"); + boolean broken = false; + List<String> l = new ArrayList<String>(); + for (Method method : methods) { + if (!method.getDeclaringClass().equals(Object.class)) { + l.add(method.getName() + " : " + method.getDeclaringClass().getName()); + } + if (method.getDeclaringClass().equals(Bottom.class)) { + if (method.getName().equals("markMethod")) { + broken=true; + } + } + } + Collections.sort(l); + for (String s: l) { + System.out.println(s); + } + if (broken) { + throw new IllegalStateException("Bottom.getMethods() should not include a markMethod() declared by Bottom"); + } + } + + public void grandChildInherits() throws Exception { + Method[] methods = Bottom.class.getDeclaredMethods(); + for (Method method : methods) { + if (method.getName().equals("markMethod")) +throw new RuntimeException(); +// assertThat(method.getName(), not(equalTo("doSomething"))); + } + +/* + methods = Bottom.class.getMethods(); + for (Method method : methods) { + if (method.getName().equals("doSomething")) { + System.out.println(method.getDeclaringClass().getName()); + } + } +*/ + + } + + public static void main(String[] args) throws Exception { + LTWTest t = new LTWTest(); + t.noDoubles(); + t.grandChildInherits(); + } + +} diff --git a/tests/bugs166/pr286473/Mark.java b/tests/bugs166/pr286473/Mark.java new file mode 100644 index 000000000..cbe018a11 --- /dev/null +++ b/tests/bugs166/pr286473/Mark.java @@ -0,0 +1,13 @@ +public aspect Mark { + + public static interface IMarker { + + } + + public String IMarker.markMethod() { + return "something done"; + } + + declare parents : ((@Anno *)) implements IMarker; + +} diff --git a/tests/bugs166/pr286473/Middle.java b/tests/bugs166/pr286473/Middle.java new file mode 100644 index 000000000..7dddb06cf --- /dev/null +++ b/tests/bugs166/pr286473/Middle.java @@ -0,0 +1,5 @@ + +@Anno +public class Middle extends Top { + public void middle() {} +} diff --git a/tests/bugs166/pr286473/Top.java b/tests/bugs166/pr286473/Top.java new file mode 100644 index 000000000..f38360097 --- /dev/null +++ b/tests/bugs166/pr286473/Top.java @@ -0,0 +1,5 @@ + +@Anno +public class Top { + +} diff --git a/tests/bugs166/pr286473/aop.xml b/tests/bugs166/pr286473/aop.xml new file mode 100644 index 000000000..31fb5fe1c --- /dev/null +++ b/tests/bugs166/pr286473/aop.xml @@ -0,0 +1,6 @@ +<aspectj> + <aspects> + <aspect name="Mark"/> + </aspects> + <weaver options="-showWeaveInfo -Xset:completeBinaryTypes=true"/> +</aspectj> diff --git a/tests/src/org/aspectj/systemtest/ajc166/Ajc166Tests.java b/tests/src/org/aspectj/systemtest/ajc166/Ajc166Tests.java index 714e81fac..59265110e 100644 --- a/tests/src/org/aspectj/systemtest/ajc166/Ajc166Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc166/Ajc166Tests.java @@ -18,6 +18,14 @@ import org.aspectj.testing.XMLBasedAjcTestCase; public class Ajc166Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testParentsLTW_286473_binary() { + runTest("parents ltw - binary"); + } + + public void testParentsLTW_286473_ltw() { + runTest("parents ltw - ltw"); + } + public void testNpeForJavacBuilt_290227() { runTest("npe for javac built"); } diff --git a/tests/src/org/aspectj/systemtest/ajc166/ajc166.xml b/tests/src/org/aspectj/systemtest/ajc166/ajc166.xml index 991cfdb68..d19a3b485 100644 --- a/tests/src/org/aspectj/systemtest/ajc166/ajc166.xml +++ b/tests/src/org/aspectj/systemtest/ajc166/ajc166.xml @@ -2,6 +2,51 @@ <suite> + <ajc-test dir="bugs166/pr286473" title="parents ltw - binary"> + <compile files="Anno.java Top.java Middle.java Bottom.java" outjar="code.jar" options="-1.5 -Xlint:ignore"/> + <compile files="Mark.java LTWTest.java" inpath="code.jar" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Type 'Mark$IMarker' (Mark.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> + <message kind="weave" text="Extending interface set for type 'Top' (Top.java) to include 'Mark$IMarker' (Mark.java)"/> + <message kind="weave" text="Type 'Top' (Top.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> + </compile> + <run class="LTWTest"> + <stdout> + <line text="Bottom.getMethods()"/> + <line text="bottom : Bottom"/> + <line text="markMethod : Top"/> + <line text="middle : Middle"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs166/pr286473" title="parents ltw - ltw"> + <compile files="Anno.java Top.java Middle.java Bottom.java" outjar="code.jar" options="-1.5 -Xlint:ignore"/> + <compile files="Mark.java LTWTest.java" classpath="code.jar" options="-1.5"> + </compile> + <run class="LTWTest" ltw="aop.xml"> + <stderr> + <line text="Extending interface set for type 'Top' (Top.java) to include 'Mark$IMarker' (Mark.java)"/> + <line text="Type 'Top' (Top.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> + <line text="Type 'Mark$IMarker' (Mark.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> +<!-- + <line text="Extending interface set for type 'Bottom' (Bottom.java) to include 'Mark$IMarker' (Mark.java)"/> + <line text="Type 'Bottom' (Bottom.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> + <line text="Type 'Mark$IMarker' (Mark.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> + <line text="Extending interface set for type 'Middle' (Middle.java) to include 'Mark$IMarker' (Mark.java)"/> + <line text="Type 'Middle' (Middle.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> + <line text="Extending interface set for type 'Top' (Top.java) to include 'Mark$IMarker' (Mark.java)"/> + <line text="Type 'Top' (Top.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> + --> + </stderr> + <stdout> + <line text="Bottom.getMethods()"/> + <line text="bottom : Bottom"/> + <line text="markMethod : Top"/> + <line text="middle : Middle"/> + </stdout> + </run> + </ajc-test> + <ajc-test dir="bugs166/pr290227" title="npe for javac built"> <compile files="" inpath="javacCode.jar" options="-1.5 -Xlint:ignore"/> </ajc-test> |