--- /dev/null
+
+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 {
+
+}
--- /dev/null
+
+@Anno
+public class Bottom extends Middle {
+ public void bottom() {}
+}
--- /dev/null
+
+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();
+ }
+
+}
--- /dev/null
+public aspect Mark {
+
+ public static interface IMarker {
+
+ }
+
+ public String IMarker.markMethod() {
+ return "something done";
+ }
+
+ declare parents : ((@Anno *)) implements IMarker;
+
+}
--- /dev/null
+
+@Anno
+public class Middle extends Top {
+ public void middle() {}
+}
--- /dev/null
+
+@Anno
+public class Top {
+
+}
--- /dev/null
+<aspectj>
+ <aspects>
+ <aspect name="Mark"/>
+ </aspects>
+ <weaver options="-showWeaveInfo -Xset:completeBinaryTypes=true"/>
+</aspectj>
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");
}
<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>