]> source.dussan.org Git - aspectj.git/commitdiff
Remove checks for old Java Versions
authorLars Grefer <eclipse@larsgrefer.de>
Thu, 13 Aug 2020 21:21:11 +0000 (23:21 +0200)
committerLars Grefer <eclipse@larsgrefer.de>
Thu, 13 Aug 2020 21:21:11 +0000 (23:21 +0200)
Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
24 files changed:
ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java
loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/TraceFactory.java
org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ArgsTestCase.java
org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ThisOrTargetTestCase.java
testing/src/test/java/org/aspectj/testing/AjcTest.java
tests/src/test/java/org/aspectj/systemtest/ajc11/Ajc11Tests.java
tests/src/test/java/org/aspectj/systemtest/ajc150/Ajc150Tests.java
tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java
tests/src/test/java/org/aspectj/systemtest/java14/Java14Tests.java
tests/src/test/java/org/aspectj/tests/TestsModuleTests.java
util/src/main/java/org/aspectj/util/LangUtil.java
util/src/test/java/org/aspectj/util/LangUtilTest.java
weaver/src/main/java/org/aspectj/weaver/ltw/LTWWorld.java
weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java
weaver/src/test/java/org/aspectj/weaver/TypeXTestCase.java
weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java
weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java
weaver/src/test/java/org/aspectj/weaver/tools/PointcutDesignatorHandlerTest.java
weaver/src/test/java/org/aspectj/weaver/tools/PointcutExpressionTest.java
weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java
weaver/src/test/java/org/aspectj/weaver/tools/TypePatternMatcherTest.java

