Bläddra i källkod

238992: test and fix

tags/V162DEV_M1
aclement 16 år sedan
förälder
incheckning
ad03f314f6

+ 36
- 0
tests/bugs162/pr238992/Foo.java Visa fil

@@ -0,0 +1,36 @@
import java.lang.annotation.*;
import java.io.*;

@Entity(indexed=false)
public class Foo {
public static void main(String []argv) {
Foo f = new Foo();
Goo g = new Goo();
if (f instanceof Serializable) {
throw new RuntimeException("Foo should not implement it");
}
if (!(g instanceof Serializable)) {
throw new RuntimeException("Goo should implement it");
}
if (new Hoo() instanceof Serializable) {
throw new RuntimeException("Hoo should not implement it");
}
}
}

@Entity(indexed=true)
class Goo {
}

@Entity // default is false
class Hoo {
}

@Retention(RetentionPolicy.RUNTIME)
@interface Entity {
boolean indexed() default false;
}

aspect X {
declare parents: (@Entity(indexed=true) *) implements java.io.Serializable;
}

+ 36
- 0
tests/bugs162/pr238992/Foo2.java Visa fil

@@ -0,0 +1,36 @@
import java.lang.annotation.*;
import java.io.*;

@Entity(indexed=false)
public class Foo2 {
public static void main(String []argv) {
Foo2 f = new Foo2();
Goo g = new Goo();
if (f instanceof Serializable) {
throw new RuntimeException("Foo2 should not implement it");
}
if (!(g instanceof Serializable)) {
throw new RuntimeException("Goo should implement it");
}
if (!(new Hoo() instanceof Serializable)) {
throw new RuntimeException("Hoo should implement it");
}
}
}

@Entity(indexed=true)
class Goo {
}

@Entity // default is true
class Hoo {
}

@Retention(RetentionPolicy.RUNTIME)
@interface Entity {
boolean indexed() default true;
}

aspect X {
declare parents: (@Entity(indexed=true) *) implements java.io.Serializable;
}

+ 36
- 0
tests/bugs162/pr238992/Foo3.java Visa fil

@@ -0,0 +1,36 @@
import java.lang.annotation.*;
import java.io.*;

@Entity(i=1)
public class Foo3 {
public static void main(String []argv) {
Foo3 f = new Foo3();
Goo g = new Goo();
if (f instanceof Serializable) {
throw new RuntimeException("Foo3 should not implement it");
}
if (!(g instanceof Serializable)) {
throw new RuntimeException("Goo should implement it");
}
if (new Hoo() instanceof Serializable) {
throw new RuntimeException("Hoo should not implement it");
}
}
}

@Entity(i=2)
class Goo {
}

@Entity // default is 1
class Hoo {
}

@Retention(RetentionPolicy.RUNTIME)
@interface Entity {
int i() default 1;
}

aspect X {
declare parents: (@Entity(i=2) *) implements java.io.Serializable;
}

+ 36
- 0
tests/bugs162/pr238992/Foo4.java Visa fil

@@ -0,0 +1,36 @@
import java.lang.annotation.*;
import java.io.*;

@Entity(i=1)
public class Foo4 {
public static void main(String []argv) {
Foo4 f = new Foo4();
Goo g = new Goo();
if (f instanceof Serializable) {
throw new RuntimeException("Foo4 should not implement it");
}
if (!(g instanceof Serializable)) {
throw new RuntimeException("Goo should implement it");
}
if (!(new Hoo() instanceof Serializable)) {
throw new RuntimeException("Hoo should implement it");
}
}
}

@Entity(i=2)
class Goo {
}

@Entity // default is 2
class Hoo {
}

@Retention(RetentionPolicy.RUNTIME)
@interface Entity {
int i() default 2;
}

aspect X {
declare parents: (@Entity(i=2) *) implements java.io.Serializable;
}

+ 6
- 2
tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java Visa fil

@@ -19,8 +19,12 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
public class Ajc162Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
// AspectJ1.6.2
public void testAnnotationDecp_pr239441() { runTest("annotation decp"); }

// public void testAnnotationDecp_pr239441() { runTest("annotation decp"); }
public void testAnnotationValueDecp_pr238992() { runTest("annotation value decp"); }
public void testAnnotationValueDecp_pr238992_2() { runTest("annotation value decp - 2"); }
public void testAnnotationValueDecp_pr238992_3() { runTest("annotation value decp - 3"); }
public void testAnnotationValueDecp_pr238992_4() { runTest("annotation value decp - 4"); }
public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(Ajc162Tests.class);
}

+ 30
- 0
tests/src/org/aspectj/systemtest/ajc162/ajc162.xml Visa fil

@@ -7,5 +7,35 @@
<compile files="Test3.java SampleAspect.java" options="-1.5 -showWeaveInfo -XhasMember">
</compile>
</ajc-test>
<ajc-test dir="bugs162/pr238992" title="annotation value decp">
<compile files="Foo.java" options="-1.5 -showWeaveInfo">
<message kind="weave" text="Extending interface set for type 'Goo'"/>
</compile>
<run class="Foo"/>
</ajc-test>
<ajc-test dir="bugs162/pr238992" title="annotation value decp - 2">
<compile files="Foo2.java" options="-1.5 -showWeaveInfo">
<message kind="weave" text="Extending interface set for type 'Goo'"/>
<message kind="weave" text="Extending interface set for type 'Hoo'"/>
</compile>
<run class="Foo2"/>
</ajc-test>
<ajc-test dir="bugs162/pr238992" title="annotation value decp - 3">
<compile files="Foo3.java" options="-1.5 -showWeaveInfo">
<message kind="weave" text="Extending interface set for type 'Goo'"/>
</compile>
<run class="Foo3"/>
</ajc-test>
<ajc-test dir="bugs162/pr238992" title="annotation value decp - 4">
<compile files="Foo4.java" options="-1.5 -showWeaveInfo">
<message kind="weave" text="Extending interface set for type 'Goo'"/>
<message kind="weave" text="Extending interface set for type 'Hoo'"/>
</compile>
<run class="Foo4"/>
</ajc-test>

</suite>

Laddar…
Avbryt
Spara