diff options
author | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-14 00:25:54 +0200 |
---|---|---|
committer | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-14 00:25:54 +0200 |
commit | 05f797adde987f614684cb70999be99c549d6826 (patch) | |
tree | d60e24451cf58a67582cf5a939f5c06fa314617b | |
parent | d7ba05ce26dd8f72c1d0695ece2cb03d035e3cf9 (diff) | |
download | aspectj-05f797adde987f614684cb70999be99c549d6826.tar.gz aspectj-05f797adde987f614684cb70999be99c549d6826.zip |
Simplify checks for Java 8 to true
Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
5 files changed, 40 insertions, 132 deletions
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/testing/src/test/java/org/aspectj/testing/AjcTest.java b/testing/src/test/java/org/aspectj/testing/AjcTest.java index 09e623554..e9eeafc2f 100644 --- a/testing/src/test/java/org/aspectj/testing/AjcTest.java +++ b/testing/src/test/java/org/aspectj/testing/AjcTest.java @@ -38,7 +38,7 @@ public class AjcTest { is15VMOrGreater = true; is16VMOrGreater = true; is17VMOrGreater = true; - is18VMOrGreater = LangUtil.is18VMOrGreater(); + is18VMOrGreater = true; is19VMOrGreater = LangUtil.is19VMOrGreater(); is10VMOrGreater = LangUtil.is10VMOrGreater(); is11VMOrGreater = LangUtil.is11VMOrGreater(); diff --git a/tests/src/test/java/org/aspectj/tests/TestsModuleTests.java b/tests/src/test/java/org/aspectj/tests/TestsModuleTests.java index 9c83f47f0..b08e42aed 100644 --- a/tests/src/test/java/org/aspectj/tests/TestsModuleTests.java +++ b/tests/src/test/java/org/aspectj/tests/TestsModuleTests.java @@ -29,12 +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 { - // 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 + suite.addTest(AllTests18.suite()); } return suite; } 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)); } |