]> source.dussan.org Git - aspectj.git/commitdiff
fixing for Javadoc differences in 1.8
authorAndy Clement <aclement@gopivotal.com>
Fri, 8 Aug 2014 19:58:17 +0000 (12:58 -0700)
committerAndy Clement <aclement@gopivotal.com>
Fri, 8 Aug 2014 19:58:17 +0000 (12:58 -0700)
ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocOutputChecker.java
ajdoc/testsrc/org/aspectj/tools/ajdoc/CoverageTestCase.java
ajdoc/testsrc/org/aspectj/tools/ajdoc/DeclareFormsTest.java

index d46b2a4afc21ec66296c423077ebc85565a7352f..10e22fbf6ed390e315685037b6ad80198cff268a 100644 (file)
@@ -207,12 +207,12 @@ public class AjdocOutputChecker {
                                // found the required main section
                                String nextLine = reader.readLine();
                                while (nextLine != null && (nextLine.indexOf("========") == -1)) {
-                                       if (nextLine.indexOf("NAME=\""+source+"\"") != -1) {
+                                       if (nextLine.indexOf("NAME=\""+source+"\"") != -1 || nextLine.indexOf("name=\""+source+"\"") != -1) {
                                                // found the required subsection
                                                String subLine = reader.readLine();
                                                while(subLine != null 
                                                                && (subLine.indexOf("========") == -1)
-                                                               && (subLine.indexOf("NAME") == -1)) {
+                                                               && (subLine.indexOf("NAME") == -1 && subLine.indexOf("name") == -1)) {
                                                        int relIndex = subLine.indexOf(relationship.toString());
                                                        int targetIndex = subLine.indexOf(target);
                                                        if ((relIndex != -1) && (targetIndex != -1)) {
index db36be452f6e56608e0abc1d693c6504f47e464b..0c0a0f26831f1b2993f1c19ff1da192a496af690 100644 (file)
@@ -14,6 +14,8 @@
 import java.io.File;
 import java.util.List;
 
+import org.aspectj.util.LangUtil;
+
 
 /**
  * A long way to go until full coverage, but this is the place to add more.
@@ -253,7 +255,7 @@ public class CoverageTestCase extends AjdocTestCase {
                }
         
                String[] strings = {
-                               "setX(int)",
+                               toName("setX(int)"),
                                "HREF=\"../foo/AdvisesRelationshipCoverage.html#before(): methodExecutionP..\""};
                boolean b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== METHOD DETAIL",
@@ -284,7 +286,7 @@ public class CoverageTestCase extends AjdocTestCase {
                }
         
                String[] strings = {
-                               "Point()",
+                               toName("Point()"),
                                "HREF=\"../foo/AdvisesRelationshipCoverage.html#before(): constructorExecutionP..\""};
                boolean b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== CONSTRUCTOR DETAIL",
@@ -315,7 +317,7 @@ public class CoverageTestCase extends AjdocTestCase {
                }
         
                String[] strings = {
-                               "changeX(int)",
+                               toName("changeX(int)"),
                                "HREF=\"../foo/AdvisesRelationshipCoverage.html#before(): callMethodP..\""};
                boolean b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== METHOD DETAIL",
@@ -346,7 +348,7 @@ public class CoverageTestCase extends AjdocTestCase {
                }
         
                String[] strings = {
-                               "doIt()",
+                               toName("doIt()"),
                                "HREF=\"../foo/AdvisesRelationshipCoverage.html#before(): callConstructorP..\""};
                boolean b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== METHOD DETAIL",
@@ -377,7 +379,7 @@ public class CoverageTestCase extends AjdocTestCase {
                }
         
                String[] strings = {
-                               "getX()",
+                               toName("getX()"),
                                "HREF=\"../foo/AdvisesRelationshipCoverage.html#before(): getP..\""};
                boolean b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== METHOD DETAIL",
@@ -410,28 +412,28 @@ public class CoverageTestCase extends AjdocTestCase {
                String href = "HREF=\"../foo/AdvisesRelationshipCoverage.html#before(): setP..\"";
                boolean b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== METHOD DETAIL",
-                               "setX(int)",
+                               toName("setX(int)"),
                                HtmlDecorator.HtmlRelationshipKind.ADVISED_BY,
                                href);
                assertTrue("the Method Detail should have setX(int) advised by " + href,b);
                
                b = AjdocOutputChecker.summarySectionContainsRel(
                                htmlFile,"=== METHOD SUMMARY",
-                               "setX(int)",
+                               toName("setX(int)"),
                                HtmlDecorator.HtmlRelationshipKind.ADVISED_BY,
                                href);
                assertTrue("the Method Summary should have setX(int) advised by " + href,b);
 
                b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== CONSTRUCTOR DETAIL",
-                               "Point()",
+                               toName("Point()"),
                                HtmlDecorator.HtmlRelationshipKind.ADVISED_BY,
                                href);
                assertTrue("the Constructor Detail should have advised by " + href,b);
                
                b = AjdocOutputChecker.summarySectionContainsRel(
                                htmlFile,"=== CONSTRUCTOR SUMMARY",
-                               "Point()",
+                               toName("Point()"),
                                HtmlDecorator.HtmlRelationshipKind.ADVISED_BY,
                                href);
                assertTrue("the Constructor Summary should have advised by " + href,b);
@@ -457,7 +459,7 @@ public class CoverageTestCase extends AjdocTestCase {
                }
         
                String[] strings = {
-                               "Point()",
+                               toName("Point()"),
                                "HREF=\"../foo/AdvisesRelationshipCoverage.html#before(): initializationP..\""};
                boolean b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== CONSTRUCTOR DETAIL",strings[0],
@@ -506,7 +508,7 @@ public class CoverageTestCase extends AjdocTestCase {
                }
         
                String[] strings = {
-                               "doIt()",
+                               toName("doIt()"),
                                "HREF=\"../foo/AdvisesRelationshipCoverage.html#before(): handlerP..\""};
                boolean b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== METHOD DETAIL",
@@ -523,6 +525,13 @@ public class CoverageTestCase extends AjdocTestCase {
                assertTrue("the Method Summary should have " + strings[0]+" advised by " + strings[1],b);
     }
 
+       private String toName(String name) {
+               if (LangUtil.is18VMOrGreater()) {
+                       name = name.replace('(','-');
+                       name = name.replace(')','-');
+               }
+               return name;
+       }
     /**
      * Test that if have two before advice blocks from the same
      * aspect affect the same method, then both appear in the ajdoc 
@@ -537,7 +546,7 @@ public class CoverageTestCase extends AjdocTestCase {
                }
         
                String[] strings = {
-                               "amethod()",
+                               toName("amethod()"),
                                "HREF=\"../pkg/A2.html#before(): p..\"",
                                "HREF=\"../pkg/A2.html#before(): p2..\""};
                boolean b = AjdocOutputChecker.detailSectionContainsRel(
@@ -746,7 +755,7 @@ public class CoverageTestCase extends AjdocTestCase {
                
                b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== METHOD DETAIL",
-                               "amethod()",
+                               toName("amethod()"),
                                HtmlDecorator.HtmlRelationshipKind.ADVISED_BY,
                                "HREF=\"../pkg/ClassWithNestedAspect.NestedAspect.html#before(): p..\"");
                assertTrue("Should have 'amethod() advised by " +
@@ -755,7 +764,7 @@ public class CoverageTestCase extends AjdocTestCase {
 
                b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== METHOD DETAIL",
-                               "amethod()",
+                               toName("amethod()"),
                                HtmlDecorator.HtmlRelationshipKind.ADVISED_BY,
                                "pkg.ClassWithNestedAspect.NestedAspect.NestedAspect.before(): p..");
                assertFalse("Should not have the label " +
@@ -764,7 +773,7 @@ public class CoverageTestCase extends AjdocTestCase {
 
                b = AjdocOutputChecker.summarySectionContainsRel(
                                        htmlFile,"=== METHOD SUMMARY",
-                                       "amethod()",
+                                       toName("amethod()"),
                                        HtmlDecorator.HtmlRelationshipKind.ADVISED_BY,
                                        "HREF=\"../pkg/ClassWithNestedAspect.NestedAspect.html#before(): p..\"");
                assertTrue("Should have 'amethod() advised by " +
@@ -773,7 +782,7 @@ public class CoverageTestCase extends AjdocTestCase {
 
                b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== METHOD SUMMARY",
-                               "amethod()",
+                               toName("amethod()"),
                                HtmlDecorator.HtmlRelationshipKind.ADVISED_BY,
                "pkg.ClassWithNestedAspect.NestedAspect.NestedAspect.before(): p..");
                assertFalse("Should not have the label " +
index 652d1a5e739a2216878e9395f88a83623f3a4bbf..fbb711bdcb5e1575827ab36efd25fa930f5a4bf5 100644 (file)
@@ -15,6 +15,8 @@ package org.aspectj.tools.ajdoc;
 import java.io.File;
 import java.util.List;
 
+import org.aspectj.util.LangUtil;
+
 /**
  * @author Mik Kersten
  */
@@ -124,14 +126,15 @@ public class DeclareFormsTest extends AjdocTestCase {
                
                boolean b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== METHOD DETAIL",
-                               doIt,
+                               LangUtil.is18VMOrGreater()?"doIt--":doIt,
+//                             doIt,
                                HtmlDecorator.HtmlRelationshipKind.MATCHES_DECLARE,
                                declareWarningQuotes);
                assertTrue("Should have '" + doIt + " matches declare " + 
                                declareWarningQuotes + "' in the Declare Detail section", b);
         b = AjdocOutputChecker.summarySectionContainsRel(
                                        htmlFile,"=== METHOD SUMMARY",
-                                       doIt,
+                                       LangUtil.is18VMOrGreater()?"doIt--":doIt,
                                        HtmlDecorator.HtmlRelationshipKind.MATCHES_DECLARE,
                                        declareWarningQuotes);
                assertTrue("Should have '" + doIt + " matches declare " + 
@@ -156,14 +159,14 @@ public class DeclareFormsTest extends AjdocTestCase {
                
                boolean b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== METHOD DETAIL",
-                               "setX(int)",
+                               LangUtil.is18VMOrGreater()?"setX-int-":"setX(int)",
                                HtmlDecorator.HtmlRelationshipKind.MATCHES_DECLARE,
                                "declare warning: quot;blahquot;");
                assertTrue("Should have 'setX(int) matches declare declare warning: quot;blahquot;" + 
                                "' in the Method Detail section", b);
         b = AjdocOutputChecker.summarySectionContainsRel(
                                        htmlFile,"=== METHOD SUMMARY",
-                                       "setX(int)",
+                                       LangUtil.is18VMOrGreater()?"setX-int-":"setX(int)",
                                        HtmlDecorator.HtmlRelationshipKind.MATCHES_DECLARE,
                                        "declare warning: quot;blahquot;");
                assertTrue("Should have 'setX(int) matches declare declare warning: quot;blahquot;" + 
@@ -272,20 +275,28 @@ public class DeclareFormsTest extends AjdocTestCase {
                
                boolean b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== METHOD DETAIL",
-                               doIt,
+                               toName(doIt),
                                HtmlDecorator.HtmlRelationshipKind.SOFTENED_BY,
                                declareSoft);
                assertTrue("Should have '" + doIt + " softened by " + declareSoft + 
                                "' in the Method Detail section", b);
         b = AjdocOutputChecker.summarySectionContainsRel(
                                        htmlFile,"=== METHOD SUMMARY",
-                                       doIt,
+                                       toName(doIt),
                                        HtmlDecorator.HtmlRelationshipKind.SOFTENED_BY,
                                        declareSoft);
                assertTrue("Should have '" + doIt + " softened by " + declareSoft + 
                                "' in the Method Summary section", b);
        }
        
+       private String toName(String name) {
+               if (LangUtil.is18VMOrGreater()) {
+                       name = name.replace('(','-');
+                       name = name.replace(')','-');
+               }
+               return name;
+       }
+       
        /**
         * Declare annotation should have the 'annotates' relationship
         * in the ajdoc for the declaring aspect
@@ -348,7 +359,7 @@ public class DeclareFormsTest extends AjdocTestCase {
                
                boolean b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== METHOD DETAIL",
-                               "amethod()",
+                               toName("amethod()"),
                                HtmlDecorator.HtmlRelationshipKind.ANNOTATED_BY,
                                "declare @method: public * foo.C.*(..) : @MyAnnotation");
                assertTrue("Should have 'amethod() annotated by " +
@@ -356,7 +367,7 @@ public class DeclareFormsTest extends AjdocTestCase {
                                "' in the Method Detail section", b);
         b = AjdocOutputChecker.summarySectionContainsRel(
                                htmlFile,"=== METHOD SUMMARY",
-                               "amethod()",
+                               toName("amethod()"),
                                HtmlDecorator.HtmlRelationshipKind.ANNOTATED_BY,
                                "declare @method: public * foo.C.*(..) : @MyAnnotation");
                assertTrue("Should have 'amethod() annotated by " +
@@ -382,7 +393,7 @@ public class DeclareFormsTest extends AjdocTestCase {
                
                boolean b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== CONSTRUCTOR DETAIL",
-                               "C(java.lang.String)",
+                               toName("C(java.lang.String)"),
                                HtmlDecorator.HtmlRelationshipKind.ANNOTATED_BY,
                                "declare @constructor: foo.C.new(..) : @MyAnnotation");
                assertTrue("Should have '" + doIt + " annotated by " + 
@@ -390,7 +401,7 @@ public class DeclareFormsTest extends AjdocTestCase {
                                "' in the Method Detail section", b);
         b = AjdocOutputChecker.summarySectionContainsRel(
                                htmlFile,"=== CONSTRUCTOR SUMMARY",
-                               "C(java.lang.String)",
+                               toName("C(java.lang.String)"),
                                HtmlDecorator.HtmlRelationshipKind.ANNOTATED_BY,
                                "declare @constructor: foo.C.new(..) : @MyAnnotation");
                assertTrue("Should have '" + doIt + " annotated by " + 
@@ -473,14 +484,14 @@ public class DeclareFormsTest extends AjdocTestCase {
                
                boolean b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== METHOD DETAIL",
-                               "amethod()",
+                               toName("amethod()"),
                                HtmlDecorator.HtmlRelationshipKind.MATCHES_DECLARE,
                                "declare warning: quot;warningquot;");
                assertTrue("Should have 'amethod() matches declare declare warning: " +
                                "quot;warningquot;' in the Method Detail section", b);
         b = AjdocOutputChecker.summarySectionContainsRel(
                                        htmlFile,"=== METHOD SUMMARY",
-                                       "amethod()",
+                                       toName("amethod()"),
                                        HtmlDecorator.HtmlRelationshipKind.MATCHES_DECLARE,
                                        "declare warning: quot;warningquot;");
                assertTrue("Should have 'amethod() matches declare declare warning: " +
@@ -488,14 +499,14 @@ public class DeclareFormsTest extends AjdocTestCase {
                
                b = AjdocOutputChecker.detailSectionContainsRel(
                                htmlFile,"=== METHOD DETAIL",
-                               "amethod()",
+                               toName("amethod()"),
                                HtmlDecorator.HtmlRelationshipKind.ADVISED_BY,
                                "before(): p..");
                assertTrue("the Method Detail should have amethod() advised by before(): p..",b);
                
                b = AjdocOutputChecker.summarySectionContainsRel(
                                htmlFile,"=== METHOD SUMMARY",
-                               "amethod()",
+                               toName("amethod()"),
                                HtmlDecorator.HtmlRelationshipKind.ADVISED_BY,
                                "before(): p..");
                assertTrue("the Method Summary should have amethod() advised by before(): p..",b);