]> source.dussan.org Git - aspectj.git/commitdiff
Simplify checks for Java 8 to true
authorLars Grefer <eclipse@larsgrefer.de>
Thu, 13 Aug 2020 22:25:54 +0000 (00:25 +0200)
committerLars Grefer <eclipse@larsgrefer.de>
Thu, 13 Aug 2020 22:25:54 +0000 (00:25 +0200)
Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java
ajdoc/src/test/java/org/aspectj/tools/ajdoc/DeclareFormsTest.java
testing/src/test/java/org/aspectj/testing/AjcTest.java
tests/src/test/java/org/aspectj/tests/TestsModuleTests.java
weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java

index 61172346cb1fdd7dcd806cbeae07fcab23f93d88..ea8568cd873144143f405560631ed60ee967c3d8 100644 (file)
@@ -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>"));
        }
 
        /**
index ea477d6994bb63b33918a6a6700a2bf180331415..6f2e369590ce37d34a842e2e28726ae20d9ee779 100644 (file)
@@ -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(')','-');
                }
index 09e623554ff0f658cd068a663e37182030a4ce7c..e9eeafc2f45dfff5d9ce492c48b627046d94b4f6 100644 (file)
@@ -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();
index 9c83f47f0b61b4cb5ef0a6dab08c41b919f5f49d..b08e42aede23595db9a50e5cb3bc04333450b530 100644 (file)
@@ -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;
        }
index 81dde3f581788ff2ec29aab2eb0b69a71cdc3f7f..cd378dbbf695cff63448fe7ff1c3221c00c2afd6 100644 (file)
@@ -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));
                                }