summaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoraclement <aclement>2005-05-12 10:49:25 +0000
committeraclement <aclement>2005-05-12 10:49:25 +0000
commit9b730456c99c01c7381317e7c4511ae238cfd027 (patch)
tree5e88eea3b29b1f231bb5a855beed9cca4765659f /weaver
parent6f27813f57cadc4729e9c501233a1c40520b2f43 (diff)
downloadaspectj-9b730456c99c01c7381317e7c4511ae238cfd027.tar.gz
aspectj-9b730456c99c01c7381317e7c4511ae238cfd027.zip
Reduced duplication of vm checking logic.
Diffstat (limited to 'weaver')
-rw-r--r--weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java20
-rw-r--r--weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java22
2 files changed, 10 insertions, 32 deletions
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java b/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java
index 35c191bbb..37506ad48 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java
+++ b/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java
@@ -20,6 +20,7 @@ import org.aspectj.bridge.AbortException;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.IMessage.Kind;
+import org.aspectj.util.LangUtil;
import org.aspectj.weaver.BcweaverTests;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedTypeX;
@@ -61,19 +62,6 @@ public class AnnotationPatternMatchingTestCase extends TestCase {
private BcelWorld world;
private AnnotationTypePattern fooTP,simpleAnnotationTP;
- private static boolean is13VMOrGreater = true;
- private static boolean is14VMOrGreater = true;
- private static boolean is15VMOrGreater = false;
-
- static {
- String vm = System.getProperty("java.vm.version");
- if (vm.startsWith("1.3")) {
- is14VMOrGreater = false;
- } else if (vm.startsWith("1.5")) {
- is15VMOrGreater = true;
- }
- }
-
private ResolvedTypeX loadType(String name) {
if (world == null) {
world = new BcelWorld(BcweaverTests.TESTDATA_PATH + "/testcode.jar");
@@ -93,7 +81,7 @@ public class AnnotationPatternMatchingTestCase extends TestCase {
public void testAnnotationPatternMatchingOnTypes() {
- if (is15VMOrGreater) {
+ if (LangUtil.is15VMOrGreater()) {
ResolvedTypeX rtx = loadType("AnnotatedClass");
initAnnotationTypePatterns();
@@ -170,7 +158,7 @@ public class AnnotationPatternMatchingTestCase extends TestCase {
}
public void testAnnotationPatternMatchingOnMethods() {
- if (is15VMOrGreater) {
+ if (LangUtil.is15VMOrGreater()) {
ResolvedTypeX rtx = loadType("AnnotatedClass");
ResolvedMember aMethod = rtx.getDeclaredMethods()[1];
@@ -188,7 +176,7 @@ public class AnnotationPatternMatchingTestCase extends TestCase {
}
public void testAnnotationPatternMatchingOnFields() {
- if (is15VMOrGreater) {
+ if (LangUtil.is15VMOrGreater()) {
ResolvedTypeX rtx = loadType("AnnotatedClass");
ResolvedMember aField = rtx.getDeclaredFields()[0];
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java b/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java
index 02f0e274e..7697b43d7 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java
+++ b/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java
@@ -10,6 +10,7 @@
package org.aspectj.weaver.patterns;
import org.aspectj.bridge.AbortException;
+import org.aspectj.util.LangUtil;
import org.aspectj.weaver.AnnotatedElement;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.BcweaverTests;
@@ -20,18 +21,7 @@ import junit.framework.TestCase;
public class AnnotationPatternTestCase extends TestCase {
- private static boolean is13VMOrGreater = true;
- private static boolean is14VMOrGreater = true;
- private static boolean is15VMOrGreater = false;
-
- static {
- String vm = System.getProperty("java.vm.version");
- if (vm.startsWith("1.3")) {
- is14VMOrGreater = false;
- } else if (vm.startsWith("1.5")) {
- is15VMOrGreater = true;
- }
- }
+
public void testParseSimpleAnnotationPattern() {
PatternParser p = new PatternParser("@Foo");
@@ -254,7 +244,7 @@ public class AnnotationPatternTestCase extends TestCase {
}
public void testExactAnnotationPatternMatching() {
- if (is15VMOrGreater) {
+ if (LangUtil.is15VMOrGreater()) {
PatternParser p = new PatternParser("@Foo");
AnnotationTypePattern ap = p.maybeParseAnnotationPattern();
ap = ap.resolveBindings(makeSimpleScope(),new Bindings(3),true);
@@ -266,7 +256,7 @@ public class AnnotationPatternTestCase extends TestCase {
}
public void testBindingAnnotationPatternMatching() {
- if (is15VMOrGreater) {
+ if (LangUtil.is15VMOrGreater()) {
PatternParser p = new PatternParser("foo");
AnnotationTypePattern ap = p.parseAnnotationNameOrVarTypePattern();
try {
@@ -283,7 +273,7 @@ public class AnnotationPatternTestCase extends TestCase {
}
public void testAndAnnotationPatternMatching() {
- if (is15VMOrGreater) {
+ if (LangUtil.is15VMOrGreater()) {
PatternParser p = new PatternParser("@Foo @Boo");
AnnotationTypePattern ap = p.maybeParseAnnotationPattern();
ap = ap.resolveBindings(makeSimpleScope(),new Bindings(3),true);
@@ -313,7 +303,7 @@ public class AnnotationPatternTestCase extends TestCase {
// }
//
public void testNotAnnotationPatternMatching() {
- if (is15VMOrGreater) {
+ if (LangUtil.is15VMOrGreater()) {
PatternParser p = new PatternParser("!@Foo");
AnnotationTypePattern ap = p.maybeParseAnnotationPattern();
ap = ap.resolveBindings(makeSimpleScope(),new Bindings(3),true);