diff --git a/src/share/classes/com/sun/tools/javac/api/JavacTrees.java b/src/share/classes/com/sun/tools/javac/api/JavacTrees.java index a52fb87329d5305c0d8ba416fffbcbe71a517c6a..c446e0a9947998b228d346bfbdfc77016650c560 100644 --- a/src/share/classes/com/sun/tools/javac/api/JavacTrees.java +++ b/src/share/classes/com/sun/tools/javac/api/JavacTrees.java @@ -117,7 +117,7 @@ public class JavacTrees extends Trees { return instance; } - private JavacTrees(Context context) { + protected JavacTrees(Context context) { context.put(JavacTrees.class, this); init(context); } @@ -286,7 +286,7 @@ public class JavacTrees extends Trees { JCCompilationUnit unit = (JCCompilationUnit) path.getCompilationUnit(); - Copier copier = new Copier(treeMaker.forToplevel(unit)); + Copier copier = createCopier(treeMaker.forToplevel(unit)); Env env = null; JCMethodDecl method = null; @@ -372,10 +372,10 @@ public class JavacTrees extends Trees { /** * Makes a copy of a tree, noting the value resulting from copying a particular leaf. **/ - static class Copier extends TreeCopier { + protected static class Copier extends TreeCopier { JCTree leafCopy = null; - Copier(TreeMaker M) { + protected Copier(TreeMaker M) { super(M); } @@ -388,6 +388,10 @@ public class JavacTrees extends Trees { } } + protected Copier createCopier(TreeMaker maker) { + return new Copier(maker); + } + /** * Gets the original type from the ErrorType object. * @param errorType The errorType for which we want to get the original type. diff --git a/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java b/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java index f9be124079fca9fcda7ad1e171feaf1f93d442d7..25f064ec85b718d0fcb3c8127c8edcb2ba7542a7 100644 --- a/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java +++ b/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java @@ -87,7 +87,7 @@ public class TreeMaker implements JCTree.Factory { /** Create a tree maker with a given toplevel and FIRSTPOS as initial position. */ - TreeMaker(JCCompilationUnit toplevel, Names names, Types types, Symtab syms) { + protected TreeMaker(JCCompilationUnit toplevel, Names names, Types types, Symtab syms) { this.pos = Position.FIRSTPOS; this.toplevel = toplevel; this.names = names;