Browse Source

Tests for 98320, 99228, 99089: [generics][itds]

tags/PRE_ANDY
aclement 19 years ago
parent
commit
d6bfe97b4d

+ 18
- 0
tests/bugs150/PR98320.aj View File

@@ -0,0 +1,18 @@
import java.util.*;

class C {
Set<String> simple_local;
Set<Set<String>> nested_local;
}

aspect Inter_Type_Injector {
Set<String> C.simple_intertype;
Set<Set<String>> C.nested_intertype;

public void test() {
Set<String> simple_local = new C().simple_local; // works
Set<String> simple_intertype = new C().simple_intertype; // works
Set<Set<String>> nested_local = new C().nested_local; // works
Set<Set<String>> nested_intertype = new C().nested_intertype; // fails
}
}

+ 22
- 0
tests/bugs150/PR99228.aj View File

@@ -0,0 +1,22 @@
class Normal { int basicField;}
class Generic<T> { int basicField;}

aspect Injector {
void Normal.method() {}
void Generic.method() {}
int Normal.itdField;
int Generic.itdField;

void test() {
new Normal().method();
new Generic<Integer>().method();
int n1 = new Normal().basicField;
int normal = new Normal().itdField;

int a = new Generic<Integer>().basicField;
int b = new Generic<Integer>().itdField;
int c = new Generic().basicField;
int d = new Generic().itdField;
}
}

+ 12
- 2
tests/bugs150/pr99089/DataClass.java View File

@@ -1,6 +1,16 @@
import java.util.Vector;

public class DataClass {
private Vector<Object> v = new Vector<Object>();
private Vector<Object> getV() { return v; }
private Vector<Object> v = new Vector<Object>();
private Vector<Object> getV() { return v; }

public static void main(String[]argv) {
DataClass dc = new DataClass();
dc.v.add("hello");
dc.doit();
}

public void doit() {
v.add("world");
}
}

+ 8
- 3
tests/bugs150/pr99089/TracingAspect.java View File

@@ -1,7 +1,12 @@
import java.util.Vector;

privileged aspect TracingAspect {
before(DataClass dc): execution(* DataClass.doit()) && this(dc) {
Vector<Object> myV = dc.getV();
}
before(DataClass dc): execution(* DataClass.doit()) && this(dc) {
Vector<Object> myV = dc.getV();
System.err.println("before:Length of v="+myV.size());
}
after(DataClass dc): execution(* DataClass.doit()) && this(dc) {
Vector<Object> myV = dc.getV();
System.err.println("after:Length of v="+myV.size());
}
}

+ 14
- 0
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml View File

@@ -72,6 +72,14 @@
<run class="B"/>
</ajc-test>
<ajc-test dir="bugs150" pr="99228" vm="1.5" title="ITD of a field into a generic class">
<compile files="PR99228.aj" options="-1.5"/>
</ajc-test>
<ajc-test dir="bugs150" pr="98320" vm="1.5" title="intertype with nested generic type">
<compile files="PR98320.aj" options="-1.5"/>
</ajc-test>
<ajc-test dir="decs" pr="42743" title="declare soft of runtime exception">
<compile files="DeclareSoftRuntimeException.aj">
<message kind="warning" line="3" text="MyRuntimeException will not be softened as it is already a RuntimeException"/>
@@ -114,6 +122,12 @@
<ajc-test dir="bugs150/pr99089" vm="1.5" pr="99089" title="ArrayIndexOutOfBoundsException - Generics in privileged aspects">
<compile files="DataClass.java,TracingAspect.java" options="-1.5"/>
<run class="DataClass">
<stderr>
<line text="before:Length of v=1"/>
<line text="after:Length of v=2"/>
</stderr>
</run>
</ajc-test>
<ajc-test dir="bugs150" pr="79554" title="Return in try-block disables catch-block if final-block is present">

Loading…
Cancel
Save