diff options
author | jhugunin <jhugunin> | 2003-01-14 21:36:18 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-01-14 21:36:18 +0000 |
commit | c1260e6b26b78f0f431b778cd8f22d3493e97f3f (patch) | |
tree | f1fbf20ab75fcf540f71727db8e944fff23bdcb6 /asm/src | |
parent | f60b7314484724099896fd9ace6f26e5363b6476 (diff) | |
download | aspectj-c1260e6b26b78f0f431b778cd8f22d3493e97f3f.tar.gz aspectj-c1260e6b26b78f0f431b778cd8f22d3493e97f3f.zip |
fixed bug #29186, much better handling of structure generation
added an Xlint flag for warnings when join points don't have structure nodes
Diffstat (limited to 'asm/src')
-rw-r--r-- | asm/src/org/aspectj/asm/StructureModel.java | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/asm/src/org/aspectj/asm/StructureModel.java b/asm/src/org/aspectj/asm/StructureModel.java index 18f464b4f..831f90f84 100644 --- a/asm/src/org/aspectj/asm/StructureModel.java +++ b/asm/src/org/aspectj/asm/StructureModel.java @@ -70,14 +70,39 @@ public class StructureModel implements Serializable { } if (packageNode == null) return null; } - // !!! this searches each file for a class + + // this searches each file for a class for (Iterator it = packageNode.getChildren().iterator(); it.hasNext(); ) { ProgramElementNode fileNode = (ProgramElementNode)it.next(); - for (Iterator j = fileNode.getChildren().iterator(); j.hasNext(); ) { - ProgramElementNode classNode = (ProgramElementNode)j.next(); - if (classNode instanceof ProgramElementNode && className.equals(classNode.getName())) { - return (ProgramElementNode)classNode; - } + ProgramElementNode ret = findClassInNodes(fileNode.getChildren(), className); + if (ret != null) return ret; + } + + return null; + } + + private ProgramElementNode findClassInNodes(Collection nodes, String name) { + String baseName; + String innerName; + int dollar = name.indexOf('$'); + if (dollar == -1) { + baseName = name; + innerName = null; + } else { + baseName = name.substring(0, dollar); + innerName = name.substring(dollar+1); + } + + + for (Iterator j = nodes.iterator(); j.hasNext(); ) { + ProgramElementNode classNode = (ProgramElementNode)j.next(); +// System.err.println("checking: " + classNode + " for " + baseName); +// System.err.println("children: " + classNode.getChildren()); + if (baseName.equals(classNode.getName())) { + if (innerName == null) return classNode; + else return findClassInNodes(classNode.getChildren(), innerName); + } else if (name.equals(classNode.getName())) { + return classNode; } } return null; |