1 /* |
1 /* |
2 * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
69 for (T tree: trees) |
69 for (T tree: trees) |
70 lb.append(copy(tree, p)); |
70 lb.append(copy(tree, p)); |
71 return lb.toList(); |
71 return lb.toList(); |
72 } |
72 } |
73 |
73 |
|
74 public JCTree visitAnnotatedType(AnnotatedTypeTree node, P p) { |
|
75 JCAnnotatedType t = (JCAnnotatedType) node; |
|
76 List<JCAnnotation> annotations = copy(t.annotations, p); |
|
77 JCExpression underlyingType = copy(t.underlyingType, p); |
|
78 return M.at(t.pos).AnnotatedType(annotations, underlyingType); |
|
79 } |
|
80 |
74 public JCTree visitAnnotation(AnnotationTree node, P p) { |
81 public JCTree visitAnnotation(AnnotationTree node, P p) { |
75 JCAnnotation t = (JCAnnotation) node; |
82 JCAnnotation t = (JCAnnotation) node; |
76 JCTree annotationType = copy(t.annotationType, p); |
83 JCTree annotationType = copy(t.annotationType, p); |
77 List<JCExpression> args = copy(t.args, p); |
84 List<JCExpression> args = copy(t.args, p); |
78 return M.at(t.pos).Annotation(annotationType, args); |
85 if (t.getKind() == Tree.Kind.TYPE_ANNOTATION) { |
|
86 JCAnnotation newTA = M.at(t.pos).TypeAnnotation(annotationType, args); |
|
87 newTA.attribute = t.attribute; |
|
88 return newTA; |
|
89 } else { |
|
90 JCAnnotation newT = M.at(t.pos).Annotation(annotationType, args); |
|
91 newT.attribute = t.attribute; |
|
92 return newT; |
|
93 } |
79 } |
94 } |
80 |
95 |
81 public JCTree visitAssert(AssertTree node, P p) { |
96 public JCTree visitAssert(AssertTree node, P p) { |
82 JCAssert t = (JCAssert) node; |
97 JCAssert t = (JCAssert) node; |
83 JCExpression cond = copy(t.cond, p); |
98 JCExpression cond = copy(t.cond, p); |
231 JCMethodDecl t = (JCMethodDecl) node; |
246 JCMethodDecl t = (JCMethodDecl) node; |
232 JCModifiers mods = copy(t.mods, p); |
247 JCModifiers mods = copy(t.mods, p); |
233 JCExpression restype = copy(t.restype, p); |
248 JCExpression restype = copy(t.restype, p); |
234 List<JCTypeParameter> typarams = copy(t.typarams, p); |
249 List<JCTypeParameter> typarams = copy(t.typarams, p); |
235 List<JCVariableDecl> params = copy(t.params, p); |
250 List<JCVariableDecl> params = copy(t.params, p); |
|
251 JCVariableDecl recvparam = copy(t.recvparam, p); |
236 List<JCExpression> thrown = copy(t.thrown, p); |
252 List<JCExpression> thrown = copy(t.thrown, p); |
237 JCBlock body = copy(t.body, p); |
253 JCBlock body = copy(t.body, p); |
238 JCExpression defaultValue = copy(t.defaultValue, p); |
254 JCExpression defaultValue = copy(t.defaultValue, p); |
239 return M.at(t.pos).MethodDef(mods, t.name, restype, typarams, params, thrown, body, defaultValue); |
255 return M.at(t.pos).MethodDef(mods, t.name, restype, typarams, recvparam, params, thrown, body, defaultValue); |
240 } |
256 } |
241 |
257 |
242 public JCTree visitMethodInvocation(MethodInvocationTree node, P p) { |
258 public JCTree visitMethodInvocation(MethodInvocationTree node, P p) { |
243 JCMethodInvocation t = (JCMethodInvocation) node; |
259 JCMethodInvocation t = (JCMethodInvocation) node; |
244 List<JCExpression> typeargs = copy(t.typeargs, p); |
260 List<JCExpression> typeargs = copy(t.typeargs, p); |
382 return M.at(t.pos).TypeIdent(t.typetag); |
398 return M.at(t.pos).TypeIdent(t.typetag); |
383 } |
399 } |
384 |
400 |
385 public JCTree visitTypeParameter(TypeParameterTree node, P p) { |
401 public JCTree visitTypeParameter(TypeParameterTree node, P p) { |
386 JCTypeParameter t = (JCTypeParameter) node; |
402 JCTypeParameter t = (JCTypeParameter) node; |
|
403 List<JCAnnotation> annos = copy(t.annotations, p); |
387 List<JCExpression> bounds = copy(t.bounds, p); |
404 List<JCExpression> bounds = copy(t.bounds, p); |
388 return M.at(t.pos).TypeParameter(t.name, bounds); |
405 return M.at(t.pos).TypeParameter(t.name, bounds, annos); |
389 } |
406 } |
390 |
407 |
391 public JCTree visitInstanceOf(InstanceOfTree node, P p) { |
408 public JCTree visitInstanceOf(InstanceOfTree node, P p) { |
392 JCInstanceOf t = (JCInstanceOf) node; |
409 JCInstanceOf t = (JCInstanceOf) node; |
393 JCExpression expr = copy(t.expr, p); |
410 JCExpression expr = copy(t.expr, p); |