author | rfield |
Mon, 25 Apr 2016 08:50:16 -0700 | |
changeset 37644 | 33cf53901cac |
parent 36160 | f42d362d0d17 |
child 43134 | 006808ae5f6e |
permissions | -rw-r--r-- |
33362 | 1 |
/* |
2 |
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
package jdk.jshell; |
|
27 |
||
28 |
||
29 |
import com.sun.source.tree.ClassTree; |
|
30 |
import com.sun.source.tree.CompilationUnitTree; |
|
31 |
import com.sun.source.tree.ExpressionTree; |
|
32 |
import com.sun.source.tree.MethodTree; |
|
33 |
import com.sun.source.tree.ReturnTree; |
|
34 |
import com.sun.source.tree.StatementTree; |
|
35 |
import com.sun.source.tree.Tree; |
|
36 |
import com.sun.source.tree.VariableTree; |
|
37 |
import com.sun.source.util.SourcePositions; |
|
38 |
import com.sun.source.util.TreePath; |
|
39 |
import com.sun.source.util.Trees; |
|
40 |
import com.sun.tools.javac.code.Type; |
|
41 |
import com.sun.tools.javac.code.Type.MethodType; |
|
42 |
import com.sun.tools.javac.code.Types; |
|
43 |
import com.sun.tools.javac.tree.JCTree.JCMethodDecl; |
|
44 |
import com.sun.tools.javac.util.Name; |
|
45 |
import static jdk.jshell.Util.isDoIt; |
|
36160
f42d362d0d17
8131027: JShell API/tool: suggest imports for a class
jlahoda
parents:
34857
diff
changeset
|
46 |
import jdk.jshell.TaskFactory.AnalyzeTask; |
33362 | 47 |
import jdk.jshell.Wrap.Range; |
36160
f42d362d0d17
8131027: JShell API/tool: suggest imports for a class
jlahoda
parents:
34857
diff
changeset
|
48 |
|
33362 | 49 |
import java.util.List; |
50 |
import java.util.Locale; |
|
36160
f42d362d0d17
8131027: JShell API/tool: suggest imports for a class
jlahoda
parents:
34857
diff
changeset
|
51 |
|
34857
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
52 |
import java.util.function.Predicate; |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
53 |
import java.util.stream.Stream; |
33362 | 54 |
import javax.lang.model.type.TypeMirror; |
34857
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
55 |
import jdk.jshell.Util.Pair; |
33362 | 56 |
|
57 |
/** |
|
58 |
* Utilities for analyzing compiler API parse trees. |
|
59 |
* @author Robert Field |
|
60 |
*/ |
|
61 |
||
62 |
class TreeDissector { |
|
63 |
||
64 |
private static final String OBJECT_TYPE = "Object"; |
|
65 |
||
66 |
static class ExpressionInfo { |
|
67 |
||
68 |
boolean isNonVoid; |
|
69 |
String typeName; |
|
70 |
ExpressionTree tree; |
|
71 |
String signature; |
|
72 |
} |
|
73 |
||
74 |
private final TaskFactory.BaseTask bt; |
|
34857
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
75 |
private final ClassTree targetClass; |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
76 |
private final CompilationUnitTree targetCompilationUnit; |
33362 | 77 |
private SourcePositions theSourcePositions = null; |
78 |
||
34857
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
79 |
private TreeDissector(TaskFactory.BaseTask bt, CompilationUnitTree targetCompilationUnit, ClassTree targetClass) { |
33362 | 80 |
this.bt = bt; |
34857
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
81 |
this.targetCompilationUnit = targetCompilationUnit; |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
82 |
this.targetClass = targetClass; |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
83 |
} |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
84 |
|
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
85 |
static TreeDissector createByFirstClass(TaskFactory.BaseTask bt) { |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
86 |
Pair<CompilationUnitTree, ClassTree> pair = classes(bt.firstCuTree()) |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
87 |
.findFirst().orElseGet(() -> new Pair<>(bt.firstCuTree(), null)); |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
88 |
|
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
89 |
return new TreeDissector(bt, pair.first, pair.second); |
33362 | 90 |
} |
91 |
||
34857
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
92 |
private static final Predicate<? super Tree> isClassOrInterface = |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
93 |
t -> t.getKind() == Tree.Kind.CLASS || t.getKind() == Tree.Kind.INTERFACE; |
33362 | 94 |
|
34857
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
95 |
private static Stream<Pair<CompilationUnitTree, ClassTree>> classes(CompilationUnitTree cut) { |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
96 |
return cut == null |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
97 |
? Stream.empty() |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
98 |
: cut.getTypeDecls().stream() |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
99 |
.filter(isClassOrInterface) |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
100 |
.map(decl -> new Pair<>(cut, (ClassTree)decl)); |
33362 | 101 |
} |
102 |
||
34857
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
103 |
private static Stream<Pair<CompilationUnitTree, ClassTree>> classes(Iterable<? extends CompilationUnitTree> cuts) { |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
104 |
return Util.stream(cuts) |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
105 |
.flatMap(TreeDissector::classes); |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
106 |
} |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
107 |
|
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
108 |
static TreeDissector createBySnippet(TaskFactory.BaseTask bt, Snippet si) { |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
109 |
String name = si.className(); |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
110 |
|
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
111 |
Pair<CompilationUnitTree, ClassTree> pair = classes(bt.cuTrees()) |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
112 |
.filter(p -> p.second.getSimpleName().contentEquals(name)) |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
113 |
.findFirst().orElseThrow(() -> |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
114 |
new IllegalArgumentException("Class " + name + " is not found.")); |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
115 |
|
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
116 |
return new TreeDissector(bt, pair.first, pair.second); |
33362 | 117 |
} |
118 |
||
119 |
Types types() { |
|
120 |
return bt.types(); |
|
121 |
} |
|
122 |
||
123 |
Trees trees() { |
|
124 |
return bt.trees(); |
|
125 |
} |
|
126 |
||
127 |
SourcePositions getSourcePositions() { |
|
128 |
if (theSourcePositions == null) { |
|
129 |
theSourcePositions = trees().getSourcePositions(); |
|
130 |
} |
|
131 |
return theSourcePositions; |
|
132 |
} |
|
133 |
||
134 |
int getStartPosition(Tree tree) { |
|
34857
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
135 |
return (int) getSourcePositions().getStartPosition(targetCompilationUnit, tree); |
33362 | 136 |
} |
137 |
||
138 |
int getEndPosition(Tree tree) { |
|
34857
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
139 |
return (int) getSourcePositions().getEndPosition(targetCompilationUnit, tree); |
33362 | 140 |
} |
141 |
||
142 |
Range treeToRange(Tree tree) { |
|
143 |
return new Range(getStartPosition(tree), getEndPosition(tree)); |
|
144 |
} |
|
145 |
||
146 |
Range treeListToRange(List<? extends Tree> treeList) { |
|
147 |
int start = Integer.MAX_VALUE; |
|
148 |
int end = -1; |
|
149 |
for (Tree t : treeList) { |
|
150 |
int tstart = getStartPosition(t); |
|
151 |
int tend = getEndPosition(t); |
|
152 |
if (tstart < start) { |
|
153 |
start = tstart; |
|
154 |
} |
|
155 |
if (tend > end) { |
|
156 |
end = tend; |
|
157 |
} |
|
158 |
} |
|
159 |
if (start == Integer.MAX_VALUE) { |
|
160 |
return null; |
|
161 |
} |
|
162 |
return new Range(start, end); |
|
163 |
} |
|
164 |
||
37644
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
165 |
MethodTree method(MethodSnippet msn) { |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
166 |
if (targetClass == null) { |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
167 |
return null; |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
168 |
} |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
169 |
OuterWrap ow = msn.outerWrap(); |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
170 |
if (!(ow instanceof OuterSnippetsClassWrap)) { |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
171 |
return null; |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
172 |
} |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
173 |
int ordinal = ((OuterSnippetsClassWrap) ow).ordinal(msn); |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
174 |
if (ordinal < 0) { |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
175 |
return null; |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
176 |
} |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
177 |
int count = 0; |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
178 |
String name = msn.name(); |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
179 |
for (Tree mem : targetClass.getMembers()) { |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
180 |
if (mem.getKind() == Tree.Kind.METHOD) { |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
181 |
MethodTree mt = (MethodTree) mem; |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
182 |
if (mt.getName().toString().equals(name)) { |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
183 |
if (count == ordinal) { |
33362 | 184 |
return mt; |
185 |
} |
|
37644
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
186 |
++count; |
33362 | 187 |
} |
188 |
} |
|
189 |
} |
|
190 |
return null; |
|
191 |
} |
|
192 |
||
193 |
StatementTree firstStatement() { |
|
34857
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
194 |
if (targetClass != null) { |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
195 |
for (Tree mem : targetClass.getMembers()) { |
33362 | 196 |
if (mem.getKind() == Tree.Kind.METHOD) { |
197 |
MethodTree mt = (MethodTree) mem; |
|
198 |
if (isDoIt(mt.getName())) { |
|
199 |
List<? extends StatementTree> stmts = mt.getBody().getStatements(); |
|
200 |
if (!stmts.isEmpty()) { |
|
201 |
return stmts.get(0); |
|
202 |
} |
|
203 |
} |
|
204 |
} |
|
205 |
} |
|
206 |
} |
|
207 |
return null; |
|
208 |
} |
|
209 |
||
210 |
VariableTree firstVariable() { |
|
34857
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
211 |
if (targetClass != null) { |
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
212 |
for (Tree mem : targetClass.getMembers()) { |
33362 | 213 |
if (mem.getKind() == Tree.Kind.VARIABLE) { |
214 |
VariableTree vt = (VariableTree) mem; |
|
215 |
return vt; |
|
216 |
} |
|
217 |
} |
|
218 |
} |
|
219 |
return null; |
|
220 |
} |
|
221 |
||
222 |
||
36160
f42d362d0d17
8131027: JShell API/tool: suggest imports for a class
jlahoda
parents:
34857
diff
changeset
|
223 |
ExpressionInfo typeOfReturnStatement(AnalyzeTask at, JShell state) { |
33362 | 224 |
ExpressionInfo ei = new ExpressionInfo(); |
225 |
Tree unitTree = firstStatement(); |
|
226 |
if (unitTree instanceof ReturnTree) { |
|
227 |
ei.tree = ((ReturnTree) unitTree).getExpression(); |
|
228 |
if (ei.tree != null) { |
|
34857
14d1224cfed3
8145239: JShell: throws AssertionError when replace classes with some methods which depends on these classes
rfield
parents:
33362
diff
changeset
|
229 |
TreePath viPath = trees().getPath(targetCompilationUnit, ei.tree); |
33362 | 230 |
if (viPath != null) { |
231 |
TypeMirror tm = trees().getTypeMirror(viPath); |
|
232 |
if (tm != null) { |
|
36160
f42d362d0d17
8131027: JShell API/tool: suggest imports for a class
jlahoda
parents:
34857
diff
changeset
|
233 |
ei.typeName = printType(at, state, tm); |
33362 | 234 |
switch (tm.getKind()) { |
235 |
case VOID: |
|
236 |
case NONE: |
|
237 |
case ERROR: |
|
238 |
case OTHER: |
|
239 |
break; |
|
240 |
case NULL: |
|
241 |
ei.isNonVoid = true; |
|
242 |
ei.typeName = OBJECT_TYPE; |
|
243 |
break; |
|
244 |
default: { |
|
245 |
ei.isNonVoid = true; |
|
246 |
break; |
|
247 |
||
248 |
} |
|
249 |
} |
|
250 |
} |
|
251 |
} |
|
252 |
} |
|
253 |
} |
|
254 |
return ei; |
|
255 |
} |
|
256 |
||
37644
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
257 |
String typeOfMethod(MethodSnippet msn) { |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
36160
diff
changeset
|
258 |
Tree unitTree = method(msn); |
33362 | 259 |
if (unitTree instanceof JCMethodDecl) { |
260 |
JCMethodDecl mtree = (JCMethodDecl) unitTree; |
|
261 |
Type mt = types().erasure(mtree.type); |
|
262 |
if (mt instanceof MethodType) { |
|
263 |
return signature(types(), (MethodType) mt); |
|
264 |
} |
|
265 |
} |
|
266 |
return null; |
|
267 |
} |
|
268 |
||
269 |
static String signature(Types types, MethodType mt) { |
|
270 |
TDSignatureGenerator sg = new TDSignatureGenerator(types); |
|
271 |
sg.assembleSig(mt); |
|
272 |
return sg.toString(); |
|
273 |
} |
|
274 |
||
36160
f42d362d0d17
8131027: JShell API/tool: suggest imports for a class
jlahoda
parents:
34857
diff
changeset
|
275 |
public static String printType(AnalyzeTask at, JShell state, TypeMirror type) { |
f42d362d0d17
8131027: JShell API/tool: suggest imports for a class
jlahoda
parents:
34857
diff
changeset
|
276 |
Type typeImpl = (Type) type; |
f42d362d0d17
8131027: JShell API/tool: suggest imports for a class
jlahoda
parents:
34857
diff
changeset
|
277 |
TypePrinter tp = new TypePrinter(at.messages(), state.maps::fullClassNameAndPackageToClass, typeImpl); |
f42d362d0d17
8131027: JShell API/tool: suggest imports for a class
jlahoda
parents:
34857
diff
changeset
|
278 |
return tp.visit(typeImpl, Locale.getDefault()); |
f42d362d0d17
8131027: JShell API/tool: suggest imports for a class
jlahoda
parents:
34857
diff
changeset
|
279 |
} |
f42d362d0d17
8131027: JShell API/tool: suggest imports for a class
jlahoda
parents:
34857
diff
changeset
|
280 |
|
33362 | 281 |
/** |
282 |
* Signature Generation |
|
283 |
*/ |
|
284 |
private static class TDSignatureGenerator extends Types.SignatureGenerator { |
|
285 |
||
286 |
/** |
|
287 |
* An output buffer for type signatures. |
|
288 |
*/ |
|
289 |
StringBuilder sb = new StringBuilder(); |
|
290 |
||
291 |
TDSignatureGenerator(Types types) { |
|
292 |
super(types); |
|
293 |
} |
|
294 |
||
295 |
@Override |
|
296 |
protected void append(char ch) { |
|
297 |
sb.append(ch); |
|
298 |
} |
|
299 |
||
300 |
@Override |
|
301 |
protected void append(byte[] ba) { |
|
302 |
sb.append(new String(ba)); |
|
303 |
} |
|
304 |
||
305 |
@Override |
|
306 |
protected void append(Name name) { |
|
307 |
sb.append(name); |
|
308 |
} |
|
309 |
||
310 |
@Override |
|
311 |
public String toString() { |
|
312 |
return sb.toString(); |
|
313 |
} |
|
314 |
} |
|
315 |
} |