aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2020-08-14 15:00:44 -0700
committerGitHub <noreply@github.com>2020-08-14 15:00:44 -0700
commit54f35a5dd028ae9603eede66b9a0b0a75f68c291 (patch)
tree6d0914cc60cbc4ed7d07e6381aa37d4d310d3f9b
parent91ad0de3701771b94ad96f2373f810f701e78c21 (diff)
parent2722e60770c5418fa3cb372b00eab3eba53e037a (diff)
downloadaspectj-54f35a5dd028ae9603eede66b9a0b0a75f68c291.tar.gz
aspectj-54f35a5dd028ae9603eede66b9a0b0a75f68c291.zip
Merge pull request #5 from larsgrefer/remove-old-version-checks
Remove checks for old Java Versions
-rw-r--r--ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java2
-rw-r--r--ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java158
-rw-r--r--ajdoc/src/test/java/org/aspectj/tools/ajdoc/DeclareFormsTest.java2
-rw-r--r--loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java2
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java62
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java14
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/TraceFactory.java5
-rw-r--r--org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ArgsTestCase.java17
-rw-r--r--org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ThisOrTargetTestCase.java3
-rw-r--r--testing/src/test/java/org/aspectj/testing/AjcTest.java10
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc11/Ajc11Tests.java6
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc150/Ajc150Tests.java20
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java5
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/java14/Java14Tests.java10
-rw-r--r--tests/src/test/java/org/aspectj/tests/TestsModuleTests.java16
-rw-r--r--util/src/main/java/org/aspectj/util/LangUtil.java5
-rw-r--r--util/src/test/java/org/aspectj/util/LangUtilTest.java7
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java4
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/ltw/LTWWorld.java2
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java4
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/TypeXTestCase.java62
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java48
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java88
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/PointcutDesignatorHandlerTest.java1
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/PointcutExpressionTest.java6
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java3
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/TypePatternMatcherTest.java1
27 files changed, 196 insertions, 367 deletions
diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java
index 111f74c4a..c5fa43e16 100644
--- a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java
+++ b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java
@@ -164,8 +164,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));
diff --git a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java
index 61172346c..ea8568cd8 100644
--- a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java
+++ b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java
@@ -129,20 +129,11 @@ public class CoverageTestCase extends AjdocTestCase {
// than "Class ClassA.InnerAspect"
String[] strings = null;
- if (LangUtil.is18VMOrGreater()) {
- strings = new String[] {
- "Aspect ClassA.InnerAspect",
- "<pre>static aspect <span class=\"typeNameLabel\">ClassA.InnerAspect</span>",
- "Class ClassA.InnerAspect",
- "<pre>static class <span class=\"typeNameLabel\">ClassA.InnerAspect</span>"};
- }
- else {
- strings = new String[] {
- "Aspect ClassA.InnerAspect",
- "<PRE>static aspect <B>ClassA.InnerAspect</B><DT>extends java.lang.Object</DL>",
- "Class ClassA.InnerAspect",
- "<PRE>static class <B>ClassA.InnerAspect</B><DT>extends java.lang.Object</DL>"};
- }
+ strings = new String[] {
+ "Aspect ClassA.InnerAspect",
+ "<pre>static aspect <span class=\"typeNameLabel\">ClassA.InnerAspect</span>",
+ "Class ClassA.InnerAspect",
+ "<pre>static class <span class=\"typeNameLabel\">ClassA.InnerAspect</span>"};
List<String> missingStrings = AjdocOutputChecker.getMissingStringsInFile(htmlFile,strings);
StringBuilder buf = new StringBuilder();
for (String str:missingStrings) {
@@ -152,14 +143,8 @@ public class CoverageTestCase extends AjdocTestCase {
assertEquals("There should be 2 missing strings:\n"+buf.toString(), 2, missingStrings.size());
assertTrue(htmlFile.getName() + " should not have Class as it's title",
missingStrings.contains("Class ClassA.InnerAspect"));
- if (LangUtil.is18VMOrGreater()) {
- assertTrue(htmlFile.getName() + " should not have class in its subtitle",
- missingStrings.contains("<pre>static class <span class=\"typeNameLabel\">ClassA.InnerAspect</span>"));
- }
- else {
- assertTrue(htmlFile.getName() + " should not have class in its subtitle",
- missingStrings.contains("<PRE>static class <B>ClassA.InnerAspect</B><DT>extends java.lang.Object</DL>"));
- }
+ assertTrue(htmlFile.getName() + " should not have class in its subtitle",
+ missingStrings.contains("<pre>static class <span class=\"typeNameLabel\">ClassA.InnerAspect</span>"));
// get the html file for the enclosing class
File htmlFileClass = new File(getAbsolutePathOutdir() + "/foo/ClassA.html");
@@ -178,31 +163,19 @@ public class CoverageTestCase extends AjdocTestCase {
"public abstract class <span class=\"typeNameLabel\">ClassA</span>",
"Aspect ClassA</H2>",
"public abstract aspect <span class=\"typeNameLabel\">ClassA</span>"};
- } else if (LangUtil.is18VMOrGreater()) {
+ } else {
classStrings = new String[] {
"Class ClassA</h2>",
"public abstract class <span class=\"typeNameLabel\">ClassA</span>",
"Aspect ClassA</H2>",
"public abstract aspect <span class=\"typeNameLabel\">ClassA</span>"};
- } else {
- classStrings = new String[] {
- "Class ClassA</H2>",
- "public abstract class <B>ClassA</B><DT>extends java.lang.Object<DT>",
- "Aspect ClassA</H2>",
- "public abstract aspect <B>ClassA</B><DT>extends java.lang.Object<DT>"};
}
List<String> classMissing = AjdocOutputChecker.getMissingStringsInFile(htmlFileClass,classStrings);
assertEquals("There should be 2 missing strings:\n"+classMissing,2,classMissing.size());
assertTrue(htmlFileClass.getName() + " should not have Aspect as it's title",classMissing.contains("Aspect ClassA</H2>"));
- if (LangUtil.is18VMOrGreater()) {
- assertTrue(htmlFileClass.getName() + " should not have aspect in its subtitle",
- classMissing.contains("public abstract aspect <span class=\"typeNameLabel\">ClassA</span>"));
- }
- else {
- assertTrue(htmlFileClass.getName() + " should not have aspect in its subtitle",
- classMissing.contains("public abstract aspect <B>ClassA</B><DT>extends java.lang.Object<DT>"));
- }
- }
+ assertTrue(htmlFileClass.getName() + " should not have aspect in its subtitle",
+ classMissing.contains("public abstract aspect <span class=\"typeNameLabel\">ClassA</span>"));
+ }
/**
* Test that all the different types of advice appear
@@ -584,7 +557,7 @@ public class CoverageTestCase extends AjdocTestCase {
}
private String toName(String name) {
- if (LangUtil.is18VMOrGreater() && !LangUtil.is11VMOrGreater()) {
+ if (!LangUtil.is11VMOrGreater()) {
name = name.replace('(','-');
name = name.replace(')','-');
}
@@ -682,31 +655,16 @@ public class CoverageTestCase extends AjdocTestCase {
// ensure that the file is entitled "Aspect PkgVisibleClass.NestedAspect" rather
// than "Class PkgVisibleClass.NestedAspect"
String[] strings = null;
- if (LangUtil.is18VMOrGreater()) {
- strings = new String[] {
- "Aspect PkgVisibleClass.NestedAspect",
- "<pre>static aspect <span class=\"typeNameLabel\">PkgVisibleClass.NestedAspect</span>",
- "Class PkgVisibleClass.NestedAspect",
- "<pre>static class <span class=\"typeNameLabel\">PkgVisibleClass.NestedAspect</span>"};
- }
- else {
- strings = new String[] {
- "Aspect PkgVisibleClass.NestedAspect",
- "<PRE>static aspect <B>PkgVisibleClass.NestedAspect</B><DT>extends java.lang.Object</DL>",
- "Class PkgVisibleClass.NestedAspect",
- "<PRE>static class <B>PkgVisibleClass.NestedAspect</B><DT>extends java.lang.Object</DL>"};
- }
+ strings = new String[] {
+ "Aspect PkgVisibleClass.NestedAspect",
+ "<pre>static aspect <span class=\"typeNameLabel\">PkgVisibleClass.NestedAspect</span>",
+ "Class PkgVisibleClass.NestedAspect",
+ "<pre>static class <span class=\"typeNameLabel\">PkgVisibleClass.NestedAspect</span>"};
List<String> missing = AjdocOutputChecker.getMissingStringsInFile(htmlFile,strings);
assertEquals("There should be 2 missing strings",2,missing.size());
assertTrue(htmlFile.getName() + " should not have Class as it's title",missing.contains("Class PkgVisibleClass.NestedAspect"));
- if (LangUtil.is18VMOrGreater()) {
- assertTrue(htmlFile.getName() + " should not have class in its subtitle",
- missing.contains("<pre>static class <span class=\"typeNameLabel\">PkgVisibleClass.NestedAspect</span>"));
- }
- else {
- assertTrue(htmlFile.getName() + " should not have class in its subtitle",
- missing.contains("<PRE>static class <B>PkgVisibleClass.NestedAspect</B><DT>extends java.lang.Object</DL>"));
- }
+ assertTrue(htmlFile.getName() + " should not have class in its subtitle",
+ missing.contains("<pre>static class <span class=\"typeNameLabel\">PkgVisibleClass.NestedAspect</span>"));
// get the html file for the enclosing class
File htmlFileClass = new File(getAbsolutePathOutdir() + "/PkgVisibleClass.html");
if (!htmlFileClass.exists()) {
@@ -723,33 +681,19 @@ public class CoverageTestCase extends AjdocTestCase {
"<pre>class <span class=\"typeNameLabel\">PkgVisibleClass</span>",
"Aspect PkgVisibleClass</h2>",
"<pre>aspect <span class=\"typeNameLabel\">PkgVisibleClass</span>"};
- } else
- if (LangUtil.is18VMOrGreater()) {
+ } else {
classStrings = new String[] {
"Class PkgVisibleClass</h2>",
"<pre>class <span class=\"typeNameLabel\">PkgVisibleClass</span>",
"Aspect PkgVisibleClass</h2>",
"<pre>aspect <span class=\"typeNameLabel\">PkgVisibleClass</span>"};
}
- else {
- classStrings = new String[] {
- "Class PkgVisibleClass</H2>",
- "class <B>PkgVisibleClass</B><DT>extends java.lang.Object</DL>",
- "Aspect PkgVisibleClass</H2>",
- "aspect <B>PkgVisibleClass</B><DT>extends java.lang.Object<DT>"};
- }
List<String> classMissing = AjdocOutputChecker.getMissingStringsInFile(htmlFileClass,classStrings);
assertEquals("There should be 2 missing strings",2,classMissing.size());
- if (LangUtil.is18VMOrGreater()) {
- assertTrue(htmlFileClass.getName() + " should not have Aspect as it's title",
- classMissing.contains("Aspect PkgVisibleClass</h2>"));
- assertTrue(htmlFileClass.getName() + " should not have aspect in its subtitle",
- classMissing.contains("<pre>aspect <span class=\"typeNameLabel\">PkgVisibleClass</span>"));
- }
- else {
- assertTrue(htmlFileClass.getName() + " should not have Aspect as it's title",classMissing.contains("Aspect PkgVisibleClass</H2>"));
- assertTrue(htmlFileClass.getName() + " should not have aspect in its subtitle",classMissing.contains("aspect <B>PkgVisibleClass</B><DT>extends java.lang.Object<DT>"));
- }
+ assertTrue(htmlFileClass.getName() + " should not have Aspect as it's title",
+ classMissing.contains("Aspect PkgVisibleClass</h2>"));
+ assertTrue(htmlFileClass.getName() + " should not have aspect in its subtitle",
+ classMissing.contains("<pre>aspect <span class=\"typeNameLabel\">PkgVisibleClass</span>"));
}
/**
@@ -770,30 +714,16 @@ public class CoverageTestCase extends AjdocTestCase {
// ensure that the file is entitled "Aspect ClassWithNestedAspect.NestedAspect"
// rather than "Class ClassWithNestedAspect.NestedAspect"
String[] strings = null;
- if (LangUtil.is18VMOrGreater()) {
- strings = new String [] {
- "Aspect ClassWithNestedAspect.NestedAspect",
- "<pre>static aspect <span class=\"typeNameLabel\">ClassWithNestedAspect.NestedAspect</span>",
- "Class ClassWithNestedAspect.NestedAspect",
- "<pre>static class <span class=\"typeNameLabel\">ClassWithNestedAspect.NestedAspect</span>"};
- }
- else {
- strings = new String [] {
- "Aspect ClassWithNestedAspect.NestedAspect",
- "<PRE>static a;spect <B>ClassWithNestedAspect.NestedAspect</B><DT>extends java.lang.Object</DL>",
- "Class ClassWithNestedAspect.NestedAspect",
- "<PRE>static class <B>ClassWithNestedAspect.NestedAspect</B><DT>extends java.lang.Object</DL>"};
- }
+ strings = new String [] {
+ "Aspect ClassWithNestedAspect.NestedAspect",
+ "<pre>static aspect <span class=\"typeNameLabel\">ClassWithNestedAspect.NestedAspect</span>",
+ "Class ClassWithNestedAspect.NestedAspect",
+ "<pre>static class <span class=\"typeNameLabel\">ClassWithNestedAspect.NestedAspect</span>"};
List<String> missing = AjdocOutputChecker.getMissingStringsInFile(htmlFile,strings);
assertEquals("There should be 2 missing strings",2,missing.size());
assertTrue(htmlFile.getName() + " should not have Class as it's title",missing.contains("Class ClassWithNestedAspect.NestedAspect"));
- if (LangUtil.is18VMOrGreater()) {
- assertTrue(htmlFile.getName() + " should not have class in its subtitle",
- missing.contains("<pre>static class <span class=\"typeNameLabel\">ClassWithNestedAspect.NestedAspect</span>"));
- }
- else {
- assertTrue(htmlFile.getName() + " should not have class in its subtitle",missing.contains("<PRE>static class <B>ClassWithNestedAspect.NestedAspect</B><DT>extends java.lang.Object</DL>"));
- }
+ assertTrue(htmlFile.getName() + " should not have class in its subtitle",
+ missing.contains("<pre>static class <span class=\"typeNameLabel\">ClassWithNestedAspect.NestedAspect</span>"));
// get the html file for the enclosing class
File htmlFileClass = new File(getAbsolutePathOutdir() + "/pkg/ClassWithNestedAspect.html");
@@ -811,35 +741,19 @@ public class CoverageTestCase extends AjdocTestCase {
"public class <span class=\"typeNameLabel\">ClassWithNestedAspect</span>",
"Aspect ClassWithNestedAspect</h2>",
"public aspect <span class=\"typeNameLabel\">ClassWithNestedAspect</span>"};
- } else
- if (LangUtil.is18VMOrGreater()) {
+ } else {
classStrings = new String[] {
"Class ClassWithNestedAspect</h2>",
"public class <span class=\"typeNameLabel\">ClassWithNestedAspect</span>",
"Aspect ClassWithNestedAspect</h2>",
"public aspect <span class=\"typeNameLabel\">ClassWithNestedAspect</span>"};
}
- else {
- classStrings = new String[] {
- "Class ClassWithNestedAspect</H2>",
- "public class <B>ClassWithNestedAspect</B><DT>extends java.lang.Object</DL>",
- "Aspect ClassWithNestedAspect</H2>",
- "public aspect <B>ClassWithNestedAspect</B><DT>extends java.lang.Object</DL>"};
- }
List<String> classMissing = AjdocOutputChecker.getMissingStringsInFile(htmlFileClass,classStrings);
assertEquals("There should be 2 missing strings",2,classMissing.size());
- if (LangUtil.is18VMOrGreater()) {
- assertTrue(htmlFileClass.getName() + " should not have Aspect as it's title",
- classMissing.contains("Aspect ClassWithNestedAspect</h2>"));
- assertTrue(htmlFileClass.getName() + " should not have aspect in its subtitle",
- classMissing.contains("public aspect <span class=\"typeNameLabel\">ClassWithNestedAspect</span>"));
- }
- else {
- assertTrue(htmlFileClass.getName() + " should not have Aspect as it's title",
- classMissing.contains("Aspect ClassWithNestedAspect</H2>"));
- assertTrue(htmlFileClass.getName() + " should not have aspect in its subtitle",
- classMissing.contains("public aspect <B>ClassWithNestedAspect</B><DT>extends java.lang.Object</DL>"));
- }
+ assertTrue(htmlFileClass.getName() + " should not have Aspect as it's title",
+ classMissing.contains("Aspect ClassWithNestedAspect</h2>"));
+ assertTrue(htmlFileClass.getName() + " should not have aspect in its subtitle",
+ classMissing.contains("public aspect <span class=\"typeNameLabel\">ClassWithNestedAspect</span>"));
}
/**
diff --git a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/DeclareFormsTest.java b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/DeclareFormsTest.java
index ea477d699..6f2e36959 100644
--- a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/DeclareFormsTest.java
+++ b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/DeclareFormsTest.java
@@ -291,7 +291,7 @@ public class DeclareFormsTest extends AjdocTestCase {
}
private String toName(String name) {
- if (LangUtil.is18VMOrGreater() && !LangUtil.is11VMOrGreater()) {
+ if (!LangUtil.is11VMOrGreater()) {
name = name.replace('(','-');
name = name.replace(')','-');
}
diff --git a/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
index 0edd55721..ca297eb6e 100644
--- a/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
+++ b/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
@@ -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 */
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());
diff --git a/testing/src/test/java/org/aspectj/testing/AjcTest.java b/testing/src/test/java/org/aspectj/testing/AjcTest.java
index e8098ed09..e9eeafc2f 100644
--- a/testing/src/test/java/org/aspectj/testing/AjcTest.java
+++ b/testing/src/test/java/org/aspectj/testing/AjcTest.java
@@ -34,11 +34,11 @@ 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();
- is18VMOrGreater = LangUtil.is18VMOrGreater();
+ is1dot4VMOrGreater = true;
+ is15VMOrGreater = true;
+ is16VMOrGreater = true;
+ is17VMOrGreater = true;
+ is18VMOrGreater = true;
is19VMOrGreater = LangUtil.is19VMOrGreater();
is10VMOrGreater = LangUtil.is10VMOrGreater();
is11VMOrGreater = LangUtil.is11VMOrGreater();
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc11/Ajc11Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc11/Ajc11Tests.java
index b7fa755db..47c64f2f5 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc11/Ajc11Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc11/Ajc11Tests.java
@@ -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() {
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/Ajc150Tests.java
index 8dcb8c34d..62e96d0df 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc150/Ajc150Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/Ajc150Tests.java
@@ -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() {
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java
index 76c956965..95ab500fc 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java
@@ -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);
diff --git a/tests/src/test/java/org/aspectj/systemtest/java14/Java14Tests.java b/tests/src/test/java/org/aspectj/systemtest/java14/Java14Tests.java
index c46708feb..aa9531979 100644
--- a/tests/src/test/java/org/aspectj/systemtest/java14/Java14Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/java14/Java14Tests.java
@@ -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)");
}
diff --git a/tests/src/test/java/org/aspectj/tests/TestsModuleTests.java b/tests/src/test/java/org/aspectj/tests/TestsModuleTests.java
index 1232f3909..b08e42aed 100644
--- a/tests/src/test/java/org/aspectj/tests/TestsModuleTests.java
+++ b/tests/src/test/java/org/aspectj/tests/TestsModuleTests.java
@@ -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;
@@ -31,20 +29,8 @@ public class TestsModuleTests extends TestCase {
// compiler tests, wrapped for JUnit
if (LangUtil.is19VMOrGreater()) {
suite.addTest(AllTests19.suite());
- } else if (LangUtil.is18VMOrGreater()) {
- suite.addTest(AllTests18.suite());
- } else if (LangUtil.is15VMOrGreater()) {
- // 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());
+ suite.addTest(AllTests18.suite());
}
return suite;
}
diff --git a/util/src/main/java/org/aspectj/util/LangUtil.java b/util/src/main/java/org/aspectj/util/LangUtil.java
index 5c656cd7a..98f53e3c8 100644
--- a/util/src/main/java/org/aspectj/util/LangUtil.java
+++ b/util/src/main/java/org/aspectj/util/LangUtil.java
@@ -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;
}
diff --git a/util/src/test/java/org/aspectj/util/LangUtilTest.java b/util/src/test/java/org/aspectj/util/LangUtilTest.java
index 545cdd904..87b976957 100644
--- a/util/src/test/java/org/aspectj/util/LangUtilTest.java
+++ b/util/src/test/java/org/aspectj/util/LangUtilTest.java
@@ -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());
}
}
diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java b/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java
index 81dde3f58..cd378dbbf 100644
--- a/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java
@@ -108,9 +108,7 @@ public class ClassPathManager {
}
try {
if (name.toLowerCase().endsWith(LangUtil.JRT_FS)) { // Java9+
- if (LangUtil.is18VMOrGreater()) {
- entries.add(new JImageEntry(name));
- }
+ entries.add(new JImageEntry(name));
} else {
entries.add(new ZipFileEntry(f));
}
diff --git a/weaver/src/main/java/org/aspectj/weaver/ltw/LTWWorld.java b/weaver/src/main/java/org/aspectj/weaver/ltw/LTWWorld.java
index 1fc72dd06..c9f1ecffc 100644
--- a/weaver/src/main/java/org/aspectj/weaver/ltw/LTWWorld.java
+++ b/weaver/src/main/java/org/aspectj/weaver/ltw/LTWWorld.java
@@ -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);
}
diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java b/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java
index d3a194fcc..5571ad51f 100644
--- a/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java
@@ -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);
diff --git a/weaver/src/test/java/org/aspectj/weaver/TypeXTestCase.java b/weaver/src/test/java/org/aspectj/weaver/TypeXTestCase.java
index d6b60eb5f..067e12a4c 100644
--- a/weaver/src/test/java/org/aspectj/weaver/TypeXTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/TypeXTestCase.java
@@ -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) {
diff --git a/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java
index eb5c50948..ea276614c 100644
--- a/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java
@@ -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());
}
diff --git a/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java
index 0433846fb..05291af1f 100644
--- a/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java
@@ -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() {
diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutDesignatorHandlerTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutDesignatorHandlerTest.java
index 1ea33c465..8d910baf5 100644
--- a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutDesignatorHandlerTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutDesignatorHandlerTest.java
@@ -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) {
diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutExpressionTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutExpressionTest.java
index ab7762525..d98d1e30e 100644
--- a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutExpressionTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutExpressionTest.java
@@ -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() {
diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java
index 46f841666..589fd6c9b 100644
--- a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java
@@ -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());
diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/TypePatternMatcherTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/TypePatternMatcherTest.java
index 523ee4a83..0096b5482 100644
--- a/weaver/src/test/java/org/aspectj/weaver/tools/TypePatternMatcherTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/TypePatternMatcherTest.java
@@ -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) {