diff options
5 files changed, 119 insertions, 2 deletions
diff --git a/ajdoc/testdata/pr119453/src/pack/C.java b/ajdoc/testdata/pr119453/src/pack/C.java index 7b9b839c8..cdeb3e150 100644 --- a/ajdoc/testdata/pr119453/src/pack/C.java +++ b/ajdoc/testdata/pr119453/src/pack/C.java @@ -15,4 +15,7 @@ public class C { return ""; } + public void method3(String s) { + } + } diff --git a/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTests.java b/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTests.java index 8a3442264..409121665 100644 --- a/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTests.java +++ b/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTests.java @@ -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 index 000000000..a003aedf3 --- /dev/null +++ b/ajdoc/testsrc/org/aspectj/tools/ajdoc/FullyQualifiedArgumentTest.java @@ -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); + + } + +} diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java index e62a4a05b..f096a1283 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java @@ -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); diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java index a749205ee..8ea177455 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java @@ -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); |