]> source.dussan.org Git - aspectj.git/commitdiff
ajdoc: fixes for 58520 from Helen.
authoraclement <aclement>
Wed, 21 Dec 2005 10:37:43 +0000 (10:37 +0000)
committeraclement <aclement>
Wed, 21 Dec 2005 10:37:43 +0000 (10:37 +0000)
ajdoc/testdata/pr119453/src/pack/C.java
ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTests.java
ajdoc/testsrc/org/aspectj/tools/ajdoc/FullyQualifiedArgumentTest.java [new file with mode: 0644]
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java

index 7b9b839c85a24a6fd556701a397b151dae1f266a..cdeb3e150b85b53ef558deee2b5aae7f287873c2 100644 (file)
@@ -15,4 +15,7 @@ public class C {
                return "";
        }
        
+       public void method3(String s) { 
+       }
+       
 }
index 8a344226465c6453f314d292a73c988187d7babd..409121665bc072e5b8c36a9185249caaa12d32db 100644 (file)
@@ -41,6 +41,7 @@ public class AjdocTests extends TestCase {
         suite.addTestSuite(PatternsTestCase.class);
         suite.addTestSuite(CoverageTestCase.class); 
         suite.addTestSuite(ITDTest.class);
+        suite.addTestSuite(FullyQualifiedArgumentTest.class);
         suite.addTestSuite(ExecutionTestCase.class);// !!! must be last because it exists
         //$JUnit-END$
         return suite;
diff --git a/ajdoc/testsrc/org/aspectj/tools/ajdoc/FullyQualifiedArgumentTest.java b/ajdoc/testsrc/org/aspectj/tools/ajdoc/FullyQualifiedArgumentTest.java
new file mode 100644 (file)
index 0000000..a003aed
--- /dev/null
@@ -0,0 +1,112 @@
+/********************************************************************
+ * Copyright (c) 2005 Contributors. All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: IBM Corporation - initial API and implementation 
+ *                              Helen Hawkins   - iniital version
+ *******************************************************************/
+package org.aspectj.tools.ajdoc;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+
+import junit.framework.TestCase;
+
+import org.aspectj.util.FileUtil;
+
+public class FullyQualifiedArgumentTest extends TestCase {
+
+       private File outdir;
+       private File c, a;
+           
+       protected void setUp() throws Exception {
+               super.setUp();
+               outdir = new File("../ajdoc/testdata/pr119453/doc");
+               c = new File("../ajdoc/testdata/pr119453/src/pack/C.java");
+               a = new File("../ajdoc/testdata/pr119453/src/pack/A.aj");
+       }
+       
+       protected void tearDown() throws Exception {
+               super.tearDown();
+               
+               FileUtil.deleteContents(new File("ajdocworkingdir"));
+               (new File("ajdocworkingdir")).delete();
+               
+               FileUtil.deleteContents(new File("testdata/pr119453/doc"));
+               (new File("testdata/pr119453/doc")).delete();
+       }
+    
+       /**
+        * Test for pr119453
+        */
+    public void testPr58520() throws Exception {
+        outdir.delete();
+        String[] args = { 
+              "-XajdocDebug",
+              "-private",
+            "-d", 
+            outdir.getAbsolutePath(),
+            c.getAbsolutePath(),
+            a.getAbsolutePath()
+        };
+        org.aspectj.tools.ajdoc.Main.main(args);
+        
+        checkContentsOfA();        
+
+    }
+        
+    // check whether the "advises" section of the "Advice Summary" contains
+    // the fully qualified argument, so for example, it says it has href
+    // .../ajdoc/testdata/pr119453/doc/pack/C.html#method3(java.lang.String) 
+    // rather than .../ajdoc/testdata/pr119453/doc/pack/C.html#method3(String)
+    private void checkContentsOfA() throws Exception {
+        File htmlA = new File("../ajdoc/testdata/pr119453/doc/pack/A.html");
+        if (htmlA == null) {
+                       fail("couldn't find ../ajdoc/testdata/pr119453/doc/pack/A.html - were there compilation errors?");
+               }
+           BufferedReader readerA = new BufferedReader(new FileReader(htmlA));
+        boolean containsAdviceSummary = false;
+        String lineA = readerA.readLine();
+        while( lineA != null && (!containsAdviceSummary)) {
+               if (lineA.indexOf("ADVICE SUMMARY") != -1) {
+                       containsAdviceSummary = true;
+                       boolean containsFullyQualifiedArgument = false;
+                       boolean containsUnqualifiedArgument = false;
+                       // walk through the information in this section
+                               String nextLine = readerA.readLine();
+                               while(nextLine != null 
+                                               && (nextLine.indexOf("========") == -1)
+                                               && (!containsFullyQualifiedArgument || 
+                                                               !containsUnqualifiedArgument)) {
+                                       if (nextLine.indexOf("C.html#method3(java.lang.String)") != -1) {
+                                               containsFullyQualifiedArgument = true;
+                                       } 
+                                       if (nextLine.indexOf("C.html#method3(String)") != -1) {
+                                               containsUnqualifiedArgument = true;
+                                       } 
+                                       nextLine = readerA.readLine();
+                               }
+                               assertTrue("Advice summary should have link to " +
+                                               "'C.html#method3(java.lang.String)'", 
+                                               containsFullyQualifiedArgument);
+                               assertFalse("Advice summary should not have link to " +
+                                               "'C.html#method3(String)'", 
+                                               containsUnqualifiedArgument);
+                               
+                               lineA = nextLine;
+                       } else {
+                               lineA = readerA.readLine();
+                       }
+        }
+        readerA.close();
+               
+        assertTrue("should have Advice Summary information in " +
+                       "../ajdoc/testdata/pr119453/doc/pack/A.html", containsAdviceSummary);
+               
+    }
+       
+}
index e62a4a05b3d8dd3a4e8dbe38a6b95ba9a3e8c757..f096a12830434aa0264c7994475afcb43c21184a 100644 (file)
@@ -292,7 +292,7 @@ public class AsmElementFormatter {
                if (argArray == null) return;
                for (int i = 0; i < argArray.length; i++) {
                        String argName = new String(argArray[i].name);
-                       String argType = argArray[i].type.toString();
+                       String argType = argArray[i].type.resolvedType.debugName();
                        if (acceptArgument(argName, argType)) { 
                                names.add(argName);
                                types.add(argType);
index a749205eeed5adb06e0328988048633ed5a6d74f..8ea1774556dfa32c8e08b33de2831d7af7ce46b2 100644 (file)
@@ -418,7 +418,8 @@ public class AsmHierarchyBuilder extends ASTVisitor {
                
                // TODO: add return type test
                if (peNode.getKind().equals(IProgramElement.Kind.METHOD)) {
-                       if (peNode.toLabelString().equals("main(String[])")
+                       if ((peNode.toLabelString().equals("main(String[])")
+                                       || peNode.toLabelString().equals("main(java.lang.String[])"))
                                && peNode.getModifiers().contains(IProgramElement.Modifiers.STATIC)
                                && peNode.getAccessibility().equals(IProgramElement.Accessibility.PUBLIC)) {
                                ((IProgramElement)stack.peek()).setRunnable(true);