diff options
author | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-13 23:21:11 +0200 |
---|---|---|
committer | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-13 23:21:11 +0200 |
commit | d7ba05ce26dd8f72c1d0695ece2cb03d035e3cf9 (patch) | |
tree | b0ca80a1154a73ca8ed1d5d4cf175c2682af6fce /org.aspectj.matcher | |
parent | 4f027bd94fe71756894f13a4a82123eda4f28b98 (diff) | |
download | aspectj-d7ba05ce26dd8f72c1d0695ece2cb03d035e3cf9.tar.gz aspectj-d7ba05ce26dd8f72c1d0695ece2cb03d035e3cf9.zip |
Remove checks for old Java Versions
Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'org.aspectj.matcher')
5 files changed, 39 insertions, 62 deletions
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java index eee1b6f32..5de4aa288 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java @@ -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(); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java index c4bcb3665..28cd56607 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java @@ -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) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/TraceFactory.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/TraceFactory.java index e9b42fb83..9454b209a 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/TraceFactory.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/TraceFactory.java @@ -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) { diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ArgsTestCase.java b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ArgsTestCase.java index b60cad835..623af002f 100644 --- a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ArgsTestCase.java +++ b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ArgsTestCase.java @@ -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()); diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ThisOrTargetTestCase.java b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ThisOrTargetTestCase.java index 6c8d70be8..b52146849 100644 --- a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ThisOrTargetTestCase.java +++ b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ThisOrTargetTestCase.java @@ -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()); |