index 4e5a87882dff940d30cbb525276f42bc99259b57..3bd3fbdb6fdce53383ac43d6248aa203e44c194c 100644 (file)
@@ -165,8 +165,6 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase {
         * Weave 'declare @type, @constructor, @method and @field' and check the weave messages that come out.
         */
        public void testWeaveMessagesDeclareAnnotation() {
-               if (!LangUtil.is15VMOrGreater())
-                       return; // annotation classes won't be about pre 15
                if (debugTests)
                        System.out.println("\ntestWeaveMessagesDeclareAnnotation: Building with Six.lst");
                compilerConfig.setProjectSourceFiles(getSourceFileList(six));
index 0edd5572132d044f3ba79e08141f87d401e95f38..ca297eb6ecf1886ef25590e16b261d893ea18239 100644 (file)
@@ -371,7 +371,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor {
                world.performExtraConfiguration(weaverOption.xSet);
                world.setXnoInline(weaverOption.noInline);
                // AMC - autodetect as per line below, needed for AtAjLTWTests.testLTWUnweavable
-               world.setBehaveInJava5Way(LangUtil.is15VMOrGreater());
+               world.setBehaveInJava5Way(true);
                world.setAddSerialVerUID(weaverOption.addSerialVersionUID);
 
                /* First load defaults */
index eee1b6f329ebf96a0e16a2fe6e90bc3fc94f4522..5de4aa288d1f0aa802111a15b147f1c7b4830b72 100644 (file)
@@ -36,11 +36,9 @@ public class ReflectionBasedReferenceTypeDelegateFactory {
                        ClassLoader usingClassLoader) {
                try {
                        Class c = Class.forName(forReferenceType.getName(), false, usingClassLoader);
-                       if (LangUtil.is15VMOrGreater()) {
-                               ReflectionBasedReferenceTypeDelegate rbrtd = create15Delegate(forReferenceType, c, usingClassLoader, inWorld);
-                               if (rbrtd != null) {
-                                       return rbrtd; // can be null if we didn't find the class the delegate logic loads
-                               }
+                       ReflectionBasedReferenceTypeDelegate rbrtd = create15Delegate(forReferenceType, c, usingClassLoader, inWorld);
+                       if (rbrtd != null) {
+                               return rbrtd; // can be null if we didn't find the class the delegate logic loads
                        }
                        return new ReflectionBasedReferenceTypeDelegate(c, usingClassLoader, inWorld, forReferenceType);
                } catch (ClassNotFoundException cnfEx) {
@@ -50,11 +48,9 @@ public class ReflectionBasedReferenceTypeDelegateFactory {
        
        public static ReflectionBasedReferenceTypeDelegate createDelegate(ReferenceType forReferenceType, World inWorld,
                        Class<?> clazz) {
-               if (LangUtil.is15VMOrGreater()) {
-                       ReflectionBasedReferenceTypeDelegate rbrtd = create15Delegate(forReferenceType, clazz, clazz.getClassLoader(), inWorld);
-                       if (rbrtd != null) {
-                               return rbrtd; // can be null if we didn't find the class the delegate logic loads
-                       }
+               ReflectionBasedReferenceTypeDelegate rbrtd = create15Delegate(forReferenceType, clazz, clazz.getClassLoader(), inWorld);
+               if (rbrtd != null) {
+                       return rbrtd; // can be null if we didn't find the class the delegate logic loads
                }
                return new ReflectionBasedReferenceTypeDelegate(clazz, clazz.getClassLoader(), inWorld, forReferenceType);
        }
@@ -90,30 +86,28 @@ public class ReflectionBasedReferenceTypeDelegateFactory {
        }
 
        private static GenericSignatureInformationProvider createGenericSignatureProvider(World inWorld) {
-               if (LangUtil.is15VMOrGreater()) {
-                       try {
-                               Class providerClass = Class.forName("org.aspectj.weaver.reflect.Java15GenericSignatureInformationProvider");
-                               Constructor cons = providerClass.getConstructor(new Class[] { World.class });
-                               GenericSignatureInformationProvider ret = (GenericSignatureInformationProvider) cons
-                                               .newInstance(new Object[] { inWorld });
-                               return ret;
-                       } catch (ClassNotFoundException cnfEx) {
-                               // drop through and create a 14 provider...
-                               // throw new
-                               // IllegalStateException("Attempted to create Java 1.5 generic signature provider but org.aspectj.weaver.reflect.Java15GenericSignatureInformationProvider was not found on classpath");
-                       } catch (NoSuchMethodException nsmEx) {
-                               throw new IllegalStateException("Attempted to create Java 1.5 generic signature provider but: " + nsmEx
-                                               + " occured");
-                       } catch (InstantiationException insEx) {
-                               throw new IllegalStateException("Attempted to create Java 1.5 generic signature provider but: " + insEx
-                                               + " occured");
-                       } catch (InvocationTargetException invEx) {
-                               throw new IllegalStateException("Attempted to create Java 1.5 generic signature provider but: " + invEx
-                                               + " occured");
-                       } catch (IllegalAccessException illAcc) {
-                               throw new IllegalStateException("Attempted to create Java 1.5 generic signature provider but: " + illAcc
-                                               + " occured");
-                       }
+               try {
+                       Class providerClass = Class.forName("org.aspectj.weaver.reflect.Java15GenericSignatureInformationProvider");
+                       Constructor cons = providerClass.getConstructor(new Class[] { World.class });
+                       GenericSignatureInformationProvider ret = (GenericSignatureInformationProvider) cons
+                                       .newInstance(new Object[] { inWorld });
+                       return ret;
+               } catch (ClassNotFoundException cnfEx) {
+                       // drop through and create a 14 provider...
+                       // throw new
+                       // IllegalStateException("Attempted to create Java 1.5 generic signature provider but org.aspectj.weaver.reflect.Java15GenericSignatureInformationProvider was not found on classpath");
+               } catch (NoSuchMethodException nsmEx) {
+                       throw new IllegalStateException("Attempted to create Java 1.5 generic signature provider but: " + nsmEx
+                                       + " occured");
+               } catch (InstantiationException insEx) {
+                       throw new IllegalStateException("Attempted to create Java 1.5 generic signature provider but: " + insEx
+                                       + " occured");
+               } catch (InvocationTargetException invEx) {
+                       throw new IllegalStateException("Attempted to create Java 1.5 generic signature provider but: " + invEx
+                                       + " occured");
+               } catch (IllegalAccessException illAcc) {
+                       throw new IllegalStateException("Attempted to create Java 1.5 generic signature provider but: " + illAcc
+                                       + " occured");
                }
                return new Java14GenericSignatureInformationProvider();
        }
index c4bcb3665293acc269fbe6a6d6db90abd2e593df..28cd56607677f5501916797f630be020f99c2987 100644 (file)
@@ -92,7 +92,7 @@ public class ReflectionWorld extends World implements IReflectionWorld {
        
        public ReflectionWorld(WeakClassLoaderReference classloaderRef) {
                this.setMessageHandler(new ExceptionBasedMessageHandler());
-               setBehaveInJava5Way(LangUtil.is15VMOrGreater());
+               setBehaveInJava5Way(true);
                classLoaderReference = classloaderRef;
                annotationFinder = makeAnnotationFinderIfAny(classLoaderReference.getClassLoader(), this);
        }
@@ -100,7 +100,7 @@ public class ReflectionWorld extends World implements IReflectionWorld {
        public ReflectionWorld(ClassLoader aClassLoader) {
                super();
                this.setMessageHandler(new ExceptionBasedMessageHandler());
-               setBehaveInJava5Way(LangUtil.is15VMOrGreater());
+               setBehaveInJava5Way(true);
                classLoaderReference = new WeakClassLoaderReference(aClassLoader);
                annotationFinder = makeAnnotationFinderIfAny(classLoaderReference.getClassLoader(), this);
        }
@@ -117,12 +117,10 @@ public class ReflectionWorld extends World implements IReflectionWorld {
        public static AnnotationFinder makeAnnotationFinderIfAny(ClassLoader loader, World world) {
                AnnotationFinder annotationFinder = null;
                try {
-                       if (LangUtil.is15VMOrGreater()) {
-                               Class<?> java15AnnotationFinder = Class.forName("org.aspectj.weaver.reflect.Java15AnnotationFinder");
-                               annotationFinder = (AnnotationFinder) java15AnnotationFinder.newInstance();
-                               annotationFinder.setClassLoader(loader);
-                               annotationFinder.setWorld(world);
-                       }
+                       Class<?> java15AnnotationFinder = Class.forName("org.aspectj.weaver.reflect.Java15AnnotationFinder");
+                       annotationFinder = (AnnotationFinder) java15AnnotationFinder.newInstance();
+                       annotationFinder.setClassLoader(loader);
+                       annotationFinder.setWorld(world);
                } catch (ClassNotFoundException ex) {
                        // must be on 1.4 or earlier
                } catch (IllegalAccessException ex) {
index e9b42fb83f3ba8dce092ef776de00910f47d4faf..9454b209ad59b101f7081e7171e175ab587f6caf 100644 (file)
@@ -58,12 +58,9 @@ public abstract class TraceFactory {
                 * Try to load external trace infrastructure using supplied factories
                 */
        if (instance == null) try {
-                       if (LangUtil.is15VMOrGreater()) {
+                       {
                        Class factoryClass = Class.forName("org.aspectj.weaver.tools.Jdk14TraceFactory");
                        instance = (TraceFactory)factoryClass.newInstance();
-                       } else {
-                       Class factoryClass = Class.forName("org.aspectj.weaver.tools.CommonsTraceFactory");
-                       instance = (TraceFactory)factoryClass.newInstance();
                        }
        }
        catch (Throwable th) {
index b60cad83533568fd2fa8e6cb3066107573675759..623af002fec04d0fe3ba43d65831cc194ddeb6c6 100644 (file)
@@ -115,17 +115,10 @@ public class ArgsTestCase extends TestCase {
                        Method oneIntM = A.class.getMethod("anInt", new Class[] { int.class });
                        Method oneIntegerM = A.class.getMethod("anInteger", new Class[] { Integer.class });
 
-                       if (LangUtil.is15VMOrGreater()) {
-                               checkMatches(oneInt.matchesMethodExecution(oneIntM), new A(), new A(), new Object[] {5});
-                               checkMatches(oneInt.matchesMethodExecution(oneIntegerM), new A(), new A(), new Object[] {5});
-                               checkMatches(oneInteger.matchesMethodExecution(oneIntM), new A(), new A(), new Object[] {5});
-                               checkMatches(oneInteger.matchesMethodExecution(oneIntegerM), new A(), new A(), new Object[] {5});
-                       } else {
-                               checkMatches(oneInt.matchesMethodExecution(oneIntM), new A(), new A(), new Object[] {5});
-                               checkNoMatch(oneInt.matchesMethodExecution(oneIntegerM), new A(), new A(), new Object[] {5});
-                               checkNoMatch(oneInteger.matchesMethodExecution(oneIntM), new A(), new A(), new Object[] {5});
-                               checkMatches(oneInteger.matchesMethodExecution(oneIntegerM), new A(), new A(), new Object[] {5});
-                       }
+                       checkMatches(oneInt.matchesMethodExecution(oneIntM), new A(), new A(), new Object[] {5});
+                       checkMatches(oneInt.matchesMethodExecution(oneIntegerM), new A(), new A(), new Object[] {5});
+                       checkMatches(oneInteger.matchesMethodExecution(oneIntM), new A(), new A(), new Object[] {5});
+                       checkMatches(oneInteger.matchesMethodExecution(oneIntegerM), new A(), new A(), new Object[] {5});
 
                } catch (Exception ex) {
                        fail("Unexpected exception " + ex);
@@ -173,8 +166,6 @@ public class ArgsTestCase extends TestCase {
 
        /** this condition can occur on the build machine only, and is way too complex to fix right now... */
        private boolean needToSkipPointcutParserTests() {
-               if (!LangUtil.is15VMOrGreater())
-                       return false;
                try {
                        Class.forName("org.aspectj.weaver.reflect.Java15ReflectionBasedReferenceTypeDelegate", false, this.getClass()
                                        .getClassLoader());// ReflectionBasedReferenceTypeDelegate.class.getClassLoader());
index 6c8d70be876f5e95c50b0418c8197f9938ef599d..b52146849853217df52c68f2bfda241adec7081a 100644 (file)
@@ -38,9 +38,6 @@ public class ThisOrTargetTestCase extends TestCase {
 
        /** this condition can occur on the build machine only, and is way too complex to fix right now... */
        private boolean needToSkipPointcutParserTests() {
-               if (!LangUtil.is15VMOrGreater()) {
-                       return false;
-               }
                try {
                        Class.forName("org.aspectj.weaver.reflect.Java15ReflectionBasedReferenceTypeDelegate", false, this.getClass()
                                        .getClassLoader());// ReflectionBasedReferenceTypeDelegate.class.getClassLoader());
index e8098ed090990b8fe8dfda6d2889b66c96992499..09e623554ff0f658cd068a663e37182030a4ce7c 100644 (file)
@@ -34,10 +34,10 @@ public class AjcTest {
        private static boolean is14VMOrGreater = false;
 
        static { // matching logic is also in org.aspectj.util.LangUtil
-               is1dot4VMOrGreater = LangUtil.is1dot4VMOrGreater();
-               is15VMOrGreater = LangUtil.is15VMOrGreater();
-               is16VMOrGreater = LangUtil.is16VMOrGreater();
-               is17VMOrGreater = LangUtil.is17VMOrGreater();
+               is1dot4VMOrGreater = true;
+               is15VMOrGreater = true;
+               is16VMOrGreater = true;
+               is17VMOrGreater = true;
                is18VMOrGreater = LangUtil.is18VMOrGreater();
                is19VMOrGreater = LangUtil.is19VMOrGreater();
                is10VMOrGreater = LangUtil.is10VMOrGreater();
index b7fa755db73e345618a746dcf08c6e4ef9b90e4d..47c64f2f5db7c7661b347d2650b2aa027c0004a7 100644 (file)
@@ -389,11 +389,7 @@ public class Ajc11Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        }
 
        public void test092() {
-               if (LangUtil.is17VMOrGreater()) {
-                       runTest("Compiler crash in ajc 1.1 - terrible error for inaccessible constructor - 1.7");
-               } else {
-                       runTest("Compiler crash in ajc 1.1 - terrible error for inaccessible constructor");
-               }
+               runTest("Compiler crash in ajc 1.1 - terrible error for inaccessible constructor - 1.7");
        }
 
        public void test093() {
index 8dcb8c34d5375a3c4fe76d04e18cbd8d6d17c164..62e96d0dff0ac6b17b118d8b68067094178b61f5 100644 (file)
@@ -406,14 +406,12 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        public void testBadASMforEnums() throws IOException {
                runTest("bad asm for enums");
 
-               if (LangUtil.is15VMOrGreater()) {
-                       ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                       PrintWriter pw = new PrintWriter(baos);
-                       AsmManager.dumptree(pw, AsmManager.lastActiveStructureModel.getHierarchy().getRoot(), 0);
-                       pw.flush();
-                       String tree = baos.toString();
-                       assertTrue("Expected 'Red [enumvalue]' somewhere in here:" + tree, tree.contains("Red  [enumvalue]"));
-               }
+               ByteArrayOutputStream baos = new ByteArrayOutputStream();
+               PrintWriter pw = new PrintWriter(baos);
+               AsmManager.dumptree(pw, AsmManager.lastActiveStructureModel.getHierarchy().getRoot(), 0);
+               pw.flush();
+               String tree = baos.toString();
+               assertTrue("Expected 'Red [enumvalue]' somewhere in here:" + tree, tree.contains("Red  [enumvalue]"));
        }
 
        public void npeOnTypeNotFound() {
@@ -840,11 +838,7 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        }
 
        public void testJava5SpecificFeaturesUsedAtJava14OrLower() {
-               if (LangUtil.is17VMOrGreater()) {
-                       runTest("java 5 pointcuts and declares at pre-java 5 compliance levels - 1.7");
-               } else {
-                       runTest("java 5 pointcuts and declares at pre-java 5 compliance levels");
-               }
+               runTest("java 5 pointcuts and declares at pre-java 5 compliance levels - 1.7");
        }
 
        public void testAnonymousTypes() {
index 76c956965281d74f1bfdddcf1f98e1bb1c91f488..95ab500fc4ae667e9bedfb0be20a070f400a3de2 100644 (file)
@@ -922,10 +922,7 @@ public class GenericsTests extends XMLBasedAjcTestCase {
      */
        public static boolean isBridge(java.lang.reflect.Method m) {
         // why not importing java.lang.reflect.Method? No BCEL clash?
-        if (!LangUtil.is15VMOrGreater()) {
-            return false;
-        }
-        try {
+               try {
             final Class<?>[] noparms = new Class[0];
             java.lang.reflect.Method isBridge 
                 = java.lang.reflect.Method.class.getMethod("isBridge", noparms);
index c46708feb89e934e89e43f42183487e4b1231b66..aa95319797b3362b4d247b2f510fdc7cc47dd375 100644 (file)
@@ -49,17 +49,14 @@ public class Java14Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        //  }
 
        public void test006(){
-               if (!LangUtil.is1dot4VMOrGreater()) { System.err.println("Skipping test 006 not >=1.4");return;}
                runTest("compiling asserts in methods");
        }
 
        public void test007(){
-               if (!LangUtil.is1dot4VMOrGreater()) { System.err.println("Skipping test 007 not >=1.4");return;}
                runTest("asserts");
        }
 
        public void test008(){
-               if (!LangUtil.is1dot4VMOrGreater()) { System.err.println("Skipping test 008 not >=1.4");return;}
                runTest("asserts in aspect and declared methods [requires 1.4]");
        }
 
@@ -76,7 +73,7 @@ public class Java14Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        }
 
        public void test012(){
-               if (!LangUtil.is1dot4VMOrGreater()) { System.err.println("Skipping test 012 not >=1.4");return;}
+               if (!true) { System.err.println("Skipping test 012 not >=1.4");return;}
                runTest("assert tests in introduction [requires 1.4]");
        }
 
@@ -85,22 +82,18 @@ public class Java14Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        }
 
        public void test014(){
-               if (!LangUtil.is1dot4VMOrGreater()) { System.err.println("Skipping test 014 not >=1.4");return;}
                runTest("assert statement in advice coverage [requires 1.4]");
        }
 
        public void test015(){
-               if (!LangUtil.is1dot4VMOrGreater()) { System.err.println("Skipping test 015 not >=1.4");return;}
                runTest("assert statement in advice  [requires 1.4]");
        }
 
        public void test016(){
-               if (!LangUtil.is1dot4VMOrGreater()) { System.err.println("Skipping test 016 not >=1.4");return;}
                runTest("assert and pertarget crashes compiler");
        }
 
        public void test017(){
-               if (!LangUtil.is1dot4VMOrGreater()) { System.err.println("Skipping test 017 not >=1.4");return;}
                runTest("testing that assert works like .class");
        }
 
@@ -117,7 +110,6 @@ public class Java14Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        // }
 
        public void test021(){
-               if (!LangUtil.is1dot4VMOrGreater()) { System.err.println("Skipping test 021 not >=1.4");return;}
                runTest("Class Literals as non final fields (also assert, and this$0)");
        }
 
index 1232f39099775c27ca0ef11054da447de29af60b..9c83f47f0b61b4cb5ef0a6dab08c41b919f5f49d 100644 (file)
@@ -1,7 +1,5 @@
 package org.aspectj.tests;
 
-import org.aspectj.systemtest.AllTests;
-import org.aspectj.systemtest.AllTests14;
 import org.aspectj.systemtest.AllTests17;
 import org.aspectj.systemtest.AllTests18;
 import org.aspectj.systemtest.AllTests19;
@@ -33,18 +31,10 @@ public class TestsModuleTests extends TestCase {
                        suite.addTest(AllTests19.suite());
                } else if (LangUtil.is18VMOrGreater()) {
                        suite.addTest(AllTests18.suite());
-               } else if (LangUtil.is15VMOrGreater()) {
+               } else {
                        // suite.addTest(AllTests15.suite());
                        suite.addTest(AllTests17.suite()); // there are currently (28/11/06) no tests specific to a 1.6/1.7 vm - so we can do
                        // this
-               } else if (LangUtil.is1dot4VMOrGreater()) {
-                       System.err.println("Skipping tests for 1.5");
-                       // suite.addTest(TestUtil.skipTest("for 1.5"));
-                       suite.addTest(AllTests14.suite());
-               } else {
-                       System.err.println("Skipping tests for 1.4 and 1.5");
-                       // suite.addTest(TestUtil.skipTest("for 1.4 and 1.5"));
-                       suite.addTest(AllTests.suite());
                }
                return suite;
        }
index 5c656cd7ad3e209d2a280642b23ba71406b59850..98f53e3c859f1fe61ba5388475e11593687a23b5 100644 (file)
@@ -125,22 +125,27 @@ public class LangUtil {
                return result;
        }
 
+       @Deprecated
        public static boolean isOnePointThreeVMOrGreater() {
                return 1.3 <= vmVersion;
        }
 
+       @Deprecated
        public static boolean is1dot4VMOrGreater() {
                return 1.4 <= vmVersion;
        }
 
+       @Deprecated
        public static boolean is15VMOrGreater() {
                return 1.5 <= vmVersion;
        }
 
+       @Deprecated
        public static boolean is16VMOrGreater() {
                return 1.6 <= vmVersion;
        }
 
+       @Deprecated
        public static boolean is17VMOrGreater() {
                return 1.7 <= vmVersion;
        }
index 545cdd904c20f868af6220cedca4619de18f6439..87b976957d28e0346a42da71266ce832e19ffb00 100644 (file)
@@ -101,9 +101,10 @@ public class LangUtilTest extends TestCase {
        // }
 
        public void testVersion() {
-               assertTrue(LangUtil.isOnePointThreeVMOrGreater()); // min vm now - floor may change
-               if (LangUtil.is15VMOrGreater()) {
-                       assertTrue(LangUtil.is1dot4VMOrGreater());
+               assertTrue(LangUtil.is18VMOrGreater()); // min vm now - floor may change
+               if (LangUtil.is11VMOrGreater()) {
+                       assertTrue(LangUtil.is19VMOrGreater());
+                       assertTrue(LangUtil.is10VMOrGreater());
                }
        }
 
index 1fc72dd06e7f28a00964357730d684b1ecd61728..c9f1ecffcf38fa4d35b2c0007ce425fdedfac817 100644 (file)
@@ -80,7 +80,7 @@ public class LTWWorld extends BcelWorld implements IReflectionWorld {
                        classLoaderString = loader.getClass().getName()+":"+Integer.toString(System.identityHashCode(loader));
                }
                classLoaderParentString = (loader.getParent() == null ? "<NullParent>" : loader.getParent().toString());
-               setBehaveInJava5Way(LangUtil.is15VMOrGreater());
+               setBehaveInJava5Way(true);
                annotationFinder = ReflectionWorld.makeAnnotationFinderIfAny(loader, this);
        }
 
index d3a194fccdfe833fe6b64ba276b223617cbd0663..5571ad51f0fda9411ac0a0dac6739c2887fd88bd 100644 (file)
@@ -200,9 +200,7 @@ public class WeavingAdaptor implements IMessageContext {
                bcelWorld = new BcelWorld(classPath, messageHandler, null);
                bcelWorld.setXnoInline(false);
                bcelWorld.getLint().loadDefaultProperties();
-               if (LangUtil.is15VMOrGreater()) {
-                       bcelWorld.setBehaveInJava5Way(true);
-               }
+               bcelWorld.setBehaveInJava5Way(true);
 
                weaver = new BcelWeaver(bcelWorld);
                registerAspectLibraries(aspectPath);
index d6b60eb5fef5d98974c7ca7112b625920cc98d57..067e12a4c1195a027f8c8eeda2b748836ce93858 100644 (file)
@@ -107,42 +107,38 @@ public class TypeXTestCase extends TestCase {
        }
        
        public void testTypeXForParameterizedTypes() {
-               if (LangUtil.is15VMOrGreater()) { // no funny types pre 1.5
-                       World world = new BcelWorld();
-                       UnresolvedType stringType = UnresolvedType.forName("java/lang/String");
-                       ResolvedType listOfStringType = 
-                               TypeFactory.createParameterizedType(
-                                                               UnresolvedType.forName("java/util/List").resolve(world), 
-                                                               new UnresolvedType[] {stringType},
-                                                               world);
-                       assertEquals("1 type param",1,listOfStringType.typeParameters.length);
-                       assertEquals(stringType,listOfStringType.typeParameters[0]);
-                       assertTrue(listOfStringType.isParameterizedType());
-                       assertFalse(listOfStringType.isGenericType());
-               }
+               World world = new BcelWorld();
+               UnresolvedType stringType = UnresolvedType.forName("java/lang/String");
+               ResolvedType listOfStringType =
+                       TypeFactory.createParameterizedType(
+                                                       UnresolvedType.forName("java/util/List").resolve(world),
+                                                       new UnresolvedType[] {stringType},
+                                                       world);
+               assertEquals("1 type param",1,listOfStringType.typeParameters.length);
+               assertEquals(stringType,listOfStringType.typeParameters[0]);
+               assertTrue(listOfStringType.isParameterizedType());
+               assertFalse(listOfStringType.isGenericType());
        }
        
        public void testTypeFactoryForParameterizedTypes() {
-               if (LangUtil.is15VMOrGreater()) { // no funny types pre 1.5             
-                       UnresolvedType enumOfSimpleType = 
-                               TypeFactory.createTypeFromSignature("Pjava/lang/Enum<Ljava/lang/String;>;"); 
-                       assertEquals(1, enumOfSimpleType.getTypeParameters().length);
-                       
-                       UnresolvedType enumOfNestedType = 
-                               TypeFactory.createTypeFromSignature("Pjava/lang/Enum<Ljavax/jws/soap/SOAPBinding$ParameterStyle;>;"); 
-                       assertEquals(1, enumOfNestedType.getTypeParameters().length);
-
-                       // is this signature right?
-                       UnresolvedType nestedTypeOfParameterized = 
-                               TypeFactory.createTypeFromSignature("PMyInterface<Ljava/lang/String;>$MyOtherType;"); 
-                       assertEquals(0, nestedTypeOfParameterized.getTypeParameters().length);
-                       
-                       // how about this one? is this valid?
-                       UnresolvedType doublyNestedTypeSignatures = 
-                               TypeFactory.createTypeFromSignature("PMyInterface<Ljava/lang/String;Ljava/lang/String;>$MyOtherType<Ljava/lang/Object;>;"); 
-                       assertEquals(1, doublyNestedTypeSignatures.getTypeParameters().length);
-                       
-               }
+               UnresolvedType enumOfSimpleType =
+                       TypeFactory.createTypeFromSignature("Pjava/lang/Enum<Ljava/lang/String;>;");
+               assertEquals(1, enumOfSimpleType.getTypeParameters().length);
+
+               UnresolvedType enumOfNestedType =
+                       TypeFactory.createTypeFromSignature("Pjava/lang/Enum<Ljavax/jws/soap/SOAPBinding$ParameterStyle;>;");
+               assertEquals(1, enumOfNestedType.getTypeParameters().length);
+
+               // is this signature right?
+               UnresolvedType nestedTypeOfParameterized =
+                       TypeFactory.createTypeFromSignature("PMyInterface<Ljava/lang/String;>$MyOtherType;");
+               assertEquals(0, nestedTypeOfParameterized.getTypeParameters().length);
+
+               // how about this one? is this valid?
+               UnresolvedType doublyNestedTypeSignatures =
+                       TypeFactory.createTypeFromSignature("PMyInterface<Ljava/lang/String;Ljava/lang/String;>$MyOtherType<Ljava/lang/Object;>;");
+               assertEquals(1, doublyNestedTypeSignatures.getTypeParameters().length);
+
        }
        
        private void checkTX(UnresolvedType tx,boolean shouldBeParameterized,int numberOfTypeParameters) {
index eb5c509484546bcb318cdd0485c31d081eb02356..ea276614cc2cda3ff9b054bb8338cf97e421baab 100644 (file)
@@ -81,14 +81,12 @@ public class AnnotationPatternMatchingTestCase extends TestCase {
        }
 
        public void testAnnotationPatternMatchingOnTypes() {
-               if (LangUtil.is15VMOrGreater()) {
-                       ResolvedType rtx = loadType("AnnotatedClass");
-                       initAnnotationTypePatterns();
+               ResolvedType rtx = loadType("AnnotatedClass");
+               initAnnotationTypePatterns();
 
-                       // One should match
-                       assertTrue("@Foo should not match on the AnnotatedClass", fooTP.matches(rtx).alwaysFalse());
-                       assertTrue("@SimpleAnnotation should match on the AnnotatedClass", simpleAnnotationTP.matches(rtx).alwaysTrue());
-               }
+               // One should match
+               assertTrue("@Foo should not match on the AnnotatedClass", fooTP.matches(rtx).alwaysFalse());
+               assertTrue("@SimpleAnnotation should match on the AnnotatedClass", simpleAnnotationTP.matches(rtx).alwaysTrue());
 
        }
 
@@ -167,35 +165,31 @@ public class AnnotationPatternMatchingTestCase extends TestCase {
        }
 
        public void testAnnotationPatternMatchingOnMethods() {
-               if (LangUtil.is15VMOrGreater()) {
-                       ResolvedType rtx = loadType("AnnotatedClass");
-                       ResolvedMember aMethod = rtx.getDeclaredMethods()[1];
+               ResolvedType rtx = loadType("AnnotatedClass");
+               ResolvedMember aMethod = rtx.getDeclaredMethods()[1];
 
-                       assertTrue("Haven't got the right method, I'm looking for 'm1()': " + aMethod.getName(), aMethod.getName().equals("m1"));
+               assertTrue("Haven't got the right method, I'm looking for 'm1()': " + aMethod.getName(), aMethod.getName().equals("m1"));
 
-                       initAnnotationTypePatterns();
+               initAnnotationTypePatterns();
 
-                       // One should match
-                       assertTrue("@Foo should not match on the AnnotatedClass.m1() method", fooTP.matches(aMethod).alwaysFalse());
-                       assertTrue("@SimpleAnnotation should match on the AnnotatedClass.m1() method", simpleAnnotationTP.matches(aMethod)
-                                       .alwaysTrue());
-               }
+               // One should match
+               assertTrue("@Foo should not match on the AnnotatedClass.m1() method", fooTP.matches(aMethod).alwaysFalse());
+               assertTrue("@SimpleAnnotation should match on the AnnotatedClass.m1() method", simpleAnnotationTP.matches(aMethod)
+                               .alwaysTrue());
        }
 
        public void testAnnotationPatternMatchingOnFields() {
-               if (LangUtil.is15VMOrGreater()) {
-                       ResolvedType rtx = loadType("AnnotatedClass");
-                       ResolvedMember aField = rtx.getDeclaredFields()[0];
+               ResolvedType rtx = loadType("AnnotatedClass");
+               ResolvedMember aField = rtx.getDeclaredFields()[0];
 
-                       assertTrue("Haven't got the right field, I'm looking for 'i'" + aField.getName(), aField.getName().equals("i"));
+               assertTrue("Haven't got the right field, I'm looking for 'i'" + aField.getName(), aField.getName().equals("i"));
 
-                       initAnnotationTypePatterns();
+               initAnnotationTypePatterns();
 
-                       // One should match
-                       assertTrue("@Foo should not match on the AnnotatedClass.i field", fooTP.matches(aField).alwaysFalse());
-                       assertTrue("@SimpleAnnotation should match on the AnnotatedClass.i field", simpleAnnotationTP.matches(aField)
-                                       .alwaysTrue());
-               }
+               // One should match
+               assertTrue("@Foo should not match on the AnnotatedClass.i field", fooTP.matches(aField).alwaysFalse());
+               assertTrue("@SimpleAnnotation should match on the AnnotatedClass.i field", simpleAnnotationTP.matches(aField)
+                               .alwaysTrue());
 
        }
 
index 0433846fb7246e05fa33b02d0fc6ded2afa4bf15..05291af1ffb1d595ff0690894bc85335fe439ede 100644 (file)
@@ -253,52 +253,46 @@ public class AnnotationPatternTestCase extends TestCase {
        }
 
        public void testExactAnnotationPatternMatching() {
-               if (LangUtil.is15VMOrGreater()) {
-                       PatternParser p = new PatternParser("@Foo");
-                       AnnotationTypePattern ap = p.maybeParseAnnotationPattern();
-                       ap = ap.resolveBindings(makeSimpleScope(), new Bindings(3), true);
-                       AnnotatedElementImpl ae = new AnnotatedElementImpl(new String[] { "Foo" });
-                       assertTrue("matches element with Foo", ap.matches(ae).alwaysTrue());
-                       AnnotatedElementImpl ae2 = new AnnotatedElementImpl(new String[] { "Boo" });
-                       assertTrue("does not match element with Boo", ap.matches(ae2).alwaysFalse());
-               }
+               PatternParser p = new PatternParser("@Foo");
+               AnnotationTypePattern ap = p.maybeParseAnnotationPattern();
+               ap = ap.resolveBindings(makeSimpleScope(), new Bindings(3), true);
+               AnnotatedElementImpl ae = new AnnotatedElementImpl(new String[] { "Foo" });
+               assertTrue("matches element with Foo", ap.matches(ae).alwaysTrue());
+               AnnotatedElementImpl ae2 = new AnnotatedElementImpl(new String[] { "Boo" });
+               assertTrue("does not match element with Boo", ap.matches(ae2).alwaysFalse());
        }
 
        public void testBindingAnnotationPatternMatching() {
-               if (LangUtil.is15VMOrGreater()) {
-                       PatternParser p = new PatternParser("foo");
-                       AnnotationTypePattern ap = p.parseAnnotationNameOrVarTypePattern();
-                       try {
-                               ap = ap.resolveBindings(makeSimpleScope(), new Bindings(3), true);
-                       } catch (AbortException abEx) {
-                               assertEquals("Binding not supported in @pcds (1.5.0 M1 limitation): null", abEx.getMessage());
-                       }
-                       // uncomment these next lines once binding is supported
-                       // AnnotatedElementImpl ae = new AnnotatedElementImpl(new
-                       // String[]{"Foo"});
-                       // assertTrue("matches element with Foo",ap.matches(ae).alwaysTrue())
-                       // ;
-                       // AnnotatedElementImpl ae2 = new AnnotatedElementImpl(new
-                       // String[]{"Boo"});
-                       // assertTrue("does not match element with Boo",ap.matches(ae2).
-                       // alwaysFalse());
+               PatternParser p = new PatternParser("foo");
+               AnnotationTypePattern ap = p.parseAnnotationNameOrVarTypePattern();
+               try {
+                       ap = ap.resolveBindings(makeSimpleScope(), new Bindings(3), true);
+               } catch (AbortException abEx) {
+                       assertEquals("Binding not supported in @pcds (1.5.0 M1 limitation): null", abEx.getMessage());
                }
+               // uncomment these next lines once binding is supported
+               // AnnotatedElementImpl ae = new AnnotatedElementImpl(new
+               // String[]{"Foo"});
+               // assertTrue("matches element with Foo",ap.matches(ae).alwaysTrue())
+               // ;
+               // AnnotatedElementImpl ae2 = new AnnotatedElementImpl(new
+               // String[]{"Boo"});
+               // assertTrue("does not match element with Boo",ap.matches(ae2).
+               // alwaysFalse());
        }
 
        public void testAndAnnotationPatternMatching() {
-               if (LangUtil.is15VMOrGreater()) {
-                       PatternParser p = new PatternParser("@Foo @Boo");
-                       AnnotationTypePattern ap = p.maybeParseAnnotationPattern();
-                       ap = ap.resolveBindings(makeSimpleScope(), new Bindings(3), true);
-                       AnnotatedElementImpl ae = new AnnotatedElementImpl(new String[] { "Foo", "Boo" });
-                       assertTrue("matches foo and boo", ap.matches(ae).alwaysTrue());
-                       ae = new AnnotatedElementImpl(new String[] { "Foo" });
-                       assertTrue("does not match foo", ap.matches(ae).alwaysFalse());
-                       ae = new AnnotatedElementImpl(new String[] { "Boo" });
-                       assertTrue("does not match boo", ap.matches(ae).alwaysFalse());
-                       ae = new AnnotatedElementImpl(new String[] { "Goo" });
-                       assertTrue("does not match goo", ap.matches(ae).alwaysFalse());
-               }
+               PatternParser p = new PatternParser("@Foo @Boo");
+               AnnotationTypePattern ap = p.maybeParseAnnotationPattern();
+               ap = ap.resolveBindings(makeSimpleScope(), new Bindings(3), true);
+               AnnotatedElementImpl ae = new AnnotatedElementImpl(new String[] { "Foo", "Boo" });
+               assertTrue("matches foo and boo", ap.matches(ae).alwaysTrue());
+               ae = new AnnotatedElementImpl(new String[] { "Foo" });
+               assertTrue("does not match foo", ap.matches(ae).alwaysFalse());
+               ae = new AnnotatedElementImpl(new String[] { "Boo" });
+               assertTrue("does not match boo", ap.matches(ae).alwaysFalse());
+               ae = new AnnotatedElementImpl(new String[] { "Goo" });
+               assertTrue("does not match goo", ap.matches(ae).alwaysFalse());
        }
 
        //      
@@ -318,15 +312,13 @@ public class AnnotationPatternTestCase extends TestCase {
        // }
        //      
        public void testNotAnnotationPatternMatching() {
-               if (LangUtil.is15VMOrGreater()) {
-                       PatternParser p = new PatternParser("!@Foo");
-                       AnnotationTypePattern ap = p.maybeParseAnnotationPattern();
-                       ap = ap.resolveBindings(makeSimpleScope(), new Bindings(3), true);
-                       AnnotatedElementImpl ae = new AnnotatedElementImpl(new String[] { "Foo", "Boo" });
-                       assertTrue("does not match foo and boo", ap.matches(ae).alwaysFalse());
-                       ae = new AnnotatedElementImpl(new String[] { "Boo" });
-                       assertTrue("matches boo", ap.matches(ae).alwaysTrue());
-               }
+               PatternParser p = new PatternParser("!@Foo");
+               AnnotationTypePattern ap = p.maybeParseAnnotationPattern();
+               ap = ap.resolveBindings(makeSimpleScope(), new Bindings(3), true);
+               AnnotatedElementImpl ae = new AnnotatedElementImpl(new String[] { "Foo", "Boo" });
+               assertTrue("does not match foo and boo", ap.matches(ae).alwaysFalse());
+               ae = new AnnotatedElementImpl(new String[] { "Boo" });
+               assertTrue("matches boo", ap.matches(ae).alwaysTrue());
        }
 
        public void testAnyAnnotationPatternMatching() {
index 1ea33c46597e5fc8518c99cafdedc630a5baf322..8d910baf53acc9549fdb1134b2326fedff482d9c 100644 (file)
@@ -30,7 +30,6 @@ public class PointcutDesignatorHandlerTest extends TestCase {
        
        /** this condition can occur on the build machine only, and is way too complex to fix right now... */
        private boolean needToSkipPointcutParserTests() {
-               if (!LangUtil.is15VMOrGreater()) return false;
                try {
                        Class.forName("org.aspectj.weaver.reflect.Java15ReflectionBasedReferenceTypeDelegate",false,this.getClass().getClassLoader());//ReflectionBasedReferenceTypeDelegate.class.getClassLoader()); 
                } catch (ClassNotFoundException cnfEx) {
index ab776252505c3064c94c76f0e6ba61230ac90743..d98d1e30e87826166ea06cf6d2cca8d2e5dea6bf 100644 (file)
@@ -448,11 +448,7 @@ public class PointcutExpressionTest extends TestCase {
                assertFalse("Matches maybe", ex.matchesMethodExecution(foo).alwaysMatches());
                // never match
                ex = p.parsePointcutExpression("args(String,Integer,Number)");
-               if (LangUtil.is15VMOrGreater()) {
-                       assertTrue("matches", ex.matchesMethodExecution(foo).alwaysMatches());
-               } else {
-                       assertTrue("Does not match", ex.matchesMethodExecution(foo).neverMatches());
-               }
+               assertTrue("matches", ex.matchesMethodExecution(foo).alwaysMatches());
        }
 
        // public void testMatchesDynamically() {
index 46f841666dc0233eb552044c8c8875e938616761..589fd6c9b62ce634e46ec745e253872ff874fee3 100644 (file)
@@ -34,9 +34,6 @@ public class PointcutParserTest extends TestCase {
 
        /** this condition can occur on the build machine only, and is way too complex to fix right now... */
        private boolean needToSkipPointcutParserTests() {
-               if (!LangUtil.is15VMOrGreater()) {
-                       return false;
-               }
                try {
                        Class.forName("org.aspectj.weaver.reflect.Java15ReflectionBasedReferenceTypeDelegate", false, this.getClass()
                                        .getClassLoader());// ReflectionBasedReferenceTypeDelegate.class.getClassLoader());
index 523ee4a83b49b5813950f599e6acbc68d50110db..0096b54828779e1a21ea272ffa84974edf8ff2e2 100644 (file)
@@ -25,7 +25,6 @@ public class TypePatternMatcherTest extends TestCase {
        
        /** this condition can occur on the build machine only, and is way too complex to fix right now... */
        private boolean needToSkipPointcutParserTests() {
-               if (!LangUtil.is15VMOrGreater()) return false;
                try {
                        Class.forName("org.aspectj.weaver.reflect.Java15ReflectionBasedReferenceTypeDelegate",false,this.getClass().getClassLoader());//ReflectionBasedReferenceTypeDelegate.class.getClassLoader()); 
                } catch (ClassNotFoundException cnfEx) {