diff options
author | Andy Clement <aclement@gopivotal.com> | 2014-10-06 17:35:51 -0700 |
---|---|---|
committer | Andy Clement <aclement@gopivotal.com> | 2014-10-06 17:35:51 -0700 |
commit | c8e951296c5f95e82d4c7c3f8eb9b0a647014e20 (patch) | |
tree | 2eaed5b80ad735e4c91e424098e35e221f4fea44 /tests/java5 | |
parent | 102173fc11fc6648ed8f2283d3c5ad535e412c73 (diff) | |
download | aspectj-c8e951296c5f95e82d4c7c3f8eb9b0a647014e20.tar.gz aspectj-c8e951296c5f95e82d4c7c3f8eb9b0a647014e20.zip |
Fix 436653: conditional aspect activation plus various polish
Modified test expectation system so it is possible to say
the test cares about one particular message and the rest
do not matter (prefix message string with '*') - crude but
quick.
Polished many places to exploit generics
Upgraded all the tests to work on Java8 - some serious changes
regarding ajdoc on Java8. Hopefully it has stayed backwards
compatible with earlier JDK versions (e.g. if using AspectJ 1.8.3+
with a JDK less than 8) but no explicit testing done for this.
Diffstat (limited to 'tests/java5')
-rw-r--r-- | tests/java5/annotations/itds/AtItd3.aj | 3 | ||||
-rw-r--r-- | tests/java5/ataspectj/ajc-ant.xml | 8 | ||||
-rw-r--r-- | tests/java5/ataspectj/annotationGen/SA.aj | 14 | ||||
-rw-r--r-- | tests/java5/ataspectj/annotationGen/SA.class | bin | 0 -> 2832 bytes | |||
-rw-r--r-- | tests/java5/ataspectj/annotationGen/SimpleAspect.aj | 4 | ||||
-rw-r--r-- | tests/java5/ataspectj/annotationGen/SimpleAspect.class | bin | 0 -> 2725 bytes |
6 files changed, 22 insertions, 7 deletions
diff --git a/tests/java5/annotations/itds/AtItd3.aj b/tests/java5/annotations/itds/AtItd3.aj index bc6c671f9..c3412cf56 100644 --- a/tests/java5/annotations/itds/AtItd3.aj +++ b/tests/java5/annotations/itds/AtItd3.aj @@ -22,7 +22,8 @@ public class AtItd3 { Annotation aa = m.getAnnotation(Ann.class); System.err.println("Ann.class retrieved is: "+aa); - if (!aa.toString().equals("@Ann(id=goodbye, anInt=4)")) + if (!aa.toString().equals("@Ann(id=goodbye, anInt=4)")) // < Java8 order + if (!aa.toString().equals("@Ann(anInt=4, id=goodbye)")) // Java8 order throw new RuntimeException("Incorrect output, expected:"+ "@Ann(id=goodbye, anInt=4) but got "+aa.toString()); diff --git a/tests/java5/ataspectj/ajc-ant.xml b/tests/java5/ataspectj/ajc-ant.xml index 4f2e9f36c..0730d7b85 100644 --- a/tests/java5/ataspectj/ajc-ant.xml +++ b/tests/java5/ataspectj/ajc-ant.xml @@ -10,7 +10,7 @@ <target name="compile:javac"> <!-- compile only javac compilable stuff, exclude the one that needs other dependencies --> - <javac target="1.5" destdir="${aj.sandbox}" classpathref="aj.path" + <javac source="1.5" target="1.5" destdir="${aj.sandbox}" classpathref="aj.path" srcdir="${basedir}" includes="ataspectj/*" excludes="ataspectj/UnweavableTest.java" @@ -75,7 +75,7 @@ <target name="ltw.Aspect2MainTest"> <!-- javac Aspect2 --> - <javac target="1.5" destdir="${aj.sandbox}" classpathref="aj.path" + <javac source="1.5" target="1.5" destdir="${aj.sandbox}" classpathref="aj.path" srcdir="${basedir}" includes="ataspectj/ltwreweavable/Aspect2.java" debug="true"> @@ -125,7 +125,7 @@ </target> <target name="ltw.Unweavable"> - <javac target="1.5" destdir="${aj.sandbox}" + <javac source="1.5" target="1.5" destdir="${aj.sandbox}" srcdir="${basedir}" includes="ataspectj/UnweavableTest.java, ataspectj/TestHelper.java" debug="true"> @@ -171,7 +171,7 @@ <target name="ltw.Decp2"> <!-- javac compile the 2nd aspect --> - <javac target="1.5" destdir="${aj.sandbox}" + <javac source="1.5" target="1.5" destdir="${aj.sandbox}" srcdir="${basedir}" includes="ataspectj/DeclareParentsImplementsReweavableTestAspect.java" debug="true"> diff --git a/tests/java5/ataspectj/annotationGen/SA.aj b/tests/java5/ataspectj/annotationGen/SA.aj new file mode 100644 index 000000000..5ca3d661a --- /dev/null +++ b/tests/java5/ataspectj/annotationGen/SA.aj @@ -0,0 +1,14 @@ +import org.aspectj.lang.annotation.Aspect; +import java.lang.annotation.*; + +public aspect SA { + + public static void main(String[] args) { + Annotation[] annotations = SA.class.getAnnotations(); + if (annotations.length != 1) throw new RuntimeException("Should have one annotation but has "+annotations.length); + Aspect aspectAnnotation = (Aspect) annotations[0]; +System.out.println(aspectAnnotation); + if (!aspectAnnotation.value().equals("")) throw new RuntimeException("value should be empty"); + } + +} diff --git a/tests/java5/ataspectj/annotationGen/SA.class b/tests/java5/ataspectj/annotationGen/SA.class Binary files differnew file mode 100644 index 000000000..1ce9f8f94 --- /dev/null +++ b/tests/java5/ataspectj/annotationGen/SA.class diff --git a/tests/java5/ataspectj/annotationGen/SimpleAspect.aj b/tests/java5/ataspectj/annotationGen/SimpleAspect.aj index 34f6954dc..731ef5ca9 100644 --- a/tests/java5/ataspectj/annotationGen/SimpleAspect.aj +++ b/tests/java5/ataspectj/annotationGen/SimpleAspect.aj @@ -5,9 +5,9 @@ public aspect SimpleAspect { public static void main(String[] args) { Annotation[] annotations = SimpleAspect.class.getAnnotations(); - if (annotations.length != 1) throw new RuntimeException("Should have one annotation"); + if (annotations.length != 1) throw new RuntimeException("Should have one annotation but has "+annotations.length); Aspect aspectAnnotation = (Aspect) annotations[0]; if (!aspectAnnotation.value().equals("")) throw new RuntimeException("value should be empty"); } -}
\ No newline at end of file +} diff --git a/tests/java5/ataspectj/annotationGen/SimpleAspect.class b/tests/java5/ataspectj/annotationGen/SimpleAspect.class Binary files differnew file mode 100644 index 000000000..a5d815f04 --- /dev/null +++ b/tests/java5/ataspectj/annotationGen/SimpleAspect.class |