summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-11-04 09:04:58 +0000
committeracolyer <acolyer>2005-11-04 09:04:58 +0000
commitc4ce2448ee0ad553d6768a22e82bba7f437a93fa (patch)
tree78f12db25c289521d7230f7441a174706ee0d6c9
parenta3e8bb5c97809d468330a566d7e548a68b222ad3 (diff)
downloadaspectj-c4ce2448ee0ad553d6768a22e82bba7f437a93fa.tar.gz
aspectj-c4ce2448ee0ad553d6768a22e82bba7f437a93fa.zip
tests for 103741 - use of java 5 specific language features now policed at < 1.5 source level
-rw-r--r--tests/java5/compliance/AJ5FeaturesAtJ14.aj32
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml25
3 files changed, 61 insertions, 0 deletions
diff --git a/tests/java5/compliance/AJ5FeaturesAtJ14.aj b/tests/java5/compliance/AJ5FeaturesAtJ14.aj
new file mode 100644
index 000000000..bc344f86b
--- /dev/null
+++ b/tests/java5/compliance/AJ5FeaturesAtJ14.aj
@@ -0,0 +1,32 @@
+public aspect AJ5FeaturesAtJ14 {
+
+ pointcut p1() : @annotation(Foo);
+
+ pointcut p2() : @this(Foo);
+
+ pointcut p3() : @target(Foo);
+
+ pointcut p4() : @args(Foo);
+
+ pointcut p5() : @within(Foo);
+
+ pointcut p6() : @withincode(Foo);
+
+ declare @type : Bar : @Foo;
+
+ declare @method : * *.main() : @Foo;
+
+ declare @field : * main : @Foo;
+
+ declare @constructor : Bar.new(..) : @Foo;
+
+ // annotations within type and signature patterns...
+
+ pointcut p7() : execution(@Foo * *(..));
+
+ declare parents : (@Foo *) extends Bar;
+}
+
+class Foo {}
+
+class Bar {} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
index af3de4121..92b29d6b8 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
@@ -659,6 +659,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("ITDC with no explicit cons call");
}
+ public void testJava5SpecificFeaturesUsedAtJava14OrLower() {
+ runTest("java 5 pointcuts and declares at pre-java 5 compliance levels");
+ }
+
// helper methods.....
public SyntheticRepository createRepos(File cpentry) {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index 42b96499c..4316e6ec8 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -27,6 +27,31 @@
</compile>
</ajc-test>
+ <ajc-test dir="java5/compliance" title="java 5 pointcuts and declares at pre-java 5 compliance levels">
+ <compile files="AJ5FeaturesAtJ14.aj" options="-1.4">
+ <message kind="error" line="3" text="the @annotation pointcut expression is only supported at Java 5 compliance level or above"/>
+ <message kind="error" line="11" text="the @within pointcut expression is only supported at Java 5 compliance level or above"/>
+ <message kind="error" line="13" text="the @withincode pointcut expression is only supported at Java 5 compliance level or above"/>
+ <message kind="error" line="5" text="the @this pointcut expression is only supported at Java 5 compliance level or above"/>
+ <message kind="error" line="7" text="the @target pointcut expression is only supported at Java 5 compliance level or above"/>
+ <message kind="error" line="9" text="the @args pointcut expression is only supported at Java 5 compliance level or above"/>
+ <message kind="error" line="15" text="declare @type is only supported at Java 5 compliance level or above"/>
+ <message kind="error" line="15" text="annotations are only available if source level is 5.0"/>
+ <message kind="error" line="15" text="cannot convert from Foo to Annotation"/>
+ <message kind="error" line="17" text="declare @method is only supported at Java 5 compliance level or above"/>
+ <message kind="error" line="17" text="annotations are only available if source level is 5.0"/>
+ <message kind="error" line="17" text="cannot convert from Foo to Annotation"/>
+ <message kind="error" line="19" text="declare @field is only supported at Java 5 compliance level or above"/>
+ <message kind="error" line="19" text="annotations are only available if source level is 5.0"/>
+ <message kind="error" line="19" text="cannot convert from Foo to Annotation"/>
+ <message kind="error" line="21" text="declare @constructor is only supported at Java 5 compliance level or above"/>
+ <message kind="error" line="21" text="annotations are only available if source level is 5.0"/>
+ <message kind="error" line="21" text="cannot convert from Foo to Annotation"/>
+ <message kind="error" line="25" text="annotation type patterns are only supported at Java 5 compliance level or above"/>
+ <message kind="error" line="27" text="annotation type patterns are only supported at Java 5 compliance level or above"/>
+ </compile>
+ </ajc-test>
+
<ajc-test dir="bugs150/pr86903" title="bcelrenderer bad">
<compile files="GenericService.java,Service.java,Main.java,BadWormhole.java"/>
<run class="Main"/>