summaryrefslogtreecommitdiffstats
path: root/ajdoc
diff options
context:
space:
mode:
authoraclement <aclement>2006-03-31 14:38:58 +0000
committeraclement <aclement>2006-03-31 14:38:58 +0000
commitc3f3a995af26e148d4dd497ed0eff4ebb0787d83 (patch)
tree673f5398474730c475905a0d65a620cf359f8c49 /ajdoc
parentbe0ea2c82e48c3dd64a733cfd7151204e3e2981c (diff)
downloadaspectj-c3f3a995af26e148d4dd497ed0eff4ebb0787d83.tar.gz
aspectj-c3f3a995af26e148d4dd497ed0eff4ebb0787d83.zip
test and fix for 134063
Diffstat (limited to 'ajdoc')
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java28
-rw-r--r--ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTestCase.java23
-rw-r--r--ajdoc/testsrc/org/aspectj/tools/ajdoc/SpacewarTestCase.java6
3 files changed, 47 insertions, 10 deletions
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java b/ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java
index df063f2bd..9ac03867f 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java
@@ -44,7 +44,11 @@ public class StructureUtil {
* @return null if a relationship of that kind is not found
*/
public static List /*String*/ getTargets(IProgramElement node, IRelationship.Kind kind, String relName) {
- List relations = AsmManager.getDefault().getRelationshipMap().get(node);
+ List relations = new ArrayList();
+ List rels = AsmManager.getDefault().getRelationshipMap().get(node);
+ if (rels != null) {
+ relations.addAll(rels);
+ }
for (Iterator iter = node.getChildren().iterator(); iter.hasNext();) {
IProgramElement child = (IProgramElement) iter.next();
// if we're not a type, or if we are and the child is code, then
@@ -54,25 +58,29 @@ public class StructureUtil {
|| child.getKind().equals(IProgramElement.Kind.CODE) ) {
List childRelations = AsmManager.getDefault().getRelationshipMap().get(child);
if (childRelations != null) {
- if (relations == null) {
- relations = childRelations;
- } else {
- relations.addAll(childRelations);
+ for (Iterator iterator = childRelations.iterator(); iterator
+ .hasNext();) {
+ IRelationship rel = (IRelationship) iterator.next();
+ if (!relations.contains(rel)) {
+ relations.add(rel);
+ }
}
}
}
}
- List targets = null;
if (relations == null || relations.isEmpty()) return null;
+ List targets = new ArrayList();
for (Iterator it = relations.iterator(); it.hasNext(); ) {
IRelationship rtn = (IRelationship)it.next();
if (rtn.getKind().equals(kind)
&& ((relName != null && relName.equals(rtn.getName()))
|| relName == null)){
- if (targets == null) {
- targets = rtn.getTargets();
- } else {
- targets.addAll(rtn.getTargets());
+ List targs = rtn.getTargets();
+ for (Iterator iter = targs.iterator(); iter.hasNext();) {
+ String element = (String) iter.next();
+ if (!targets.contains(element)) {
+ targets.add(element);
+ }
}
}
}
diff --git a/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTestCase.java b/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTestCase.java
index 372c9c637..3b79bdb1e 100644
--- a/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTestCase.java
+++ b/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTestCase.java
@@ -273,4 +273,27 @@ public class AjdocTestCase extends TestCase{
}
org.aspectj.tools.ajdoc.Main.main(args);
}
+
+ /**
+ * Run the ajdoc command with the given visibility argument,
+ * the default source level and the given input directories.
+ */
+ public void runAjdoc(String visibility, String lstFile) {
+ if (!visibility.equals("public")
+ && !visibility.equals("protected")
+ && !visibility.equals("private")) {
+ fail("need to pass 'public','protected' or 'private' visibility to ajdoc");
+ }
+
+ String[] args = new String[8];
+ args[0] = "-" + visibility;
+ args[1] = "-classpath";
+ args[2] = AjdocTests.ASPECTJRT_PATH.getPath();
+ args[3] = "-d";
+ args[4] = getAbsolutePathOutdir();
+ args[5] = "-sourcepath";
+ args[6] = getAbsoluteProjectDir();
+ args[7] = "@" + getAbsoluteProjectDir() + File.separatorChar + lstFile;
+ org.aspectj.tools.ajdoc.Main.main(args);
+ }
}
diff --git a/ajdoc/testsrc/org/aspectj/tools/ajdoc/SpacewarTestCase.java b/ajdoc/testsrc/org/aspectj/tools/ajdoc/SpacewarTestCase.java
index b6aa0c4b8..cefdae1d7 100644
--- a/ajdoc/testsrc/org/aspectj/tools/ajdoc/SpacewarTestCase.java
+++ b/ajdoc/testsrc/org/aspectj/tools/ajdoc/SpacewarTestCase.java
@@ -11,6 +11,8 @@
* ******************************************************************/
package org.aspectj.tools.ajdoc;
+import java.io.File;
+
/**
* @author Mik Kersten
@@ -32,4 +34,8 @@ public class SpacewarTestCase extends AjdocTestCase {
runAjdoc("public",dirs);
}
+ public void testPr134063() {
+ String lstFile = "spacewar" + File.separatorChar + "demo.lst";
+ runAjdoc("private",lstFile);
+ }
}