Fri, 14 Sep 2012 09:21:55 -0700
7192073: (javac) minor refactoring of tree maker to help IDEs
Reviewed-by: jjg
Contributed-by: jan.lahoda@oracle.com
1.1 --- a/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Thu Sep 13 14:29:36 2012 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Fri Sep 14 09:21:55 2012 -0700 1.3 @@ -117,7 +117,7 @@ 1.4 return instance; 1.5 } 1.6 1.7 - private JavacTrees(Context context) { 1.8 + protected JavacTrees(Context context) { 1.9 context.put(JavacTrees.class, this); 1.10 init(context); 1.11 } 1.12 @@ -286,7 +286,7 @@ 1.13 1.14 1.15 JCCompilationUnit unit = (JCCompilationUnit) path.getCompilationUnit(); 1.16 - Copier copier = new Copier(treeMaker.forToplevel(unit)); 1.17 + Copier copier = createCopier(treeMaker.forToplevel(unit)); 1.18 1.19 Env<AttrContext> env = null; 1.20 JCMethodDecl method = null; 1.21 @@ -372,10 +372,10 @@ 1.22 /** 1.23 * Makes a copy of a tree, noting the value resulting from copying a particular leaf. 1.24 **/ 1.25 - static class Copier extends TreeCopier<JCTree> { 1.26 + protected static class Copier extends TreeCopier<JCTree> { 1.27 JCTree leafCopy = null; 1.28 1.29 - Copier(TreeMaker M) { 1.30 + protected Copier(TreeMaker M) { 1.31 super(M); 1.32 } 1.33 1.34 @@ -388,6 +388,10 @@ 1.35 } 1.36 } 1.37 1.38 + protected Copier createCopier(TreeMaker maker) { 1.39 + return new Copier(maker); 1.40 + } 1.41 + 1.42 /** 1.43 * Gets the original type from the ErrorType object. 1.44 * @param errorType The errorType for which we want to get the original type.
2.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Thu Sep 13 14:29:36 2012 -0700 2.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Fri Sep 14 09:21:55 2012 -0700 2.3 @@ -87,7 +87,7 @@ 2.4 2.5 /** Create a tree maker with a given toplevel and FIRSTPOS as initial position. 2.6 */ 2.7 - TreeMaker(JCCompilationUnit toplevel, Names names, Types types, Symtab syms) { 2.8 + protected TreeMaker(JCCompilationUnit toplevel, Names names, Types types, Symtab syms) { 2.9 this.pos = Position.FIRSTPOS; 2.10 this.toplevel = toplevel; 2.11 this.names = names;