JavaParser Source Viewer

Home|JavaParser/com/github/javaparser/ast/visitor/ModifierVisitor.java
1/*
2 * Copyright (C) 2007-2010 JĂșlio Vilmar Gesser.
3 * Copyright (C) 2011, 2013-2020 The JavaParser Team.
4 *
5 * This file is part of JavaParser.
6 *
7 * JavaParser can be used either under the terms of
8 * a) the GNU Lesser General Public License as published by
9 *     the Free Software Foundation, either version 3 of the License, or
10 *     (at your option) any later version.
11 * b) the terms of the Apache License
12 *
13 * You should have received a copy of both licenses in LICENCE.LGPL and
14 * LICENCE.APACHE. Please refer to those files for details.
15 *
16 * JavaParser is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 * GNU Lesser General Public License for more details.
20 */
21package com.github.javaparser.ast.visitor;
22
23import com.github.javaparser.ast.*;
24import com.github.javaparser.ast.body.*;
25import com.github.javaparser.ast.comments.BlockComment;
26import com.github.javaparser.ast.comments.Comment;
27import com.github.javaparser.ast.comments.JavadocComment;
28import com.github.javaparser.ast.comments.LineComment;
29import com.github.javaparser.ast.expr.*;
30import com.github.javaparser.ast.modules.*;
31import com.github.javaparser.ast.stmt.*;
32import com.github.javaparser.ast.type.*;
33import com.github.javaparser.utils.Pair;
34import java.util.ArrayList;
35import java.util.List;
36import java.util.Optional;
37import static com.github.javaparser.utils.Utils.removeElementByObjectIdentity;
38import static com.github.javaparser.utils.Utils.replaceElementByObjectIdentity;
39
40/**
41 * This visitor can be used to save time when some specific nodes needs
42 * to be changed. To do that just extend this class and override the methods
43 * from the nodes who needs to be changed, returning the changed node.
44 * Returning null will remove the node.
45 * <p>
46 * If a node is removed that was required in its parent node,
47 * the parent node will be removed too.
48 *
49 * @author Julio Vilmar Gesser
50 */
51public class ModifierVisitor<A> implements GenericVisitor<VisitableA> {
52
53    @Override
54    public Visitable visit(final AnnotationDeclaration nfinal A arg) {
55        NodeList<BodyDeclaration<?>> members = modifyList(n.getMembers(), arg);
56        NodeList<Modifiermodifiers = modifyList(n.getModifiers(), arg);
57        SimpleName name = (SimpleNamen.getName().accept(this, arg);
58        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
59        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
60        if (name == null)
61            return null;
62        n.setMembers(members);
63        n.setModifiers(modifiers);
64        n.setName(name);
65        n.setAnnotations(annotations);
66        n.setComment(comment);
67        return n;
68    }
69
70    @Override
71    public Visitable visit(final AnnotationMemberDeclaration nfinal A arg) {
72        Expression defaultValue = n.getDefaultValue().map(s -> (Expressions.accept(this, arg)).orElse(null);
73        NodeList<Modifiermodifiers = modifyList(n.getModifiers(), arg);
74        SimpleName name = (SimpleNamen.getName().accept(this, arg);
75        Type type = (Typen.getType().accept(this, arg);
76        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
77        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
78        if (name == null || type == null)
79            return null;
80        n.setDefaultValue(defaultValue);
81        n.setModifiers(modifiers);
82        n.setName(name);
83        n.setType(type);
84        n.setAnnotations(annotations);
85        n.setComment(comment);
86        return n;
87    }
88
89    @Override
90    public Visitable visit(final ArrayAccessExpr nfinal A arg) {
91        Expression index = (Expressionn.getIndex().accept(this, arg);
92        Expression name = (Expressionn.getName().accept(this, arg);
93        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
94        if (index == null || name == null)
95            return null;
96        n.setIndex(index);
97        n.setName(name);
98        n.setComment(comment);
99        return n;
100    }
101
102    @Override
103    public Visitable visit(final ArrayCreationExpr nfinal A arg) {
104        Type elementType = (Typen.getElementType().accept(this, arg);
105        ArrayInitializerExpr initializer = n.getInitializer().map(s -> (ArrayInitializerExprs.accept(this, arg)).orElse(null);
106        NodeList<ArrayCreationLevellevels = modifyList(n.getLevels(), arg);
107        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
108        if (elementType == null || levels.isEmpty())
109            return null;
110        n.setElementType(elementType);
111        n.setInitializer(initializer);
112        n.setLevels(levels);
113        n.setComment(comment);
114        return n;
115    }
116
117    @Override
118    public Visitable visit(final ArrayInitializerExpr nfinal A arg) {
119        NodeList<Expressionvalues = modifyList(n.getValues(), arg);
120        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
121        n.setValues(values);
122        n.setComment(comment);
123        return n;
124    }
125
126    @Override
127    public Visitable visit(final AssertStmt nfinal A arg) {
128        Expression check = (Expressionn.getCheck().accept(this, arg);
129        Expression message = n.getMessage().map(s -> (Expressions.accept(this, arg)).orElse(null);
130        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
131        if (check == null)
132            return null;
133        n.setCheck(check);
134        n.setMessage(message);
135        n.setComment(comment);
136        return n;
137    }
138
139    @Override
140    public Visitable visit(final AssignExpr nfinal A arg) {
141        Expression target = (Expressionn.getTarget().accept(this, arg);
142        Expression value = (Expressionn.getValue().accept(this, arg);
143        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
144        if (target == null || value == null)
145            return null;
146        n.setTarget(target);
147        n.setValue(value);
148        n.setComment(comment);
149        return n;
150    }
151
152    @Override
153    public Visitable visit(final BinaryExpr nfinal A arg) {
154        Expression left = (Expressionn.getLeft().accept(this, arg);
155        Expression right = (Expressionn.getRight().accept(this, arg);
156        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
157        if (left == null)
158            return right;
159        if (right == null)
160            return left;
161        n.setLeft(left);
162        n.setRight(right);
163        n.setComment(comment);
164        return n;
165    }
166
167    @Override
168    public Visitable visit(final BlockStmt nfinal A arg) {
169        NodeList<Statementstatements = modifyList(n.getStatements(), arg);
170        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
171        n.setStatements(statements);
172        n.setComment(comment);
173        return n;
174    }
175
176    @Override
177    public Visitable visit(final BooleanLiteralExpr nfinal A arg) {
178        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
179        n.setComment(comment);
180        return n;
181    }
182
183    @Override
184    public Visitable visit(final BreakStmt nfinal A arg) {
185        SimpleName label = n.getLabel().map(s -> (SimpleNames.accept(this, arg)).orElse(null);
186        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
187        n.setLabel(label);
188        n.setComment(comment);
189        return n;
190    }
191
192    @Override
193    public Visitable visit(final CastExpr nfinal A arg) {
194        Expression expression = (Expressionn.getExpression().accept(this, arg);
195        Type type = (Typen.getType().accept(this, arg);
196        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
197        if (expression == null || type == null)
198            return null;
199        n.setExpression(expression);
200        n.setType(type);
201        n.setComment(comment);
202        return n;
203    }
204
205    @Override
206    public Visitable visit(final CatchClause nfinal A arg) {
207        BlockStmt body = (BlockStmtn.getBody().accept(this, arg);
208        Parameter parameter = (Parametern.getParameter().accept(this, arg);
209        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
210        if (body == null || parameter == null)
211            return null;
212        n.setBody(body);
213        n.setParameter(parameter);
214        n.setComment(comment);
215        return n;
216    }
217
218    @Override
219    public Visitable visit(final CharLiteralExpr nfinal A arg) {
220        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
221        n.setComment(comment);
222        return n;
223    }
224
225    @Override
226    public Visitable visit(final ClassExpr nfinal A arg) {
227        Type type = (Typen.getType().accept(this, arg);
228        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
229        if (type == null)
230            return null;
231        n.setType(type);
232        n.setComment(comment);
233        return n;
234    }
235
236    @Override
237    public Visitable visit(final ClassOrInterfaceDeclaration nfinal A arg) {
238        NodeList<ClassOrInterfaceTypeextendedTypes = modifyList(n.getExtendedTypes(), arg);
239        NodeList<ClassOrInterfaceTypeimplementedTypes = modifyList(n.getImplementedTypes(), arg);
240        NodeList<TypeParametertypeParameters = modifyList(n.getTypeParameters(), arg);
241        NodeList<BodyDeclaration<?>> members = modifyList(n.getMembers(), arg);
242        NodeList<Modifiermodifiers = modifyList(n.getModifiers(), arg);
243        SimpleName name = (SimpleNamen.getName().accept(this, arg);
244        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
245        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
246        if (name == null)
247            return null;
248        n.setExtendedTypes(extendedTypes);
249        n.setImplementedTypes(implementedTypes);
250        n.setTypeParameters(typeParameters);
251        n.setMembers(members);
252        n.setModifiers(modifiers);
253        n.setName(name);
254        n.setAnnotations(annotations);
255        n.setComment(comment);
256        return n;
257    }
258
259    @Override
260    public Visitable visit(final ClassOrInterfaceType nfinal A arg) {
261        SimpleName name = (SimpleNamen.getName().accept(this, arg);
262        ClassOrInterfaceType scope = n.getScope().map(s -> (ClassOrInterfaceTypes.accept(this, arg)).orElse(null);
263        NodeList<TypetypeArguments = modifyList(n.getTypeArguments(), arg);
264        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
265        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
266        if (name == null)
267            return null;
268        n.setName(name);
269        n.setScope(scope);
270        n.setTypeArguments(typeArguments);
271        n.setAnnotations(annotations);
272        n.setComment(comment);
273        return n;
274    }
275
276    @Override
277    public Visitable visit(final CompilationUnit nfinal A arg) {
278        NodeList<ImportDeclarationimports = modifyList(n.getImports(), arg);
279        ModuleDeclaration module = n.getModule().map(s -> (ModuleDeclarations.accept(this, arg)).orElse(null);
280        PackageDeclaration packageDeclaration = n.getPackageDeclaration().map(s -> (PackageDeclarations.accept(this, arg)).orElse(null);
281        NodeList<TypeDeclaration<?>> types = modifyList(n.getTypes(), arg);
282        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
283        n.setImports(imports);
284        n.setModule(module);
285        n.setPackageDeclaration(packageDeclaration);
286        n.setTypes(types);
287        n.setComment(comment);
288        return n;
289    }
290
291    @Override
292    public Visitable visit(final ConditionalExpr nfinal A arg) {
293        Expression condition = (Expressionn.getCondition().accept(this, arg);
294        Expression elseExpr = (Expressionn.getElseExpr().accept(this, arg);
295        Expression thenExpr = (Expressionn.getThenExpr().accept(this, arg);
296        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
297        if (condition == null || elseExpr == null || thenExpr == null)
298            return null;
299        n.setCondition(condition);
300        n.setElseExpr(elseExpr);
301        n.setThenExpr(thenExpr);
302        n.setComment(comment);
303        return n;
304    }
305
306    @Override
307    public Visitable visit(final ConstructorDeclaration nfinal A arg) {
308        BlockStmt body = (BlockStmtn.getBody().accept(this, arg);
309        NodeList<Modifiermodifiers = modifyList(n.getModifiers(), arg);
310        SimpleName name = (SimpleNamen.getName().accept(this, arg);
311        NodeList<Parameterparameters = modifyList(n.getParameters(), arg);
312        ReceiverParameter receiverParameter = n.getReceiverParameter().map(s -> (ReceiverParameters.accept(this, arg)).orElse(null);
313        NodeList<ReferenceTypethrownExceptions = modifyList(n.getThrownExceptions(), arg);
314        NodeList<TypeParametertypeParameters = modifyList(n.getTypeParameters(), arg);
315        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
316        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
317        if (body == null || name == null)
318            return null;
319        n.setBody(body);
320        n.setModifiers(modifiers);
321        n.setName(name);
322        n.setParameters(parameters);
323        n.setReceiverParameter(receiverParameter);
324        n.setThrownExceptions(thrownExceptions);
325        n.setTypeParameters(typeParameters);
326        n.setAnnotations(annotations);
327        n.setComment(comment);
328        return n;
329    }
330
331    @Override
332    public Visitable visit(final ContinueStmt nfinal A arg) {
333        SimpleName label = n.getLabel().map(s -> (SimpleNames.accept(this, arg)).orElse(null);
334        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
335        n.setLabel(label);
336        n.setComment(comment);
337        return n;
338    }
339
340    @Override
341    public Visitable visit(final DoStmt nfinal A arg) {
342        Statement body = (Statementn.getBody().accept(this, arg);
343        Expression condition = (Expressionn.getCondition().accept(this, arg);
344        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
345        if (body == null || condition == null)
346            return null;
347        n.setBody(body);
348        n.setCondition(condition);
349        n.setComment(comment);
350        return n;
351    }
352
353    @Override
354    public Visitable visit(final DoubleLiteralExpr nfinal A arg) {
355        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
356        n.setComment(comment);
357        return n;
358    }
359
360    @Override
361    public Visitable visit(final EmptyStmt nfinal A arg) {
362        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
363        n.setComment(comment);
364        return n;
365    }
366
367    @Override
368    public Visitable visit(final EnclosedExpr nfinal A arg) {
369        Expression inner = (Expressionn.getInner().accept(this, arg);
370        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
371        if (inner == null)
372            return null;
373        n.setInner(inner);
374        n.setComment(comment);
375        return n;
376    }
377
378    @Override
379    public Visitable visit(final EnumConstantDeclaration nfinal A arg) {
380        NodeList<Expressionarguments = modifyList(n.getArguments(), arg);
381        NodeList<BodyDeclaration<?>> classBody = modifyList(n.getClassBody(), arg);
382        SimpleName name = (SimpleNamen.getName().accept(this, arg);
383        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
384        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
385        if (name == null)
386            return null;
387        n.setArguments(arguments);
388        n.setClassBody(classBody);
389        n.setName(name);
390        n.setAnnotations(annotations);
391        n.setComment(comment);
392        return n;
393    }
394
395    @Override
396    public Visitable visit(final EnumDeclaration nfinal A arg) {
397        NodeList<EnumConstantDeclarationentries = modifyList(n.getEntries(), arg);
398        NodeList<ClassOrInterfaceTypeimplementedTypes = modifyList(n.getImplementedTypes(), arg);
399        NodeList<BodyDeclaration<?>> members = modifyList(n.getMembers(), arg);
400        NodeList<Modifiermodifiers = modifyList(n.getModifiers(), arg);
401        SimpleName name = (SimpleNamen.getName().accept(this, arg);
402        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
403        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
404        if (name == null)
405            return null;
406        n.setEntries(entries);
407        n.setImplementedTypes(implementedTypes);
408        n.setMembers(members);
409        n.setModifiers(modifiers);
410        n.setName(name);
411        n.setAnnotations(annotations);
412        n.setComment(comment);
413        return n;
414    }
415
416    @Override
417    public Visitable visit(final ExplicitConstructorInvocationStmt nfinal A arg) {
418        NodeList<Expressionarguments = modifyList(n.getArguments(), arg);
419        Expression expression = n.getExpression().map(s -> (Expressions.accept(this, arg)).orElse(null);
420        NodeList<TypetypeArguments = modifyList(n.getTypeArguments(), arg);
421        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
422        n.setArguments(arguments);
423        n.setExpression(expression);
424        n.setTypeArguments(typeArguments);
425        n.setComment(comment);
426        return n;
427    }
428
429    @Override
430    public Visitable visit(final ExpressionStmt nfinal A arg) {
431        Expression expression = (Expressionn.getExpression().accept(this, arg);
432        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
433        if (expression == null)
434            return null;
435        n.setExpression(expression);
436        n.setComment(comment);
437        return n;
438    }
439
440    @Override
441    public Visitable visit(final FieldAccessExpr nfinal A arg) {
442        SimpleName name = (SimpleNamen.getName().accept(this, arg);
443        Expression scope = (Expressionn.getScope().accept(this, arg);
444        NodeList<TypetypeArguments = modifyList(n.getTypeArguments(), arg);
445        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
446        if (name == null || scope == null)
447            return null;
448        n.setName(name);
449        n.setScope(scope);
450        n.setTypeArguments(typeArguments);
451        n.setComment(comment);
452        return n;
453    }
454
455    @Override
456    public Visitable visit(final FieldDeclaration nfinal A arg) {
457        NodeList<Modifiermodifiers = modifyList(n.getModifiers(), arg);
458        NodeList<VariableDeclaratorvariables = modifyList(n.getVariables(), arg);
459        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
460        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
461        if (variables.isEmpty())
462            return null;
463        n.setModifiers(modifiers);
464        n.setVariables(variables);
465        n.setAnnotations(annotations);
466        n.setComment(comment);
467        return n;
468    }
469
470    @Override
471    public Visitable visit(final ForEachStmt nfinal A arg) {
472        Statement body = (Statementn.getBody().accept(this, arg);
473        Expression iterable = (Expressionn.getIterable().accept(this, arg);
474        VariableDeclarationExpr variable = (VariableDeclarationExprn.getVariable().accept(this, arg);
475        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
476        if (body == null || iterable == null || variable == null)
477            return null;
478        n.setBody(body);
479        n.setIterable(iterable);
480        n.setVariable(variable);
481        n.setComment(comment);
482        return n;
483    }
484
485    @Override
486    public Visitable visit(final ForStmt nfinal A arg) {
487        Statement body = (Statementn.getBody().accept(this, arg);
488        Expression compare = n.getCompare().map(s -> (Expressions.accept(this, arg)).orElse(null);
489        NodeList<Expressioninitialization = modifyList(n.getInitialization(), arg);
490        NodeList<Expressionupdate = modifyList(n.getUpdate(), arg);
491        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
492        if (body == null)
493            return null;
494        n.setBody(body);
495        n.setCompare(compare);
496        n.setInitialization(initialization);
497        n.setUpdate(update);
498        n.setComment(comment);
499        return n;
500    }
501
502    @Override
503    public Visitable visit(final IfStmt nfinal A arg) {
504        Expression condition = (Expressionn.getCondition().accept(this, arg);
505        Statement elseStmt = n.getElseStmt().map(s -> (Statements.accept(this, arg)).orElse(null);
506        Statement thenStmt = (Statementn.getThenStmt().accept(this, arg);
507        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
508        if (condition == null || thenStmt == null)
509            return null;
510        n.setCondition(condition);
511        n.setElseStmt(elseStmt);
512        n.setThenStmt(thenStmt);
513        n.setComment(comment);
514        return n;
515    }
516
517    @Override
518    public Visitable visit(final InitializerDeclaration nfinal A arg) {
519        BlockStmt body = (BlockStmtn.getBody().accept(this, arg);
520        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
521        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
522        if (body == null)
523            return null;
524        n.setBody(body);
525        n.setAnnotations(annotations);
526        n.setComment(comment);
527        return n;
528    }
529
530    @Override
531    public Visitable visit(final InstanceOfExpr nfinal A arg) {
532        Expression expression = (Expressionn.getExpression().accept(this, arg);
533        ReferenceType type = (ReferenceTypen.getType().accept(this, arg);
534        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
535        if (expression == null || type == null)
536            return null;
537        n.setExpression(expression);
538        n.setType(type);
539        n.setComment(comment);
540        return n;
541    }
542
543    @Override
544    public Visitable visit(final IntegerLiteralExpr nfinal A arg) {
545        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
546        n.setComment(comment);
547        return n;
548    }
549
550    @Override
551    public Visitable visit(final JavadocComment nfinal A arg) {
552        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
553        n.setComment(comment);
554        return n;
555    }
556
557    @Override
558    public Visitable visit(final LabeledStmt nfinal A arg) {
559        SimpleName label = (SimpleNamen.getLabel().accept(this, arg);
560        Statement statement = (Statementn.getStatement().accept(this, arg);
561        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
562        if (label == null || statement == null)
563            return null;
564        n.setLabel(label);
565        n.setStatement(statement);
566        n.setComment(comment);
567        return n;
568    }
569
570    @Override
571    public Visitable visit(final LongLiteralExpr nfinal A arg) {
572        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
573        n.setComment(comment);
574        return n;
575    }
576
577    @Override
578    public Visitable visit(final MarkerAnnotationExpr nfinal A arg) {
579        Name name = (Namen.getName().accept(this, arg);
580        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
581        if (name == null)
582            return null;
583        n.setName(name);
584        n.setComment(comment);
585        return n;
586    }
587
588    @Override
589    public Visitable visit(final MemberValuePair nfinal A arg) {
590        SimpleName name = (SimpleNamen.getName().accept(this, arg);
591        Expression value = (Expressionn.getValue().accept(this, arg);
592        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
593        if (name == null || value == null)
594            return null;
595        n.setName(name);
596        n.setValue(value);
597        n.setComment(comment);
598        return n;
599    }
600
601    @Override
602    public Visitable visit(final MethodCallExpr nfinal A arg) {
603        NodeList<Expressionarguments = modifyList(n.getArguments(), arg);
604        SimpleName name = (SimpleNamen.getName().accept(this, arg);
605        Expression scope = n.getScope().map(s -> (Expressions.accept(this, arg)).orElse(null);
606        NodeList<TypetypeArguments = modifyList(n.getTypeArguments(), arg);
607        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
608        if (name == null)
609            return null;
610        n.setArguments(arguments);
611        n.setName(name);
612        n.setScope(scope);
613        n.setTypeArguments(typeArguments);
614        n.setComment(comment);
615        return n;
616    }
617
618    @Override
619    public Visitable visit(final MethodDeclaration nfinal A arg) {
620        BlockStmt body = n.getBody().map(s -> (BlockStmts.accept(this, arg)).orElse(null);
621        Type type = (Typen.getType().accept(this, arg);
622        NodeList<Modifiermodifiers = modifyList(n.getModifiers(), arg);
623        SimpleName name = (SimpleNamen.getName().accept(this, arg);
624        NodeList<Parameterparameters = modifyList(n.getParameters(), arg);
625        ReceiverParameter receiverParameter = n.getReceiverParameter().map(s -> (ReceiverParameters.accept(this, arg)).orElse(null);
626        NodeList<ReferenceTypethrownExceptions = modifyList(n.getThrownExceptions(), arg);
627        NodeList<TypeParametertypeParameters = modifyList(n.getTypeParameters(), arg);
628        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
629        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
630        if (type == null || name == null)
631            return null;
632        n.setBody(body);
633        n.setType(type);
634        n.setModifiers(modifiers);
635        n.setName(name);
636        n.setParameters(parameters);
637        n.setReceiverParameter(receiverParameter);
638        n.setThrownExceptions(thrownExceptions);
639        n.setTypeParameters(typeParameters);
640        n.setAnnotations(annotations);
641        n.setComment(comment);
642        return n;
643    }
644
645    @Override
646    public Visitable visit(final NameExpr nfinal A arg) {
647        SimpleName name = (SimpleNamen.getName().accept(this, arg);
648        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
649        if (name == null)
650            return null;
651        n.setName(name);
652        n.setComment(comment);
653        return n;
654    }
655
656    @Override
657    public Visitable visit(final NormalAnnotationExpr nfinal A arg) {
658        NodeList<MemberValuePairpairs = modifyList(n.getPairs(), arg);
659        Name name = (Namen.getName().accept(this, arg);
660        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
661        if (name == null)
662            return null;
663        n.setPairs(pairs);
664        n.setName(name);
665        n.setComment(comment);
666        return n;
667    }
668
669    @Override
670    public Visitable visit(final NullLiteralExpr nfinal A arg) {
671        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
672        n.setComment(comment);
673        return n;
674    }
675
676    @Override
677    public Visitable visit(final ObjectCreationExpr nfinal A arg) {
678        NodeList<BodyDeclaration<?>> anonymousClassBody = modifyList(n.getAnonymousClassBody(), arg);
679        NodeList<Expressionarguments = modifyList(n.getArguments(), arg);
680        Expression scope = n.getScope().map(s -> (Expressions.accept(this, arg)).orElse(null);
681        ClassOrInterfaceType type = (ClassOrInterfaceTypen.getType().accept(this, arg);
682        NodeList<TypetypeArguments = modifyList(n.getTypeArguments(), arg);
683        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
684        if (type == null)
685            return null;
686        n.setAnonymousClassBody(anonymousClassBody);
687        n.setArguments(arguments);
688        n.setScope(scope);
689        n.setType(type);
690        n.setTypeArguments(typeArguments);
691        n.setComment(comment);
692        return n;
693    }
694
695    @Override
696    public Visitable visit(final PackageDeclaration nfinal A arg) {
697        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
698        Name name = (Namen.getName().accept(this, arg);
699        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
700        if (name == null)
701            return null;
702        n.setAnnotations(annotations);
703        n.setName(name);
704        n.setComment(comment);
705        return n;
706    }
707
708    @Override
709    public Visitable visit(final Parameter nfinal A arg) {
710        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
711        NodeList<Modifiermodifiers = modifyList(n.getModifiers(), arg);
712        SimpleName name = (SimpleNamen.getName().accept(this, arg);
713        Type type = (Typen.getType().accept(this, arg);
714        NodeList<AnnotationExprvarArgsAnnotations = modifyList(n.getVarArgsAnnotations(), arg);
715        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
716        if (name == null || type == null)
717            return null;
718        n.setAnnotations(annotations);
719        n.setModifiers(modifiers);
720        n.setName(name);
721        n.setType(type);
722        n.setVarArgsAnnotations(varArgsAnnotations);
723        n.setComment(comment);
724        return n;
725    }
726
727    @Override
728    public Visitable visit(final Name nfinal A arg) {
729        Name qualifier = n.getQualifier().map(s -> (Names.accept(this, arg)).orElse(null);
730        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
731        n.setQualifier(qualifier);
732        n.setComment(comment);
733        return n;
734    }
735
736    @Override
737    public Visitable visit(final PrimitiveType nfinal A arg) {
738        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
739        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
740        n.setAnnotations(annotations);
741        n.setComment(comment);
742        return n;
743    }
744
745    @Override
746    public Visitable visit(final SimpleName nfinal A arg) {
747        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
748        n.setComment(comment);
749        return n;
750    }
751
752    @Override
753    public Visitable visit(final ArrayType nfinal A arg) {
754        Type componentType = (Typen.getComponentType().accept(this, arg);
755        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
756        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
757        if (componentType == null)
758            return null;
759        n.setComponentType(componentType);
760        n.setAnnotations(annotations);
761        n.setComment(comment);
762        return n;
763    }
764
765    @Override
766    public Visitable visit(final ArrayCreationLevel nfinal A arg) {
767        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
768        Expression dimension = n.getDimension().map(s -> (Expressions.accept(this, arg)).orElse(null);
769        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
770        n.setAnnotations(annotations);
771        n.setDimension(dimension);
772        n.setComment(comment);
773        return n;
774    }
775
776    @Override
777    public Visitable visit(final IntersectionType nfinal A arg) {
778        NodeList<ReferenceTypeelements = modifyList(n.getElements(), arg);
779        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
780        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
781        if (elements.isEmpty())
782            return null;
783        n.setElements(elements);
784        n.setAnnotations(annotations);
785        n.setComment(comment);
786        return n;
787    }
788
789    @Override
790    public Visitable visit(final UnionType nfinal A arg) {
791        NodeList<ReferenceTypeelements = modifyList(n.getElements(), arg);
792        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
793        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
794        if (elements.isEmpty())
795            return null;
796        n.setElements(elements);
797        n.setAnnotations(annotations);
798        n.setComment(comment);
799        return n;
800    }
801
802    @Override
803    public Visitable visit(final ReturnStmt nfinal A arg) {
804        Expression expression = n.getExpression().map(s -> (Expressions.accept(this, arg)).orElse(null);
805        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
806        n.setExpression(expression);
807        n.setComment(comment);
808        return n;
809    }
810
811    @Override
812    public Visitable visit(final SingleMemberAnnotationExpr nfinal A arg) {
813        Expression memberValue = (Expressionn.getMemberValue().accept(this, arg);
814        Name name = (Namen.getName().accept(this, arg);
815        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
816        if (memberValue == null || name == null)
817            return null;
818        n.setMemberValue(memberValue);
819        n.setName(name);
820        n.setComment(comment);
821        return n;
822    }
823
824    @Override
825    public Visitable visit(final StringLiteralExpr nfinal A arg) {
826        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
827        n.setComment(comment);
828        return n;
829    }
830
831    @Override
832    public Visitable visit(final SuperExpr nfinal A arg) {
833        Name typeName = n.getTypeName().map(s -> (Names.accept(this, arg)).orElse(null);
834        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
835        n.setTypeName(typeName);
836        n.setComment(comment);
837        return n;
838    }
839
840    @Override
841    public Visitable visit(final SwitchEntry nfinal A arg) {
842        NodeList<Expressionlabels = modifyList(n.getLabels(), arg);
843        NodeList<Statementstatements = modifyList(n.getStatements(), arg);
844        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
845        n.setLabels(labels);
846        n.setStatements(statements);
847        n.setComment(comment);
848        return n;
849    }
850
851    @Override
852    public Visitable visit(final SwitchStmt nfinal A arg) {
853        NodeList<SwitchEntryentries = modifyList(n.getEntries(), arg);
854        Expression selector = (Expressionn.getSelector().accept(this, arg);
855        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
856        if (selector == null)
857            return null;
858        n.setEntries(entries);
859        n.setSelector(selector);
860        n.setComment(comment);
861        return n;
862    }
863
864    @Override
865    public Visitable visit(final SynchronizedStmt nfinal A arg) {
866        BlockStmt body = (BlockStmtn.getBody().accept(this, arg);
867        Expression expression = (Expressionn.getExpression().accept(this, arg);
868        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
869        if (body == null || expression == null)
870            return null;
871        n.setBody(body);
872        n.setExpression(expression);
873        n.setComment(comment);
874        return n;
875    }
876
877    @Override
878    public Visitable visit(final ThisExpr nfinal A arg) {
879        Name typeName = n.getTypeName().map(s -> (Names.accept(this, arg)).orElse(null);
880        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
881        n.setTypeName(typeName);
882        n.setComment(comment);
883        return n;
884    }
885
886    @Override
887    public Visitable visit(final ThrowStmt nfinal A arg) {
888        Expression expression = (Expressionn.getExpression().accept(this, arg);
889        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
890        if (expression == null)
891            return null;
892        n.setExpression(expression);
893        n.setComment(comment);
894        return n;
895    }
896
897    @Override
898    public Visitable visit(final TryStmt nfinal A arg) {
899        NodeList<CatchClausecatchClauses = modifyList(n.getCatchClauses(), arg);
900        BlockStmt finallyBlock = n.getFinallyBlock().map(s -> (BlockStmts.accept(this, arg)).orElse(null);
901        NodeList<Expressionresources = modifyList(n.getResources(), arg);
902        BlockStmt tryBlock = (BlockStmtn.getTryBlock().accept(this, arg);
903        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
904        if (tryBlock == null)
905            return null;
906        n.setCatchClauses(catchClauses);
907        n.setFinallyBlock(finallyBlock);
908        n.setResources(resources);
909        n.setTryBlock(tryBlock);
910        n.setComment(comment);
911        return n;
912    }
913
914    @Override
915    public Visitable visit(final LocalClassDeclarationStmt nfinal A arg) {
916        ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclarationn.getClassDeclaration().accept(this, arg);
917        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
918        if (classDeclaration == null)
919            return null;
920        n.setClassDeclaration(classDeclaration);
921        n.setComment(comment);
922        return n;
923    }
924
925    @Override
926    public Visitable visit(final TypeParameter nfinal A arg) {
927        SimpleName name = (SimpleNamen.getName().accept(this, arg);
928        NodeList<ClassOrInterfaceTypetypeBound = modifyList(n.getTypeBound(), arg);
929        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
930        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
931        if (name == null)
932            return null;
933        n.setName(name);
934        n.setTypeBound(typeBound);
935        n.setAnnotations(annotations);
936        n.setComment(comment);
937        return n;
938    }
939
940    @Override
941    public Visitable visit(final UnaryExpr nfinal A arg) {
942        Expression expression = (Expressionn.getExpression().accept(this, arg);
943        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
944        if (expression == null)
945            return null;
946        n.setExpression(expression);
947        n.setComment(comment);
948        return n;
949    }
950
951    @Override
952    public Visitable visit(final UnknownType nfinal A arg) {
953        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
954        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
955        n.setAnnotations(annotations);
956        n.setComment(comment);
957        return n;
958    }
959
960    @Override
961    public Visitable visit(final VariableDeclarationExpr nfinal A arg) {
962        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
963        NodeList<Modifiermodifiers = modifyList(n.getModifiers(), arg);
964        NodeList<VariableDeclaratorvariables = modifyList(n.getVariables(), arg);
965        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
966        if (variables.isEmpty())
967            return null;
968        n.setAnnotations(annotations);
969        n.setModifiers(modifiers);
970        n.setVariables(variables);
971        n.setComment(comment);
972        return n;
973    }
974
975    @Override
976    public Visitable visit(final VariableDeclarator nfinal A arg) {
977        Expression initializer = n.getInitializer().map(s -> (Expressions.accept(this, arg)).orElse(null);
978        SimpleName name = (SimpleNamen.getName().accept(this, arg);
979        Type type = (Typen.getType().accept(this, arg);
980        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
981        if (name == null || type == null)
982            return null;
983        n.setInitializer(initializer);
984        n.setName(name);
985        n.setType(type);
986        n.setComment(comment);
987        return n;
988    }
989
990    @Override
991    public Visitable visit(final VoidType nfinal A arg) {
992        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
993        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
994        n.setAnnotations(annotations);
995        n.setComment(comment);
996        return n;
997    }
998
999    @Override
1000    public Visitable visit(final WhileStmt nfinal A arg) {
1001        Statement body = (Statementn.getBody().accept(this, arg);
1002        Expression condition = (Expressionn.getCondition().accept(this, arg);
1003        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1004        if (body == null || condition == null)
1005            return null;
1006        n.setBody(body);
1007        n.setCondition(condition);
1008        n.setComment(comment);
1009        return n;
1010    }
1011
1012    @Override
1013    public Visitable visit(final WildcardType nfinal A arg) {
1014        ReferenceType extendedType = n.getExtendedType().map(s -> (ReferenceTypes.accept(this, arg)).orElse(null);
1015        ReferenceType superType = n.getSuperType().map(s -> (ReferenceTypes.accept(this, arg)).orElse(null);
1016        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
1017        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1018        n.setExtendedType(extendedType);
1019        n.setSuperType(superType);
1020        n.setAnnotations(annotations);
1021        n.setComment(comment);
1022        return n;
1023    }
1024
1025    @Override
1026    public Visitable visit(final LambdaExpr nfinal A arg) {
1027        Statement body = (Statementn.getBody().accept(this, arg);
1028        NodeList<Parameterparameters = modifyList(n.getParameters(), arg);
1029        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1030        if (body == null)
1031            return null;
1032        n.setBody(body);
1033        n.setParameters(parameters);
1034        n.setComment(comment);
1035        return n;
1036    }
1037
1038    @Override
1039    public Visitable visit(final MethodReferenceExpr nfinal A arg) {
1040        Expression scope = (Expressionn.getScope().accept(this, arg);
1041        NodeList<TypetypeArguments = modifyList(n.getTypeArguments(), arg);
1042        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1043        if (scope == null)
1044            return null;
1045        n.setScope(scope);
1046        n.setTypeArguments(typeArguments);
1047        n.setComment(comment);
1048        return n;
1049    }
1050
1051    @Override
1052    public Visitable visit(final TypeExpr nfinal A arg) {
1053        Type type = (Typen.getType().accept(this, arg);
1054        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1055        if (type == null)
1056            return null;
1057        n.setType(type);
1058        n.setComment(comment);
1059        return n;
1060    }
1061
1062    @Override
1063    public Visitable visit(NodeList nA arg) {
1064        if (n.isEmpty()) {
1065            return n;
1066        }
1067        final List<Pair<NodeNode>> changeList = new ArrayList<>();
1068        final List<NodelistCopy = new ArrayList<>(n);
1069        for (Node node : listCopy) {
1070            final Node newNode = (Nodenode.accept(this, arg);
1071            changeList.add(new Pair<>(nodenewNode));
1072        }
1073        for (Pair<NodeNodechange : changeList) {
1074            if (change.b == null) {
1075                removeElementByObjectIdentity(nchange.a);
1076            } else {
1077                replaceElementByObjectIdentity(nchange.achange.b);
1078            }
1079        }
1080        return n;
1081    }
1082
1083    @Override
1084    public Node visit(final ImportDeclaration nfinal A arg) {
1085        Name name = (Namen.getName().accept(this, arg);
1086        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1087        if (name == null)
1088            return null;
1089        n.setName(name);
1090        n.setComment(comment);
1091        return n;
1092    }
1093
1094    @Override
1095    public Visitable visit(final BlockComment nfinal A arg) {
1096        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1097        n.setComment(comment);
1098        return n;
1099    }
1100
1101    @Override
1102    public Visitable visit(final LineComment nfinal A arg) {
1103        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1104        n.setComment(comment);
1105        return n;
1106    }
1107
1108    private <N extends NodeNodeList<NmodifyList(NodeList<NlistA arg) {
1109        return (NodeList<N>) list.accept(this, arg);
1110    }
1111
1112    private <N extends NodeNodeList<NmodifyList(Optional<NodeList<N>> listA arg) {
1113        return list.map(ns -> modifyList(nsarg)).orElse(null);
1114    }
1115
1116    public Visitable visit(final ModuleDeclaration nfinal A arg) {
1117        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
1118        NodeList<ModuleDirectivedirectives = modifyList(n.getDirectives(), arg);
1119        Name name = (Namen.getName().accept(this, arg);
1120        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1121        if (name == null)
1122            return null;
1123        n.setAnnotations(annotations);
1124        n.setDirectives(directives);
1125        n.setName(name);
1126        n.setComment(comment);
1127        return n;
1128    }
1129
1130    public Visitable visit(final ModuleRequiresDirective nfinal A arg) {
1131        NodeList<Modifiermodifiers = modifyList(n.getModifiers(), arg);
1132        Name name = (Namen.getName().accept(this, arg);
1133        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1134        if (name == null)
1135            return null;
1136        n.setModifiers(modifiers);
1137        n.setName(name);
1138        n.setComment(comment);
1139        return n;
1140    }
1141
1142    @Override()
1143    public Visitable visit(final ModuleExportsDirective nfinal A arg) {
1144        NodeList<NamemoduleNames = modifyList(n.getModuleNames(), arg);
1145        Name name = (Namen.getName().accept(this, arg);
1146        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1147        if (name == null)
1148            return null;
1149        n.setModuleNames(moduleNames);
1150        n.setName(name);
1151        n.setComment(comment);
1152        return n;
1153    }
1154
1155    @Override()
1156    public Visitable visit(final ModuleProvidesDirective nfinal A arg) {
1157        Name name = (Namen.getName().accept(this, arg);
1158        NodeList<Namewith = modifyList(n.getWith(), arg);
1159        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1160        if (name == null)
1161            return null;
1162        n.setName(name);
1163        n.setWith(with);
1164        n.setComment(comment);
1165        return n;
1166    }
1167
1168    @Override()
1169    public Visitable visit(final ModuleUsesDirective nfinal A arg) {
1170        Name name = (Namen.getName().accept(this, arg);
1171        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1172        if (name == null)
1173            return null;
1174        n.setName(name);
1175        n.setComment(comment);
1176        return n;
1177    }
1178
1179    @Override
1180    public Visitable visit(final ModuleOpensDirective nfinal A arg) {
1181        NodeList<NamemoduleNames = modifyList(n.getModuleNames(), arg);
1182        Name name = (Namen.getName().accept(this, arg);
1183        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1184        if (name == null)
1185            return null;
1186        n.setModuleNames(moduleNames);
1187        n.setName(name);
1188        n.setComment(comment);
1189        return n;
1190    }
1191
1192    @Override
1193    public Visitable visit(final UnparsableStmt nfinal A arg) {
1194        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1195        n.setComment(comment);
1196        return n;
1197    }
1198
1199    @Override
1200    public Visitable visit(final ReceiverParameter nfinal A arg) {
1201        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
1202        Name name = (Namen.getName().accept(this, arg);
1203        Type type = (Typen.getType().accept(this, arg);
1204        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1205        if (name == null || type == null)
1206            return null;
1207        n.setAnnotations(annotations);
1208        n.setName(name);
1209        n.setType(type);
1210        n.setComment(comment);
1211        return n;
1212    }
1213
1214    @Override
1215    public Visitable visit(final VarType nfinal A arg) {
1216        NodeList<AnnotationExprannotations = modifyList(n.getAnnotations(), arg);
1217        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1218        n.setAnnotations(annotations);
1219        n.setComment(comment);
1220        return n;
1221    }
1222
1223    @Override
1224    public Visitable visit(final Modifier nfinal A arg) {
1225        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1226        n.setComment(comment);
1227        return n;
1228    }
1229
1230    @Override
1231    public Visitable visit(final SwitchExpr nfinal A arg) {
1232        NodeList<SwitchEntryentries = modifyList(n.getEntries(), arg);
1233        Expression selector = (Expressionn.getSelector().accept(this, arg);
1234        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1235        if (selector == null)
1236            return null;
1237        n.setEntries(entries);
1238        n.setSelector(selector);
1239        n.setComment(comment);
1240        return n;
1241    }
1242
1243    @Override
1244    public Visitable visit(final YieldStmt nfinal A arg) {
1245        Expression expression = (Expressionn.getExpression().accept(this, arg);
1246        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1247        if (expression == null)
1248            return null;
1249        n.setExpression(expression);
1250        n.setComment(comment);
1251        return n;
1252    }
1253
1254    @Override
1255    public Visitable visit(final TextBlockLiteralExpr nfinal A arg) {
1256        Comment comment = n.getComment().map(s -> (Comments.accept(this, arg)).orElse(null);
1257        n.setComment(comment);
1258        return n;
1259    }
1260}
1261
MembersX
ModifierVisitor:visit:Block:elseStmt
ModifierVisitor:visit:Block:tryBlock
ModifierVisitor:visit:Block:initialization
ModifierVisitor:visit:Block:qualifier
ModifierVisitor:visit:Block:entries
ModifierVisitor:visit:Block:componentType
ModifierVisitor:visit:Block:pairs
ModifierVisitor:visit:Block:moduleNames
ModifierVisitor:visit:Block:typeName
ModifierVisitor:visit:Block:packageDeclaration
ModifierVisitor:visit:Block:levels
ModifierVisitor:visit:Block:receiverParameter
ModifierVisitor:visit:Block:update
ModifierVisitor:visit:Block:values
ModifierVisitor:visit:Block:thrownExceptions
ModifierVisitor:visit:Block:typeArguments
ModifierVisitor:visit:Block:parameter
ModifierVisitor:visit:Block:labels
ModifierVisitor:visit:Block:anonymousClassBody
ModifierVisitor:visit:Block:initializer
ModifierVisitor:visit:Block:check
ModifierVisitor:visit:Block:memberValue
ModifierVisitor:visit:Block:annotations
ModifierVisitor:visit:Block:varArgsAnnotations
ModifierVisitor:visit:Block:with
ModifierVisitor:visit:Block:changeList
ModifierVisitor:visit
ModifierVisitor:visit:Block:directives
ModifierVisitor:visit:Block:condition
ModifierVisitor:visit:Block:typeBound
ModifierVisitor:visit:Block:variable
ModifierVisitor:visit:Block:classDeclaration
ModifierVisitor:visit:Block:target
ModifierVisitor:visit:Block:elements
ModifierVisitor:visit:Block:iterable
ModifierVisitor:visit:Block:expression
ModifierVisitor:modifyList
ModifierVisitor:visit:Block:type
ModifierVisitor:visit:Block:modifiers
ModifierVisitor:visit:Block:index
ModifierVisitor:visit:Block:elseExpr
ModifierVisitor:visit:Block:catchClauses
ModifierVisitor:visit:Block:Block:newNode
ModifierVisitor:visit:Block:inner
ModifierVisitor:visit:Block:classBody
ModifierVisitor:visit:Block:thenStmt
ModifierVisitor:visit:Block:listCopy
ModifierVisitor:visit:Block:module
ModifierVisitor:visit:Block:statement
ModifierVisitor:visit:Block:comment
ModifierVisitor:visit:Block:label
ModifierVisitor:visit:Block:body
ModifierVisitor:visit:Block:message
ModifierVisitor:visit:Block:types
ModifierVisitor:visit:Block:scope
ModifierVisitor:visit:Block:parameters
ModifierVisitor:visit:Block:imports
ModifierVisitor:visit:Block:dimension
ModifierVisitor:visit:Block:selector
ModifierVisitor:visit:Block:defaultValue
ModifierVisitor:visit:Block:elementType
ModifierVisitor:visit:Block:value
ModifierVisitor:visit:Block:extendedType
ModifierVisitor:visit:Block:members
ModifierVisitor:visit:Block:extendedTypes
ModifierVisitor:visit:Block:statements
ModifierVisitor:visit:Block:thenExpr
ModifierVisitor:visit:Block:right
ModifierVisitor:visit:Block:variables
ModifierVisitor:visit:Block:resources
ModifierVisitor:visit:Block:compare
ModifierVisitor:visit:Block:implementedTypes
ModifierVisitor:visit:Block:typeParameters
ModifierVisitor:visit:Block:name
ModifierVisitor:visit:Block:arguments
ModifierVisitor:visit:Block:finallyBlock
ModifierVisitor:visit:Block:superType
ModifierVisitor:visit:Block:left
Members
X