1.1 --- a/src/share/classes/com/sun/source/util/TreePath.java Mon Dec 17 14:54:42 2012 +0000 1.2 +++ b/src/share/classes/com/sun/source/util/TreePath.java Mon Dec 17 07:47:05 2012 -0800 1.3 @@ -60,14 +60,20 @@ 1.4 this.path = path; 1.5 } 1.6 } 1.7 + 1.8 class PathFinder extends TreePathScanner<TreePath,Tree> { 1.9 public TreePath scan(Tree tree, Tree target) { 1.10 - if (tree == target) 1.11 + if (tree == target) { 1.12 throw new Result(new TreePath(getCurrentPath(), target)); 1.13 + } 1.14 return super.scan(tree, target); 1.15 } 1.16 } 1.17 1.18 + if (path.getLeaf() == target) { 1.19 + return path; 1.20 + } 1.21 + 1.22 try { 1.23 new PathFinder().scan(path, target); 1.24 } catch (Result result) {