Browse Source

286473: tests

tags/V1_6_6
aclement 14 years ago
parent
commit
81638e94f8

+ 11
- 0
tests/bugs166/pr286473/Anno.java View File

@@ -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 {

}

+ 5
- 0
tests/bugs166/pr286473/Bottom.java View File

@@ -0,0 +1,5 @@

@Anno
public class Bottom extends Middle {
public void bottom() {}
}

+ 56
- 0
tests/bugs166/pr286473/LTWTest.java View File

@@ -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();
}
}

+ 13
- 0
tests/bugs166/pr286473/Mark.java View File

@@ -0,0 +1,13 @@
public aspect Mark {

public static interface IMarker {
}
public String IMarker.markMethod() {
return "something done";
}
declare parents : ((@Anno *)) implements IMarker;
}

+ 5
- 0
tests/bugs166/pr286473/Middle.java View File

@@ -0,0 +1,5 @@

@Anno
public class Middle extends Top {
public void middle() {}
}

+ 5
- 0
tests/bugs166/pr286473/Top.java View File

@@ -0,0 +1,5 @@

@Anno
public class Top {

}

+ 6
- 0
tests/bugs166/pr286473/aop.xml View File

@@ -0,0 +1,6 @@
<aspectj>
<aspects>
<aspect name="Mark"/>
</aspects>
<weaver options="-showWeaveInfo -Xset:completeBinaryTypes=true"/>
</aspectj>

+ 8
- 0
tests/src/org/aspectj/systemtest/ajc166/Ajc166Tests.java View File

@@ -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");
}

+ 45
- 0
tests/src/org/aspectj/systemtest/ajc166/ajc166.xml View File

@@ -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>

Loading…
Cancel
Save