openrewrite-remote 0.3.3__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1376 +0,0 @@
1
- from pathlib import Path
2
- from typing import Optional, Any, cast, Type, Callable
3
- from uuid import UUID
4
-
5
- from rewrite import Cursor, Checksum, FileAttributes, Tree
6
- from rewrite.java import *
7
- from rewrite.java.support_types import *
8
- from rewrite.java.visitor import JavaVisitor
9
-
10
- from rewrite.remote import Receiver, ReceiverContext, T, ReceiverFactory
11
- from . import extensions
12
-
13
- class JavaReceiver(Receiver):
14
- def fork(self, ctx: ReceiverContext) -> ReceiverContext:
15
- return ctx.fork(self.Visitor(), self.Factory())
16
-
17
- def receive(self, before: Optional[T], ctx: ReceiverContext) -> Any:
18
- forked = self.fork(ctx)
19
- return forked.visitor.visit(before, forked)
20
-
21
- # noinspection DuplicatedCode,PyMethodFirstArgAssignment,PyTypeChecker
22
- class Visitor(JavaVisitor[ReceiverContext]):
23
- def visit(self, tree: Optional[Tree], ctx: ReceiverContext, parent: Optional[Cursor] = None) -> Optional[J]:
24
- if parent is not None:
25
- self.cursor = parent
26
-
27
- self.cursor = Cursor(self.cursor, tree)
28
-
29
- tree = ctx.receive_node(cast(J, tree), ctx.receive_tree)
30
-
31
- self.cursor = self.cursor.parent
32
- return cast(J, tree)
33
-
34
- def visit_annotated_type(self, annotated_type: AnnotatedType, ctx: ReceiverContext) -> J:
35
- annotated_type = annotated_type.with_id(ctx.receive_value(annotated_type.id, UUID))
36
- annotated_type = annotated_type.with_prefix(ctx.receive_node(annotated_type.prefix, JavaReceiver.receive_space))
37
- annotated_type = annotated_type.with_markers(ctx.receive_node(annotated_type.markers, ctx.receive_markers))
38
- annotated_type = annotated_type.with_annotations(ctx.receive_nodes(annotated_type.annotations, ctx.receive_tree))
39
- annotated_type = annotated_type.with_type_expression(ctx.receive_node(annotated_type.type_expression, ctx.receive_tree))
40
- return annotated_type
41
-
42
- def visit_annotation(self, annotation: Annotation, ctx: ReceiverContext) -> J:
43
- annotation = annotation.with_id(ctx.receive_value(annotation.id, UUID))
44
- annotation = annotation.with_prefix(ctx.receive_node(annotation.prefix, JavaReceiver.receive_space))
45
- annotation = annotation.with_markers(ctx.receive_node(annotation.markers, ctx.receive_markers))
46
- annotation = annotation.with_annotation_type(ctx.receive_node(annotation.annotation_type, ctx.receive_tree))
47
- annotation = annotation.padding.with_arguments(ctx.receive_node(annotation.padding.arguments, JavaReceiver.receive_container))
48
- return annotation
49
-
50
- def visit_array_access(self, array_access: ArrayAccess, ctx: ReceiverContext) -> J:
51
- array_access = array_access.with_id(ctx.receive_value(array_access.id, UUID))
52
- array_access = array_access.with_prefix(ctx.receive_node(array_access.prefix, JavaReceiver.receive_space))
53
- array_access = array_access.with_markers(ctx.receive_node(array_access.markers, ctx.receive_markers))
54
- array_access = array_access.with_indexed(ctx.receive_node(array_access.indexed, ctx.receive_tree))
55
- array_access = array_access.with_dimension(ctx.receive_node(array_access.dimension, ctx.receive_tree))
56
- array_access = array_access.with_type(ctx.receive_value(array_access.type, JavaType))
57
- return array_access
58
-
59
- def visit_array_type(self, array_type: ArrayType, ctx: ReceiverContext) -> J:
60
- array_type = array_type.with_id(ctx.receive_value(array_type.id, UUID))
61
- array_type = array_type.with_prefix(ctx.receive_node(array_type.prefix, JavaReceiver.receive_space))
62
- array_type = array_type.with_markers(ctx.receive_node(array_type.markers, ctx.receive_markers))
63
- array_type = array_type.with_element_type(ctx.receive_node(array_type.element_type, ctx.receive_tree))
64
- array_type = array_type.with_annotations(ctx.receive_nodes(array_type.annotations, ctx.receive_tree))
65
- array_type = array_type.with_dimension(ctx.receive_node(array_type.dimension, JavaReceiver.left_padded_node_receiver(Space)))
66
- array_type = array_type.with_type(ctx.receive_value(array_type.type, JavaType))
67
- return array_type
68
-
69
- def visit_assert(self, assert_: Assert, ctx: ReceiverContext) -> J:
70
- assert_ = assert_.with_id(ctx.receive_value(assert_.id, UUID))
71
- assert_ = assert_.with_prefix(ctx.receive_node(assert_.prefix, JavaReceiver.receive_space))
72
- assert_ = assert_.with_markers(ctx.receive_node(assert_.markers, ctx.receive_markers))
73
- assert_ = assert_.with_condition(ctx.receive_node(assert_.condition, ctx.receive_tree))
74
- assert_ = assert_.with_detail(ctx.receive_node(assert_.detail, JavaReceiver.receive_left_padded_tree))
75
- return assert_
76
-
77
- def visit_assignment(self, assignment: Assignment, ctx: ReceiverContext) -> J:
78
- assignment = assignment.with_id(ctx.receive_value(assignment.id, UUID))
79
- assignment = assignment.with_prefix(ctx.receive_node(assignment.prefix, JavaReceiver.receive_space))
80
- assignment = assignment.with_markers(ctx.receive_node(assignment.markers, ctx.receive_markers))
81
- assignment = assignment.with_variable(ctx.receive_node(assignment.variable, ctx.receive_tree))
82
- assignment = assignment.padding.with_assignment(ctx.receive_node(assignment.padding.assignment, JavaReceiver.receive_left_padded_tree))
83
- assignment = assignment.with_type(ctx.receive_value(assignment.type, JavaType))
84
- return assignment
85
-
86
- def visit_assignment_operation(self, assignment_operation: AssignmentOperation, ctx: ReceiverContext) -> J:
87
- assignment_operation = assignment_operation.with_id(ctx.receive_value(assignment_operation.id, UUID))
88
- assignment_operation = assignment_operation.with_prefix(ctx.receive_node(assignment_operation.prefix, JavaReceiver.receive_space))
89
- assignment_operation = assignment_operation.with_markers(ctx.receive_node(assignment_operation.markers, ctx.receive_markers))
90
- assignment_operation = assignment_operation.with_variable(ctx.receive_node(assignment_operation.variable, ctx.receive_tree))
91
- assignment_operation = assignment_operation.padding.with_operator(ctx.receive_node(assignment_operation.padding.operator, JavaReceiver.left_padded_value_receiver(AssignmentOperation.Type)))
92
- assignment_operation = assignment_operation.with_assignment(ctx.receive_node(assignment_operation.assignment, ctx.receive_tree))
93
- assignment_operation = assignment_operation.with_type(ctx.receive_value(assignment_operation.type, JavaType))
94
- return assignment_operation
95
-
96
- def visit_binary(self, binary: Binary, ctx: ReceiverContext) -> J:
97
- binary = binary.with_id(ctx.receive_value(binary.id, UUID))
98
- binary = binary.with_prefix(ctx.receive_node(binary.prefix, JavaReceiver.receive_space))
99
- binary = binary.with_markers(ctx.receive_node(binary.markers, ctx.receive_markers))
100
- binary = binary.with_left(ctx.receive_node(binary.left, ctx.receive_tree))
101
- binary = binary.padding.with_operator(ctx.receive_node(binary.padding.operator, JavaReceiver.left_padded_value_receiver(Binary.Type)))
102
- binary = binary.with_right(ctx.receive_node(binary.right, ctx.receive_tree))
103
- binary = binary.with_type(ctx.receive_value(binary.type, JavaType))
104
- return binary
105
-
106
- def visit_block(self, block: Block, ctx: ReceiverContext) -> J:
107
- block = block.with_id(ctx.receive_value(block.id, UUID))
108
- block = block.with_prefix(ctx.receive_node(block.prefix, JavaReceiver.receive_space))
109
- block = block.with_markers(ctx.receive_node(block.markers, ctx.receive_markers))
110
- block = block.padding.with_static(ctx.receive_node(block.padding.static, JavaReceiver.right_padded_value_receiver(bool)))
111
- block = block.padding.with_statements(ctx.receive_nodes(block.padding.statements, JavaReceiver.receive_right_padded_tree))
112
- block = block.with_end(ctx.receive_node(block.end, JavaReceiver.receive_space))
113
- return block
114
-
115
- def visit_break(self, break_: Break, ctx: ReceiverContext) -> J:
116
- break_ = break_.with_id(ctx.receive_value(break_.id, UUID))
117
- break_ = break_.with_prefix(ctx.receive_node(break_.prefix, JavaReceiver.receive_space))
118
- break_ = break_.with_markers(ctx.receive_node(break_.markers, ctx.receive_markers))
119
- break_ = break_.with_label(ctx.receive_node(break_.label, ctx.receive_tree))
120
- return break_
121
-
122
- def visit_case(self, case: Case, ctx: ReceiverContext) -> J:
123
- case = case.with_id(ctx.receive_value(case.id, UUID))
124
- case = case.with_prefix(ctx.receive_node(case.prefix, JavaReceiver.receive_space))
125
- case = case.with_markers(ctx.receive_node(case.markers, ctx.receive_markers))
126
- case = case.with_type(ctx.receive_value(case.type, Case.Type))
127
- case = case.padding.with_expressions(ctx.receive_node(case.padding.expressions, JavaReceiver.receive_container))
128
- case = case.padding.with_statements(ctx.receive_node(case.padding.statements, JavaReceiver.receive_container))
129
- case = case.padding.with_body(ctx.receive_node(case.padding.body, JavaReceiver.receive_right_padded_tree))
130
- return case
131
-
132
- def visit_class_declaration(self, class_declaration: ClassDeclaration, ctx: ReceiverContext) -> J:
133
- class_declaration = class_declaration.with_id(ctx.receive_value(class_declaration.id, UUID))
134
- class_declaration = class_declaration.with_prefix(ctx.receive_node(class_declaration.prefix, JavaReceiver.receive_space))
135
- class_declaration = class_declaration.with_markers(ctx.receive_node(class_declaration.markers, ctx.receive_markers))
136
- class_declaration = class_declaration.with_leading_annotations(ctx.receive_nodes(class_declaration.leading_annotations, ctx.receive_tree))
137
- class_declaration = class_declaration.with_modifiers(ctx.receive_nodes(class_declaration.modifiers, ctx.receive_tree))
138
- class_declaration = class_declaration.padding.with_kind(ctx.receive_node(class_declaration.padding.kind, ctx.receive_tree))
139
- class_declaration = class_declaration.with_name(ctx.receive_node(class_declaration.name, ctx.receive_tree))
140
- class_declaration = class_declaration.padding.with_type_parameters(ctx.receive_node(class_declaration.padding.type_parameters, JavaReceiver.receive_container))
141
- class_declaration = class_declaration.padding.with_primary_constructor(ctx.receive_node(class_declaration.padding.primary_constructor, JavaReceiver.receive_container))
142
- class_declaration = class_declaration.padding.with_extends(ctx.receive_node(class_declaration.padding.extends, JavaReceiver.receive_left_padded_tree))
143
- class_declaration = class_declaration.padding.with_implements(ctx.receive_node(class_declaration.padding.implements, JavaReceiver.receive_container))
144
- class_declaration = class_declaration.padding.with_permits(ctx.receive_node(class_declaration.padding.permits, JavaReceiver.receive_container))
145
- class_declaration = class_declaration.with_body(ctx.receive_node(class_declaration.body, ctx.receive_tree))
146
- class_declaration = class_declaration.with_type(ctx.receive_value(class_declaration.type, JavaType.FullyQualified))
147
- return class_declaration
148
-
149
- def visit_class_declaration_kind(self, kind: ClassDeclaration.Kind, ctx: ReceiverContext) -> J:
150
- kind = kind.with_id(ctx.receive_value(kind.id, UUID))
151
- kind = kind.with_prefix(ctx.receive_node(kind.prefix, JavaReceiver.receive_space))
152
- kind = kind.with_markers(ctx.receive_node(kind.markers, ctx.receive_markers))
153
- kind = kind.with_annotations(ctx.receive_nodes(kind.annotations, ctx.receive_tree))
154
- kind = kind.with_type(ctx.receive_value(kind.type, ClassDeclaration.Kind.Type))
155
- return kind
156
-
157
- def visit_compilation_unit(self, compilation_unit: CompilationUnit, ctx: ReceiverContext) -> J:
158
- compilation_unit = compilation_unit.with_id(ctx.receive_value(compilation_unit.id, UUID))
159
- compilation_unit = compilation_unit.with_prefix(ctx.receive_node(compilation_unit.prefix, JavaReceiver.receive_space))
160
- compilation_unit = compilation_unit.with_markers(ctx.receive_node(compilation_unit.markers, ctx.receive_markers))
161
- compilation_unit = compilation_unit.with_source_path(ctx.receive_value(compilation_unit.source_path, Path))
162
- compilation_unit = compilation_unit.with_file_attributes(ctx.receive_value(compilation_unit.file_attributes, FileAttributes))
163
- compilation_unit = compilation_unit.with_charset_name(ctx.receive_value(compilation_unit.charset_name, str))
164
- compilation_unit = compilation_unit.with_charset_bom_marked(ctx.receive_value(compilation_unit.charset_bom_marked, bool))
165
- compilation_unit = compilation_unit.with_checksum(ctx.receive_value(compilation_unit.checksum, Checksum))
166
- compilation_unit = compilation_unit.padding.with_package_declaration(ctx.receive_node(compilation_unit.padding.package_declaration, JavaReceiver.receive_right_padded_tree))
167
- compilation_unit = compilation_unit.padding.with_imports(ctx.receive_nodes(compilation_unit.padding.imports, JavaReceiver.receive_right_padded_tree))
168
- compilation_unit = compilation_unit.with_classes(ctx.receive_nodes(compilation_unit.classes, ctx.receive_tree))
169
- compilation_unit = compilation_unit.with_eof(ctx.receive_node(compilation_unit.eof, JavaReceiver.receive_space))
170
- return compilation_unit
171
-
172
- def visit_continue(self, continue_: Continue, ctx: ReceiverContext) -> J:
173
- continue_ = continue_.with_id(ctx.receive_value(continue_.id, UUID))
174
- continue_ = continue_.with_prefix(ctx.receive_node(continue_.prefix, JavaReceiver.receive_space))
175
- continue_ = continue_.with_markers(ctx.receive_node(continue_.markers, ctx.receive_markers))
176
- continue_ = continue_.with_label(ctx.receive_node(continue_.label, ctx.receive_tree))
177
- return continue_
178
-
179
- def visit_do_while_loop(self, do_while_loop: DoWhileLoop, ctx: ReceiverContext) -> J:
180
- do_while_loop = do_while_loop.with_id(ctx.receive_value(do_while_loop.id, UUID))
181
- do_while_loop = do_while_loop.with_prefix(ctx.receive_node(do_while_loop.prefix, JavaReceiver.receive_space))
182
- do_while_loop = do_while_loop.with_markers(ctx.receive_node(do_while_loop.markers, ctx.receive_markers))
183
- do_while_loop = do_while_loop.padding.with_body(ctx.receive_node(do_while_loop.padding.body, JavaReceiver.receive_right_padded_tree))
184
- do_while_loop = do_while_loop.padding.with_while_condition(ctx.receive_node(do_while_loop.padding.while_condition, JavaReceiver.receive_left_padded_tree))
185
- return do_while_loop
186
-
187
- def visit_empty(self, empty: Empty, ctx: ReceiverContext) -> J:
188
- empty = empty.with_id(ctx.receive_value(empty.id, UUID))
189
- empty = empty.with_prefix(ctx.receive_node(empty.prefix, JavaReceiver.receive_space))
190
- empty = empty.with_markers(ctx.receive_node(empty.markers, ctx.receive_markers))
191
- return empty
192
-
193
- def visit_enum_value(self, enum_value: EnumValue, ctx: ReceiverContext) -> J:
194
- enum_value = enum_value.with_id(ctx.receive_value(enum_value.id, UUID))
195
- enum_value = enum_value.with_prefix(ctx.receive_node(enum_value.prefix, JavaReceiver.receive_space))
196
- enum_value = enum_value.with_markers(ctx.receive_node(enum_value.markers, ctx.receive_markers))
197
- enum_value = enum_value.with_annotations(ctx.receive_nodes(enum_value.annotations, ctx.receive_tree))
198
- enum_value = enum_value.with_name(ctx.receive_node(enum_value.name, ctx.receive_tree))
199
- enum_value = enum_value.with_initializer(ctx.receive_node(enum_value.initializer, ctx.receive_tree))
200
- return enum_value
201
-
202
- def visit_enum_value_set(self, enum_value_set: EnumValueSet, ctx: ReceiverContext) -> J:
203
- enum_value_set = enum_value_set.with_id(ctx.receive_value(enum_value_set.id, UUID))
204
- enum_value_set = enum_value_set.with_prefix(ctx.receive_node(enum_value_set.prefix, JavaReceiver.receive_space))
205
- enum_value_set = enum_value_set.with_markers(ctx.receive_node(enum_value_set.markers, ctx.receive_markers))
206
- enum_value_set = enum_value_set.padding.with_enums(ctx.receive_nodes(enum_value_set.padding.enums, JavaReceiver.receive_right_padded_tree))
207
- enum_value_set = enum_value_set.with_terminated_with_semicolon(ctx.receive_value(enum_value_set.terminated_with_semicolon, bool))
208
- return enum_value_set
209
-
210
- def visit_field_access(self, field_access: FieldAccess, ctx: ReceiverContext) -> J:
211
- field_access = field_access.with_id(ctx.receive_value(field_access.id, UUID))
212
- field_access = field_access.with_prefix(ctx.receive_node(field_access.prefix, JavaReceiver.receive_space))
213
- field_access = field_access.with_markers(ctx.receive_node(field_access.markers, ctx.receive_markers))
214
- field_access = field_access.with_target(ctx.receive_node(field_access.target, ctx.receive_tree))
215
- field_access = field_access.padding.with_name(ctx.receive_node(field_access.padding.name, JavaReceiver.receive_left_padded_tree))
216
- field_access = field_access.with_type(ctx.receive_value(field_access.type, JavaType))
217
- return field_access
218
-
219
- def visit_for_each_loop(self, for_each_loop: ForEachLoop, ctx: ReceiverContext) -> J:
220
- for_each_loop = for_each_loop.with_id(ctx.receive_value(for_each_loop.id, UUID))
221
- for_each_loop = for_each_loop.with_prefix(ctx.receive_node(for_each_loop.prefix, JavaReceiver.receive_space))
222
- for_each_loop = for_each_loop.with_markers(ctx.receive_node(for_each_loop.markers, ctx.receive_markers))
223
- for_each_loop = for_each_loop.with_control(ctx.receive_node(for_each_loop.control, ctx.receive_tree))
224
- for_each_loop = for_each_loop.padding.with_body(ctx.receive_node(for_each_loop.padding.body, JavaReceiver.receive_right_padded_tree))
225
- return for_each_loop
226
-
227
- def visit_for_each_control(self, control: ForEachLoop.Control, ctx: ReceiverContext) -> J:
228
- control = control.with_id(ctx.receive_value(control.id, UUID))
229
- control = control.with_prefix(ctx.receive_node(control.prefix, JavaReceiver.receive_space))
230
- control = control.with_markers(ctx.receive_node(control.markers, ctx.receive_markers))
231
- control = control.padding.with_variable(ctx.receive_node(control.padding.variable, JavaReceiver.receive_right_padded_tree))
232
- control = control.padding.with_iterable(ctx.receive_node(control.padding.iterable, JavaReceiver.receive_right_padded_tree))
233
- return control
234
-
235
- def visit_for_loop(self, for_loop: ForLoop, ctx: ReceiverContext) -> J:
236
- for_loop = for_loop.with_id(ctx.receive_value(for_loop.id, UUID))
237
- for_loop = for_loop.with_prefix(ctx.receive_node(for_loop.prefix, JavaReceiver.receive_space))
238
- for_loop = for_loop.with_markers(ctx.receive_node(for_loop.markers, ctx.receive_markers))
239
- for_loop = for_loop.with_control(ctx.receive_node(for_loop.control, ctx.receive_tree))
240
- for_loop = for_loop.padding.with_body(ctx.receive_node(for_loop.padding.body, JavaReceiver.receive_right_padded_tree))
241
- return for_loop
242
-
243
- def visit_for_control(self, control: ForLoop.Control, ctx: ReceiverContext) -> J:
244
- control = control.with_id(ctx.receive_value(control.id, UUID))
245
- control = control.with_prefix(ctx.receive_node(control.prefix, JavaReceiver.receive_space))
246
- control = control.with_markers(ctx.receive_node(control.markers, ctx.receive_markers))
247
- control = control.padding.with_init(ctx.receive_nodes(control.padding.init, JavaReceiver.receive_right_padded_tree))
248
- control = control.padding.with_condition(ctx.receive_node(control.padding.condition, JavaReceiver.receive_right_padded_tree))
249
- control = control.padding.with_update(ctx.receive_nodes(control.padding.update, JavaReceiver.receive_right_padded_tree))
250
- return control
251
-
252
- def visit_parenthesized_type_tree(self, parenthesized_type_tree: ParenthesizedTypeTree, ctx: ReceiverContext) -> J:
253
- parenthesized_type_tree = parenthesized_type_tree.with_id(ctx.receive_value(parenthesized_type_tree.id, UUID))
254
- parenthesized_type_tree = parenthesized_type_tree.with_prefix(ctx.receive_node(parenthesized_type_tree.prefix, JavaReceiver.receive_space))
255
- parenthesized_type_tree = parenthesized_type_tree.with_markers(ctx.receive_node(parenthesized_type_tree.markers, ctx.receive_markers))
256
- parenthesized_type_tree = parenthesized_type_tree.with_annotations(ctx.receive_nodes(parenthesized_type_tree.annotations, ctx.receive_tree))
257
- parenthesized_type_tree = parenthesized_type_tree.with_parenthesized_type(ctx.receive_node(parenthesized_type_tree.parenthesized_type, ctx.receive_tree))
258
- return parenthesized_type_tree
259
-
260
- def visit_identifier(self, identifier: Identifier, ctx: ReceiverContext) -> J:
261
- identifier = identifier.with_id(ctx.receive_value(identifier.id, UUID))
262
- identifier = identifier.with_prefix(ctx.receive_node(identifier.prefix, JavaReceiver.receive_space))
263
- identifier = identifier.with_markers(ctx.receive_node(identifier.markers, ctx.receive_markers))
264
- identifier = identifier.with_annotations(ctx.receive_nodes(identifier.annotations, ctx.receive_tree))
265
- identifier = identifier.with_simple_name(ctx.receive_value(identifier.simple_name, str))
266
- identifier = identifier.with_type(ctx.receive_value(identifier.type, JavaType))
267
- identifier = identifier.with_field_type(ctx.receive_value(identifier.field_type, JavaType.Variable))
268
- return identifier
269
-
270
- def visit_if(self, if_: If, ctx: ReceiverContext) -> J:
271
- if_ = if_.with_id(ctx.receive_value(if_.id, UUID))
272
- if_ = if_.with_prefix(ctx.receive_node(if_.prefix, JavaReceiver.receive_space))
273
- if_ = if_.with_markers(ctx.receive_node(if_.markers, ctx.receive_markers))
274
- if_ = if_.with_if_condition(ctx.receive_node(if_.if_condition, ctx.receive_tree))
275
- if_ = if_.padding.with_then_part(ctx.receive_node(if_.padding.then_part, JavaReceiver.receive_right_padded_tree))
276
- if_ = if_.with_else_part(ctx.receive_node(if_.else_part, ctx.receive_tree))
277
- return if_
278
-
279
- def visit_else(self, else_: If.Else, ctx: ReceiverContext) -> J:
280
- else_ = else_.with_id(ctx.receive_value(else_.id, UUID))
281
- else_ = else_.with_prefix(ctx.receive_node(else_.prefix, JavaReceiver.receive_space))
282
- else_ = else_.with_markers(ctx.receive_node(else_.markers, ctx.receive_markers))
283
- else_ = else_.padding.with_body(ctx.receive_node(else_.padding.body, JavaReceiver.receive_right_padded_tree))
284
- return else_
285
-
286
- def visit_import(self, import_: Import, ctx: ReceiverContext) -> J:
287
- import_ = import_.with_id(ctx.receive_value(import_.id, UUID))
288
- import_ = import_.with_prefix(ctx.receive_node(import_.prefix, JavaReceiver.receive_space))
289
- import_ = import_.with_markers(ctx.receive_node(import_.markers, ctx.receive_markers))
290
- import_ = import_.padding.with_static(ctx.receive_node(import_.padding.static, JavaReceiver.left_padded_value_receiver(bool)))
291
- import_ = import_.with_qualid(ctx.receive_node(import_.qualid, ctx.receive_tree))
292
- import_ = import_.padding.with_alias(ctx.receive_node(import_.padding.alias, JavaReceiver.receive_left_padded_tree))
293
- return import_
294
-
295
- def visit_instance_of(self, instance_of: InstanceOf, ctx: ReceiverContext) -> J:
296
- instance_of = instance_of.with_id(ctx.receive_value(instance_of.id, UUID))
297
- instance_of = instance_of.with_prefix(ctx.receive_node(instance_of.prefix, JavaReceiver.receive_space))
298
- instance_of = instance_of.with_markers(ctx.receive_node(instance_of.markers, ctx.receive_markers))
299
- instance_of = instance_of.padding.with_expression(ctx.receive_node(instance_of.padding.expression, JavaReceiver.receive_right_padded_tree))
300
- instance_of = instance_of.with_clazz(ctx.receive_node(instance_of.clazz, ctx.receive_tree))
301
- instance_of = instance_of.with_pattern(ctx.receive_node(instance_of.pattern, ctx.receive_tree))
302
- instance_of = instance_of.with_type(ctx.receive_value(instance_of.type, JavaType))
303
- return instance_of
304
-
305
- def visit_intersection_type(self, intersection_type: IntersectionType, ctx: ReceiverContext) -> J:
306
- intersection_type = intersection_type.with_id(ctx.receive_value(intersection_type.id, UUID))
307
- intersection_type = intersection_type.with_prefix(ctx.receive_node(intersection_type.prefix, JavaReceiver.receive_space))
308
- intersection_type = intersection_type.with_markers(ctx.receive_node(intersection_type.markers, ctx.receive_markers))
309
- intersection_type = intersection_type.padding.with_bounds(ctx.receive_node(intersection_type.padding.bounds, JavaReceiver.receive_container))
310
- return intersection_type
311
-
312
- def visit_label(self, label: Label, ctx: ReceiverContext) -> J:
313
- label = label.with_id(ctx.receive_value(label.id, UUID))
314
- label = label.with_prefix(ctx.receive_node(label.prefix, JavaReceiver.receive_space))
315
- label = label.with_markers(ctx.receive_node(label.markers, ctx.receive_markers))
316
- label = label.padding.with_label(ctx.receive_node(label.padding.label, JavaReceiver.receive_right_padded_tree))
317
- label = label.with_statement(ctx.receive_node(label.statement, ctx.receive_tree))
318
- return label
319
-
320
- def visit_lambda(self, lambda_: Lambda, ctx: ReceiverContext) -> J:
321
- lambda_ = lambda_.with_id(ctx.receive_value(lambda_.id, UUID))
322
- lambda_ = lambda_.with_prefix(ctx.receive_node(lambda_.prefix, JavaReceiver.receive_space))
323
- lambda_ = lambda_.with_markers(ctx.receive_node(lambda_.markers, ctx.receive_markers))
324
- lambda_ = lambda_.with_parameters(ctx.receive_node(lambda_.parameters, ctx.receive_tree))
325
- lambda_ = lambda_.with_arrow(ctx.receive_node(lambda_.arrow, JavaReceiver.receive_space))
326
- lambda_ = lambda_.with_body(ctx.receive_node(lambda_.body, ctx.receive_tree))
327
- lambda_ = lambda_.with_type(ctx.receive_value(lambda_.type, JavaType))
328
- return lambda_
329
-
330
- def visit_lambda_parameters(self, parameters: Lambda.Parameters, ctx: ReceiverContext) -> J:
331
- parameters = parameters.with_id(ctx.receive_value(parameters.id, UUID))
332
- parameters = parameters.with_prefix(ctx.receive_node(parameters.prefix, JavaReceiver.receive_space))
333
- parameters = parameters.with_markers(ctx.receive_node(parameters.markers, ctx.receive_markers))
334
- parameters = parameters.with_parenthesized(ctx.receive_value(parameters.parenthesized, bool))
335
- parameters = parameters.padding.with_parameters(ctx.receive_nodes(parameters.padding.parameters, JavaReceiver.receive_right_padded_tree))
336
- return parameters
337
-
338
- def visit_literal(self, literal: Literal, ctx: ReceiverContext) -> J:
339
- literal = literal.with_id(ctx.receive_value(literal.id, UUID))
340
- literal = literal.with_prefix(ctx.receive_node(literal.prefix, JavaReceiver.receive_space))
341
- literal = literal.with_markers(ctx.receive_node(literal.markers, ctx.receive_markers))
342
- literal = literal.with_value(ctx.receive_value(literal.value, object))
343
- literal = literal.with_value_source(ctx.receive_value(literal.value_source, str))
344
- literal = literal.with_unicode_escapes(ctx.receive_values(literal.unicode_escapes, Literal.UnicodeEscape))
345
- literal = literal.with_type(ctx.receive_value(literal.type, JavaType.Primitive))
346
- return literal
347
-
348
- def visit_member_reference(self, member_reference: MemberReference, ctx: ReceiverContext) -> J:
349
- member_reference = member_reference.with_id(ctx.receive_value(member_reference.id, UUID))
350
- member_reference = member_reference.with_prefix(ctx.receive_node(member_reference.prefix, JavaReceiver.receive_space))
351
- member_reference = member_reference.with_markers(ctx.receive_node(member_reference.markers, ctx.receive_markers))
352
- member_reference = member_reference.padding.with_containing(ctx.receive_node(member_reference.padding.containing, JavaReceiver.receive_right_padded_tree))
353
- member_reference = member_reference.padding.with_type_parameters(ctx.receive_node(member_reference.padding.type_parameters, JavaReceiver.receive_container))
354
- member_reference = member_reference.padding.with_reference(ctx.receive_node(member_reference.padding.reference, JavaReceiver.receive_left_padded_tree))
355
- member_reference = member_reference.with_type(ctx.receive_value(member_reference.type, JavaType))
356
- member_reference = member_reference.with_method_type(ctx.receive_value(member_reference.method_type, JavaType.Method))
357
- member_reference = member_reference.with_variable_type(ctx.receive_value(member_reference.variable_type, JavaType.Variable))
358
- return member_reference
359
-
360
- def visit_method_declaration(self, method_declaration: MethodDeclaration, ctx: ReceiverContext) -> J:
361
- method_declaration = method_declaration.with_id(ctx.receive_value(method_declaration.id, UUID))
362
- method_declaration = method_declaration.with_prefix(ctx.receive_node(method_declaration.prefix, JavaReceiver.receive_space))
363
- method_declaration = method_declaration.with_markers(ctx.receive_node(method_declaration.markers, ctx.receive_markers))
364
- method_declaration = method_declaration.with_leading_annotations(ctx.receive_nodes(method_declaration.leading_annotations, ctx.receive_tree))
365
- method_declaration = method_declaration.with_modifiers(ctx.receive_nodes(method_declaration.modifiers, ctx.receive_tree))
366
- method_declaration = method_declaration.annotations.with_type_parameters(ctx.receive_node(method_declaration.annotations.type_parameters, ctx.receive_tree))
367
- method_declaration = method_declaration.with_return_type_expression(ctx.receive_node(method_declaration.return_type_expression, ctx.receive_tree))
368
- method_declaration = method_declaration.annotations.with_name(ctx.receive_node(method_declaration.annotations.name, JavaReceiver.receive_method_identifier_with_annotations))
369
- method_declaration = method_declaration.padding.with_parameters(ctx.receive_node(method_declaration.padding.parameters, JavaReceiver.receive_container))
370
- method_declaration = method_declaration.padding.with_throws(ctx.receive_node(method_declaration.padding.throws, JavaReceiver.receive_container))
371
- method_declaration = method_declaration.with_body(ctx.receive_node(method_declaration.body, ctx.receive_tree))
372
- method_declaration = method_declaration.padding.with_default_value(ctx.receive_node(method_declaration.padding.default_value, JavaReceiver.receive_left_padded_tree))
373
- method_declaration = method_declaration.with_method_type(ctx.receive_value(method_declaration.method_type, JavaType.Method))
374
- return method_declaration
375
-
376
- def visit_method_invocation(self, method_invocation: MethodInvocation, ctx: ReceiverContext) -> J:
377
- method_invocation = method_invocation.with_id(ctx.receive_value(method_invocation.id, UUID))
378
- method_invocation = method_invocation.with_prefix(ctx.receive_node(method_invocation.prefix, JavaReceiver.receive_space))
379
- method_invocation = method_invocation.with_markers(ctx.receive_node(method_invocation.markers, ctx.receive_markers))
380
- method_invocation = method_invocation.padding.with_select(ctx.receive_node(method_invocation.padding.select, JavaReceiver.receive_right_padded_tree))
381
- method_invocation = method_invocation.padding.with_type_parameters(ctx.receive_node(method_invocation.padding.type_parameters, JavaReceiver.receive_container))
382
- method_invocation = method_invocation.with_name(ctx.receive_node(method_invocation.name, ctx.receive_tree))
383
- method_invocation = method_invocation.padding.with_arguments(ctx.receive_node(method_invocation.padding.arguments, JavaReceiver.receive_container))
384
- method_invocation = method_invocation.with_method_type(ctx.receive_value(method_invocation.method_type, JavaType.Method))
385
- return method_invocation
386
-
387
- def visit_modifier(self, modifier: Modifier, ctx: ReceiverContext) -> J:
388
- modifier = modifier.with_id(ctx.receive_value(modifier.id, UUID))
389
- modifier = modifier.with_prefix(ctx.receive_node(modifier.prefix, JavaReceiver.receive_space))
390
- modifier = modifier.with_markers(ctx.receive_node(modifier.markers, ctx.receive_markers))
391
- modifier = modifier.with_keyword(ctx.receive_value(modifier.keyword, str))
392
- modifier = modifier.with_type(ctx.receive_value(modifier.type, Modifier.Type))
393
- modifier = modifier.with_annotations(ctx.receive_nodes(modifier.annotations, ctx.receive_tree))
394
- return modifier
395
-
396
- def visit_multi_catch(self, multi_catch: MultiCatch, ctx: ReceiverContext) -> J:
397
- multi_catch = multi_catch.with_id(ctx.receive_value(multi_catch.id, UUID))
398
- multi_catch = multi_catch.with_prefix(ctx.receive_node(multi_catch.prefix, JavaReceiver.receive_space))
399
- multi_catch = multi_catch.with_markers(ctx.receive_node(multi_catch.markers, ctx.receive_markers))
400
- multi_catch = multi_catch.padding.with_alternatives(ctx.receive_nodes(multi_catch.padding.alternatives, JavaReceiver.receive_right_padded_tree))
401
- return multi_catch
402
-
403
- def visit_new_array(self, new_array: NewArray, ctx: ReceiverContext) -> J:
404
- new_array = new_array.with_id(ctx.receive_value(new_array.id, UUID))
405
- new_array = new_array.with_prefix(ctx.receive_node(new_array.prefix, JavaReceiver.receive_space))
406
- new_array = new_array.with_markers(ctx.receive_node(new_array.markers, ctx.receive_markers))
407
- new_array = new_array.with_type_expression(ctx.receive_node(new_array.type_expression, ctx.receive_tree))
408
- new_array = new_array.with_dimensions(ctx.receive_nodes(new_array.dimensions, ctx.receive_tree))
409
- new_array = new_array.padding.with_initializer(ctx.receive_node(new_array.padding.initializer, JavaReceiver.receive_container))
410
- new_array = new_array.with_type(ctx.receive_value(new_array.type, JavaType))
411
- return new_array
412
-
413
- def visit_array_dimension(self, array_dimension: ArrayDimension, ctx: ReceiverContext) -> J:
414
- array_dimension = array_dimension.with_id(ctx.receive_value(array_dimension.id, UUID))
415
- array_dimension = array_dimension.with_prefix(ctx.receive_node(array_dimension.prefix, JavaReceiver.receive_space))
416
- array_dimension = array_dimension.with_markers(ctx.receive_node(array_dimension.markers, ctx.receive_markers))
417
- array_dimension = array_dimension.padding.with_index(ctx.receive_node(array_dimension.padding.index, JavaReceiver.receive_right_padded_tree))
418
- return array_dimension
419
-
420
- def visit_new_class(self, new_class: NewClass, ctx: ReceiverContext) -> J:
421
- new_class = new_class.with_id(ctx.receive_value(new_class.id, UUID))
422
- new_class = new_class.with_prefix(ctx.receive_node(new_class.prefix, JavaReceiver.receive_space))
423
- new_class = new_class.with_markers(ctx.receive_node(new_class.markers, ctx.receive_markers))
424
- new_class = new_class.padding.with_enclosing(ctx.receive_node(new_class.padding.enclosing, JavaReceiver.receive_right_padded_tree))
425
- new_class = new_class.with_new(ctx.receive_node(new_class.new, JavaReceiver.receive_space))
426
- new_class = new_class.with_clazz(ctx.receive_node(new_class.clazz, ctx.receive_tree))
427
- new_class = new_class.padding.with_arguments(ctx.receive_node(new_class.padding.arguments, JavaReceiver.receive_container))
428
- new_class = new_class.with_body(ctx.receive_node(new_class.body, ctx.receive_tree))
429
- new_class = new_class.with_constructor_type(ctx.receive_value(new_class.constructor_type, JavaType.Method))
430
- return new_class
431
-
432
- def visit_nullable_type(self, nullable_type: NullableType, ctx: ReceiverContext) -> J:
433
- nullable_type = nullable_type.with_id(ctx.receive_value(nullable_type.id, UUID))
434
- nullable_type = nullable_type.with_prefix(ctx.receive_node(nullable_type.prefix, JavaReceiver.receive_space))
435
- nullable_type = nullable_type.with_markers(ctx.receive_node(nullable_type.markers, ctx.receive_markers))
436
- nullable_type = nullable_type.with_annotations(ctx.receive_nodes(nullable_type.annotations, ctx.receive_tree))
437
- nullable_type = nullable_type.padding.with_type_tree(ctx.receive_node(nullable_type.padding.type_tree, JavaReceiver.receive_right_padded_tree))
438
- return nullable_type
439
-
440
- def visit_package(self, package: Package, ctx: ReceiverContext) -> J:
441
- package = package.with_id(ctx.receive_value(package.id, UUID))
442
- package = package.with_prefix(ctx.receive_node(package.prefix, JavaReceiver.receive_space))
443
- package = package.with_markers(ctx.receive_node(package.markers, ctx.receive_markers))
444
- package = package.with_expression(ctx.receive_node(package.expression, ctx.receive_tree))
445
- package = package.with_annotations(ctx.receive_nodes(package.annotations, ctx.receive_tree))
446
- return package
447
-
448
- def visit_parameterized_type(self, parameterized_type: ParameterizedType, ctx: ReceiverContext) -> J:
449
- parameterized_type = parameterized_type.with_id(ctx.receive_value(parameterized_type.id, UUID))
450
- parameterized_type = parameterized_type.with_prefix(ctx.receive_node(parameterized_type.prefix, JavaReceiver.receive_space))
451
- parameterized_type = parameterized_type.with_markers(ctx.receive_node(parameterized_type.markers, ctx.receive_markers))
452
- parameterized_type = parameterized_type.with_clazz(ctx.receive_node(parameterized_type.clazz, ctx.receive_tree))
453
- parameterized_type = parameterized_type.padding.with_type_parameters(ctx.receive_node(parameterized_type.padding.type_parameters, JavaReceiver.receive_container))
454
- parameterized_type = parameterized_type.with_type(ctx.receive_value(parameterized_type.type, JavaType))
455
- return parameterized_type
456
-
457
- def visit_parentheses(self, parentheses: Parentheses[J2], ctx: ReceiverContext) -> J:
458
- parentheses = parentheses.with_id(ctx.receive_value(parentheses.id, UUID))
459
- parentheses = parentheses.with_prefix(ctx.receive_node(parentheses.prefix, JavaReceiver.receive_space))
460
- parentheses = parentheses.with_markers(ctx.receive_node(parentheses.markers, ctx.receive_markers))
461
- parentheses = parentheses.padding.with_tree(ctx.receive_node(parentheses.padding.tree, JavaReceiver.receive_right_padded_tree))
462
- return parentheses
463
-
464
- def visit_control_parentheses(self, control_parentheses: ControlParentheses[J2], ctx: ReceiverContext) -> J:
465
- control_parentheses = control_parentheses.with_id(ctx.receive_value(control_parentheses.id, UUID))
466
- control_parentheses = control_parentheses.with_prefix(ctx.receive_node(control_parentheses.prefix, JavaReceiver.receive_space))
467
- control_parentheses = control_parentheses.with_markers(ctx.receive_node(control_parentheses.markers, ctx.receive_markers))
468
- control_parentheses = control_parentheses.padding.with_tree(ctx.receive_node(control_parentheses.padding.tree, JavaReceiver.receive_right_padded_tree))
469
- return control_parentheses
470
-
471
- def visit_primitive(self, primitive: Primitive, ctx: ReceiverContext) -> J:
472
- primitive = primitive.with_id(ctx.receive_value(primitive.id, UUID))
473
- primitive = primitive.with_prefix(ctx.receive_node(primitive.prefix, JavaReceiver.receive_space))
474
- primitive = primitive.with_markers(ctx.receive_node(primitive.markers, ctx.receive_markers))
475
- primitive = primitive.with_type(ctx.receive_value(primitive.type, JavaType.Primitive))
476
- return primitive
477
-
478
- def visit_return(self, return_: Return, ctx: ReceiverContext) -> J:
479
- return_ = return_.with_id(ctx.receive_value(return_.id, UUID))
480
- return_ = return_.with_prefix(ctx.receive_node(return_.prefix, JavaReceiver.receive_space))
481
- return_ = return_.with_markers(ctx.receive_node(return_.markers, ctx.receive_markers))
482
- return_ = return_.with_expression(ctx.receive_node(return_.expression, ctx.receive_tree))
483
- return return_
484
-
485
- def visit_switch(self, switch: Switch, ctx: ReceiverContext) -> J:
486
- switch = switch.with_id(ctx.receive_value(switch.id, UUID))
487
- switch = switch.with_prefix(ctx.receive_node(switch.prefix, JavaReceiver.receive_space))
488
- switch = switch.with_markers(ctx.receive_node(switch.markers, ctx.receive_markers))
489
- switch = switch.with_selector(ctx.receive_node(switch.selector, ctx.receive_tree))
490
- switch = switch.with_cases(ctx.receive_node(switch.cases, ctx.receive_tree))
491
- return switch
492
-
493
- def visit_switch_expression(self, switch_expression: SwitchExpression, ctx: ReceiverContext) -> J:
494
- switch_expression = switch_expression.with_id(ctx.receive_value(switch_expression.id, UUID))
495
- switch_expression = switch_expression.with_prefix(ctx.receive_node(switch_expression.prefix, JavaReceiver.receive_space))
496
- switch_expression = switch_expression.with_markers(ctx.receive_node(switch_expression.markers, ctx.receive_markers))
497
- switch_expression = switch_expression.with_selector(ctx.receive_node(switch_expression.selector, ctx.receive_tree))
498
- switch_expression = switch_expression.with_cases(ctx.receive_node(switch_expression.cases, ctx.receive_tree))
499
- return switch_expression
500
-
501
- def visit_synchronized(self, synchronized: Synchronized, ctx: ReceiverContext) -> J:
502
- synchronized = synchronized.with_id(ctx.receive_value(synchronized.id, UUID))
503
- synchronized = synchronized.with_prefix(ctx.receive_node(synchronized.prefix, JavaReceiver.receive_space))
504
- synchronized = synchronized.with_markers(ctx.receive_node(synchronized.markers, ctx.receive_markers))
505
- synchronized = synchronized.with_lock(ctx.receive_node(synchronized.lock, ctx.receive_tree))
506
- synchronized = synchronized.with_body(ctx.receive_node(synchronized.body, ctx.receive_tree))
507
- return synchronized
508
-
509
- def visit_ternary(self, ternary: Ternary, ctx: ReceiverContext) -> J:
510
- ternary = ternary.with_id(ctx.receive_value(ternary.id, UUID))
511
- ternary = ternary.with_prefix(ctx.receive_node(ternary.prefix, JavaReceiver.receive_space))
512
- ternary = ternary.with_markers(ctx.receive_node(ternary.markers, ctx.receive_markers))
513
- ternary = ternary.with_condition(ctx.receive_node(ternary.condition, ctx.receive_tree))
514
- ternary = ternary.padding.with_true_part(ctx.receive_node(ternary.padding.true_part, JavaReceiver.receive_left_padded_tree))
515
- ternary = ternary.padding.with_false_part(ctx.receive_node(ternary.padding.false_part, JavaReceiver.receive_left_padded_tree))
516
- ternary = ternary.with_type(ctx.receive_value(ternary.type, JavaType))
517
- return ternary
518
-
519
- def visit_throw(self, throw: Throw, ctx: ReceiverContext) -> J:
520
- throw = throw.with_id(ctx.receive_value(throw.id, UUID))
521
- throw = throw.with_prefix(ctx.receive_node(throw.prefix, JavaReceiver.receive_space))
522
- throw = throw.with_markers(ctx.receive_node(throw.markers, ctx.receive_markers))
523
- throw = throw.with_exception(ctx.receive_node(throw.exception, ctx.receive_tree))
524
- return throw
525
-
526
- def visit_try(self, try_: Try, ctx: ReceiverContext) -> J:
527
- try_ = try_.with_id(ctx.receive_value(try_.id, UUID))
528
- try_ = try_.with_prefix(ctx.receive_node(try_.prefix, JavaReceiver.receive_space))
529
- try_ = try_.with_markers(ctx.receive_node(try_.markers, ctx.receive_markers))
530
- try_ = try_.padding.with_resources(ctx.receive_node(try_.padding.resources, JavaReceiver.receive_container))
531
- try_ = try_.with_body(ctx.receive_node(try_.body, ctx.receive_tree))
532
- try_ = try_.with_catches(ctx.receive_nodes(try_.catches, ctx.receive_tree))
533
- try_ = try_.padding.with_finally(ctx.receive_node(try_.padding.finally_, JavaReceiver.receive_left_padded_tree))
534
- return try_
535
-
536
- def visit_try_resource(self, resource: Try.Resource, ctx: ReceiverContext) -> J:
537
- resource = resource.with_id(ctx.receive_value(resource.id, UUID))
538
- resource = resource.with_prefix(ctx.receive_node(resource.prefix, JavaReceiver.receive_space))
539
- resource = resource.with_markers(ctx.receive_node(resource.markers, ctx.receive_markers))
540
- resource = resource.with_variable_declarations(ctx.receive_node(resource.variable_declarations, ctx.receive_tree))
541
- resource = resource.with_terminated_with_semicolon(ctx.receive_value(resource.terminated_with_semicolon, bool))
542
- return resource
543
-
544
- def visit_catch(self, catch: Try.Catch, ctx: ReceiverContext) -> J:
545
- catch = catch.with_id(ctx.receive_value(catch.id, UUID))
546
- catch = catch.with_prefix(ctx.receive_node(catch.prefix, JavaReceiver.receive_space))
547
- catch = catch.with_markers(ctx.receive_node(catch.markers, ctx.receive_markers))
548
- catch = catch.with_parameter(ctx.receive_node(catch.parameter, ctx.receive_tree))
549
- catch = catch.with_body(ctx.receive_node(catch.body, ctx.receive_tree))
550
- return catch
551
-
552
- def visit_type_cast(self, type_cast: TypeCast, ctx: ReceiverContext) -> J:
553
- type_cast = type_cast.with_id(ctx.receive_value(type_cast.id, UUID))
554
- type_cast = type_cast.with_prefix(ctx.receive_node(type_cast.prefix, JavaReceiver.receive_space))
555
- type_cast = type_cast.with_markers(ctx.receive_node(type_cast.markers, ctx.receive_markers))
556
- type_cast = type_cast.with_clazz(ctx.receive_node(type_cast.clazz, ctx.receive_tree))
557
- type_cast = type_cast.with_expression(ctx.receive_node(type_cast.expression, ctx.receive_tree))
558
- return type_cast
559
-
560
- def visit_type_parameter(self, type_parameter: TypeParameter, ctx: ReceiverContext) -> J:
561
- type_parameter = type_parameter.with_id(ctx.receive_value(type_parameter.id, UUID))
562
- type_parameter = type_parameter.with_prefix(ctx.receive_node(type_parameter.prefix, JavaReceiver.receive_space))
563
- type_parameter = type_parameter.with_markers(ctx.receive_node(type_parameter.markers, ctx.receive_markers))
564
- type_parameter = type_parameter.with_annotations(ctx.receive_nodes(type_parameter.annotations, ctx.receive_tree))
565
- type_parameter = type_parameter.with_modifiers(ctx.receive_nodes(type_parameter.modifiers, ctx.receive_tree))
566
- type_parameter = type_parameter.with_name(ctx.receive_node(type_parameter.name, ctx.receive_tree))
567
- type_parameter = type_parameter.padding.with_bounds(ctx.receive_node(type_parameter.padding.bounds, JavaReceiver.receive_container))
568
- return type_parameter
569
-
570
- def visit_type_parameters(self, type_parameters: TypeParameters, ctx: ReceiverContext) -> J:
571
- type_parameters = type_parameters.with_id(ctx.receive_value(type_parameters.id, UUID))
572
- type_parameters = type_parameters.with_prefix(ctx.receive_node(type_parameters.prefix, JavaReceiver.receive_space))
573
- type_parameters = type_parameters.with_markers(ctx.receive_node(type_parameters.markers, ctx.receive_markers))
574
- type_parameters = type_parameters.with_annotations(ctx.receive_nodes(type_parameters.annotations, ctx.receive_tree))
575
- type_parameters = type_parameters.padding.with_type_parameters(ctx.receive_nodes(type_parameters.padding.type_parameters, JavaReceiver.receive_right_padded_tree))
576
- return type_parameters
577
-
578
- def visit_unary(self, unary: Unary, ctx: ReceiverContext) -> J:
579
- unary = unary.with_id(ctx.receive_value(unary.id, UUID))
580
- unary = unary.with_prefix(ctx.receive_node(unary.prefix, JavaReceiver.receive_space))
581
- unary = unary.with_markers(ctx.receive_node(unary.markers, ctx.receive_markers))
582
- unary = unary.padding.with_operator(ctx.receive_node(unary.padding.operator, JavaReceiver.left_padded_value_receiver(Unary.Type)))
583
- unary = unary.with_expression(ctx.receive_node(unary.expression, ctx.receive_tree))
584
- unary = unary.with_type(ctx.receive_value(unary.type, JavaType))
585
- return unary
586
-
587
- def visit_variable_declarations(self, variable_declarations: VariableDeclarations, ctx: ReceiverContext) -> J:
588
- variable_declarations = variable_declarations.with_id(ctx.receive_value(variable_declarations.id, UUID))
589
- variable_declarations = variable_declarations.with_prefix(ctx.receive_node(variable_declarations.prefix, JavaReceiver.receive_space))
590
- variable_declarations = variable_declarations.with_markers(ctx.receive_node(variable_declarations.markers, ctx.receive_markers))
591
- variable_declarations = variable_declarations.with_leading_annotations(ctx.receive_nodes(variable_declarations.leading_annotations, ctx.receive_tree))
592
- variable_declarations = variable_declarations.with_modifiers(ctx.receive_nodes(variable_declarations.modifiers, ctx.receive_tree))
593
- variable_declarations = variable_declarations.with_type_expression(ctx.receive_node(variable_declarations.type_expression, ctx.receive_tree))
594
- variable_declarations = variable_declarations.with_varargs(ctx.receive_node(variable_declarations.varargs, JavaReceiver.receive_space))
595
- variable_declarations = variable_declarations.with_dimensions_before_name(ctx.receive_nodes(variable_declarations.dimensions_before_name, JavaReceiver.left_padded_node_receiver(Space)))
596
- variable_declarations = variable_declarations.padding.with_variables(ctx.receive_nodes(variable_declarations.padding.variables, JavaReceiver.receive_right_padded_tree))
597
- return variable_declarations
598
-
599
- def visit_variable(self, named_variable: VariableDeclarations.NamedVariable, ctx: ReceiverContext) -> J:
600
- named_variable = named_variable.with_id(ctx.receive_value(named_variable.id, UUID))
601
- named_variable = named_variable.with_prefix(ctx.receive_node(named_variable.prefix, JavaReceiver.receive_space))
602
- named_variable = named_variable.with_markers(ctx.receive_node(named_variable.markers, ctx.receive_markers))
603
- named_variable = named_variable.with_name(ctx.receive_node(named_variable.name, ctx.receive_tree))
604
- named_variable = named_variable.with_dimensions_after_name(ctx.receive_nodes(named_variable.dimensions_after_name, JavaReceiver.left_padded_node_receiver(Space)))
605
- named_variable = named_variable.padding.with_initializer(ctx.receive_node(named_variable.padding.initializer, JavaReceiver.receive_left_padded_tree))
606
- named_variable = named_variable.with_variable_type(ctx.receive_value(named_variable.variable_type, JavaType.Variable))
607
- return named_variable
608
-
609
- def visit_while_loop(self, while_loop: WhileLoop, ctx: ReceiverContext) -> J:
610
- while_loop = while_loop.with_id(ctx.receive_value(while_loop.id, UUID))
611
- while_loop = while_loop.with_prefix(ctx.receive_node(while_loop.prefix, JavaReceiver.receive_space))
612
- while_loop = while_loop.with_markers(ctx.receive_node(while_loop.markers, ctx.receive_markers))
613
- while_loop = while_loop.with_condition(ctx.receive_node(while_loop.condition, ctx.receive_tree))
614
- while_loop = while_loop.padding.with_body(ctx.receive_node(while_loop.padding.body, JavaReceiver.receive_right_padded_tree))
615
- return while_loop
616
-
617
- def visit_wildcard(self, wildcard: Wildcard, ctx: ReceiverContext) -> J:
618
- wildcard = wildcard.with_id(ctx.receive_value(wildcard.id, UUID))
619
- wildcard = wildcard.with_prefix(ctx.receive_node(wildcard.prefix, JavaReceiver.receive_space))
620
- wildcard = wildcard.with_markers(ctx.receive_node(wildcard.markers, ctx.receive_markers))
621
- wildcard = wildcard.padding.with_bound(ctx.receive_node(wildcard.padding.bound, JavaReceiver.left_padded_value_receiver(Wildcard.Bound)))
622
- wildcard = wildcard.with_bounded_type(ctx.receive_node(wildcard.bounded_type, ctx.receive_tree))
623
- return wildcard
624
-
625
- def visit_yield(self, yield_: Yield, ctx: ReceiverContext) -> J:
626
- yield_ = yield_.with_id(ctx.receive_value(yield_.id, UUID))
627
- yield_ = yield_.with_prefix(ctx.receive_node(yield_.prefix, JavaReceiver.receive_space))
628
- yield_ = yield_.with_markers(ctx.receive_node(yield_.markers, ctx.receive_markers))
629
- yield_ = yield_.with_implicit(ctx.receive_value(yield_.implicit, bool))
630
- yield_ = yield_.with_value(ctx.receive_node(yield_.value, ctx.receive_tree))
631
- return yield_
632
-
633
- def visit_unknown(self, unknown: Unknown, ctx: ReceiverContext) -> J:
634
- unknown = unknown.with_id(ctx.receive_value(unknown.id, UUID))
635
- unknown = unknown.with_prefix(ctx.receive_node(unknown.prefix, JavaReceiver.receive_space))
636
- unknown = unknown.with_markers(ctx.receive_node(unknown.markers, ctx.receive_markers))
637
- unknown = unknown.with_source(ctx.receive_node(unknown.source, ctx.receive_tree))
638
- return unknown
639
-
640
- def visit_unknown_source(self, source: Unknown.Source, ctx: ReceiverContext) -> J:
641
- source = source.with_id(ctx.receive_value(source.id, UUID))
642
- source = source.with_prefix(ctx.receive_node(source.prefix, JavaReceiver.receive_space))
643
- source = source.with_markers(ctx.receive_node(source.markers, ctx.receive_markers))
644
- source = source.with_text(ctx.receive_value(source.text, str))
645
- return source
646
-
647
- # noinspection PyTypeChecker
648
- class Factory(ReceiverFactory):
649
- def create(self, type: str, ctx: ReceiverContext) -> Tree:
650
- if type in ["rewrite.java.tree.AnnotatedType", "org.openrewrite.java.tree.J$AnnotatedType"]:
651
- return AnnotatedType(
652
- ctx.receive_value(None, UUID),
653
- ctx.receive_node(None, JavaReceiver.receive_space),
654
- ctx.receive_node(None, ctx.receive_markers),
655
- ctx.receive_nodes(None, ctx.receive_tree),
656
- ctx.receive_node(None, ctx.receive_tree)
657
- )
658
-
659
- if type in ["rewrite.java.tree.Annotation", "org.openrewrite.java.tree.J$Annotation"]:
660
- return Annotation(
661
- ctx.receive_value(None, UUID),
662
- ctx.receive_node(None, JavaReceiver.receive_space),
663
- ctx.receive_node(None, ctx.receive_markers),
664
- ctx.receive_node(None, ctx.receive_tree),
665
- ctx.receive_node(None, JavaReceiver.receive_container)
666
- )
667
-
668
- if type in ["rewrite.java.tree.ArrayAccess", "org.openrewrite.java.tree.J$ArrayAccess"]:
669
- return ArrayAccess(
670
- ctx.receive_value(None, UUID),
671
- ctx.receive_node(None, JavaReceiver.receive_space),
672
- ctx.receive_node(None, ctx.receive_markers),
673
- ctx.receive_node(None, ctx.receive_tree),
674
- ctx.receive_node(None, ctx.receive_tree),
675
- ctx.receive_value(None, JavaType)
676
- )
677
-
678
- if type in ["rewrite.java.tree.ArrayType", "org.openrewrite.java.tree.J$ArrayType"]:
679
- return ArrayType(
680
- ctx.receive_value(None, UUID),
681
- ctx.receive_node(None, JavaReceiver.receive_space),
682
- ctx.receive_node(None, ctx.receive_markers),
683
- ctx.receive_node(None, ctx.receive_tree),
684
- ctx.receive_nodes(None, ctx.receive_tree),
685
- ctx.receive_node(None, JavaReceiver.left_padded_node_receiver(Space)),
686
- ctx.receive_value(None, JavaType)
687
- )
688
-
689
- if type in ["rewrite.java.tree.Assert", "org.openrewrite.java.tree.J$Assert"]:
690
- return Assert(
691
- ctx.receive_value(None, UUID),
692
- ctx.receive_node(None, JavaReceiver.receive_space),
693
- ctx.receive_node(None, ctx.receive_markers),
694
- ctx.receive_node(None, ctx.receive_tree),
695
- ctx.receive_node(None, JavaReceiver.receive_left_padded_tree)
696
- )
697
-
698
- if type in ["rewrite.java.tree.Assignment", "org.openrewrite.java.tree.J$Assignment"]:
699
- return Assignment(
700
- ctx.receive_value(None, UUID),
701
- ctx.receive_node(None, JavaReceiver.receive_space),
702
- ctx.receive_node(None, ctx.receive_markers),
703
- ctx.receive_node(None, ctx.receive_tree),
704
- ctx.receive_node(None, JavaReceiver.receive_left_padded_tree),
705
- ctx.receive_value(None, JavaType)
706
- )
707
-
708
- if type in ["rewrite.java.tree.AssignmentOperation", "org.openrewrite.java.tree.J$AssignmentOperation"]:
709
- return AssignmentOperation(
710
- ctx.receive_value(None, UUID),
711
- ctx.receive_node(None, JavaReceiver.receive_space),
712
- ctx.receive_node(None, ctx.receive_markers),
713
- ctx.receive_node(None, ctx.receive_tree),
714
- ctx.receive_node(None, JavaReceiver.left_padded_value_receiver(AssignmentOperation.Type)),
715
- ctx.receive_node(None, ctx.receive_tree),
716
- ctx.receive_value(None, JavaType)
717
- )
718
-
719
- if type in ["rewrite.java.tree.Binary", "org.openrewrite.java.tree.J$Binary"]:
720
- return Binary(
721
- ctx.receive_value(None, UUID),
722
- ctx.receive_node(None, JavaReceiver.receive_space),
723
- ctx.receive_node(None, ctx.receive_markers),
724
- ctx.receive_node(None, ctx.receive_tree),
725
- ctx.receive_node(None, JavaReceiver.left_padded_value_receiver(Binary.Type)),
726
- ctx.receive_node(None, ctx.receive_tree),
727
- ctx.receive_value(None, JavaType)
728
- )
729
-
730
- if type in ["rewrite.java.tree.Block", "org.openrewrite.java.tree.J$Block"]:
731
- return Block(
732
- ctx.receive_value(None, UUID),
733
- ctx.receive_node(None, JavaReceiver.receive_space),
734
- ctx.receive_node(None, ctx.receive_markers),
735
- ctx.receive_node(None, JavaReceiver.right_padded_value_receiver(bool)),
736
- ctx.receive_nodes(None, JavaReceiver.receive_right_padded_tree),
737
- ctx.receive_node(None, JavaReceiver.receive_space)
738
- )
739
-
740
- if type in ["rewrite.java.tree.Break", "org.openrewrite.java.tree.J$Break"]:
741
- return Break(
742
- ctx.receive_value(None, UUID),
743
- ctx.receive_node(None, JavaReceiver.receive_space),
744
- ctx.receive_node(None, ctx.receive_markers),
745
- ctx.receive_node(None, ctx.receive_tree)
746
- )
747
-
748
- if type in ["rewrite.java.tree.Case", "org.openrewrite.java.tree.J$Case"]:
749
- return Case(
750
- ctx.receive_value(None, UUID),
751
- ctx.receive_node(None, JavaReceiver.receive_space),
752
- ctx.receive_node(None, ctx.receive_markers),
753
- ctx.receive_value(None, Case.Type),
754
- ctx.receive_node(None, JavaReceiver.receive_container),
755
- ctx.receive_node(None, JavaReceiver.receive_container),
756
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree)
757
- )
758
-
759
- if type in ["rewrite.java.tree.ClassDeclaration", "org.openrewrite.java.tree.J$ClassDeclaration"]:
760
- return ClassDeclaration(
761
- ctx.receive_value(None, UUID),
762
- ctx.receive_node(None, JavaReceiver.receive_space),
763
- ctx.receive_node(None, ctx.receive_markers),
764
- ctx.receive_nodes(None, ctx.receive_tree),
765
- ctx.receive_nodes(None, ctx.receive_tree),
766
- ctx.receive_node(None, ctx.receive_tree),
767
- ctx.receive_node(None, ctx.receive_tree),
768
- ctx.receive_node(None, JavaReceiver.receive_container),
769
- ctx.receive_node(None, JavaReceiver.receive_container),
770
- ctx.receive_node(None, JavaReceiver.receive_left_padded_tree),
771
- ctx.receive_node(None, JavaReceiver.receive_container),
772
- ctx.receive_node(None, JavaReceiver.receive_container),
773
- ctx.receive_node(None, ctx.receive_tree),
774
- ctx.receive_value(None, JavaType.FullyQualified)
775
- )
776
-
777
- if type in ["rewrite.java.tree.ClassDeclaration.Kind", "org.openrewrite.java.tree.J$ClassDeclaration$Kind"]:
778
- return ClassDeclaration.Kind(
779
- ctx.receive_value(None, UUID),
780
- ctx.receive_node(None, JavaReceiver.receive_space),
781
- ctx.receive_node(None, ctx.receive_markers),
782
- ctx.receive_nodes(None, ctx.receive_tree),
783
- ctx.receive_value(None, ClassDeclaration.Kind.Type)
784
- )
785
-
786
- if type in ["rewrite.java.tree.CompilationUnit", "org.openrewrite.java.tree.J$CompilationUnit"]:
787
- return CompilationUnit(
788
- ctx.receive_value(None, UUID),
789
- ctx.receive_node(None, JavaReceiver.receive_space),
790
- ctx.receive_node(None, ctx.receive_markers),
791
- ctx.receive_value(None, Path),
792
- ctx.receive_value(None, FileAttributes),
793
- ctx.receive_value(None, str),
794
- ctx.receive_value(None, bool),
795
- ctx.receive_value(None, Checksum),
796
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree),
797
- ctx.receive_nodes(None, JavaReceiver.receive_right_padded_tree),
798
- ctx.receive_nodes(None, ctx.receive_tree),
799
- ctx.receive_node(None, JavaReceiver.receive_space)
800
- )
801
-
802
- if type in ["rewrite.java.tree.Continue", "org.openrewrite.java.tree.J$Continue"]:
803
- return Continue(
804
- ctx.receive_value(None, UUID),
805
- ctx.receive_node(None, JavaReceiver.receive_space),
806
- ctx.receive_node(None, ctx.receive_markers),
807
- ctx.receive_node(None, ctx.receive_tree)
808
- )
809
-
810
- if type in ["rewrite.java.tree.DoWhileLoop", "org.openrewrite.java.tree.J$DoWhileLoop"]:
811
- return DoWhileLoop(
812
- ctx.receive_value(None, UUID),
813
- ctx.receive_node(None, JavaReceiver.receive_space),
814
- ctx.receive_node(None, ctx.receive_markers),
815
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree),
816
- ctx.receive_node(None, JavaReceiver.receive_left_padded_tree)
817
- )
818
-
819
- if type in ["rewrite.java.tree.Empty", "org.openrewrite.java.tree.J$Empty"]:
820
- return Empty(
821
- ctx.receive_value(None, UUID),
822
- ctx.receive_node(None, JavaReceiver.receive_space),
823
- ctx.receive_node(None, ctx.receive_markers)
824
- )
825
-
826
- if type in ["rewrite.java.tree.EnumValue", "org.openrewrite.java.tree.J$EnumValue"]:
827
- return EnumValue(
828
- ctx.receive_value(None, UUID),
829
- ctx.receive_node(None, JavaReceiver.receive_space),
830
- ctx.receive_node(None, ctx.receive_markers),
831
- ctx.receive_nodes(None, ctx.receive_tree),
832
- ctx.receive_node(None, ctx.receive_tree),
833
- ctx.receive_node(None, ctx.receive_tree)
834
- )
835
-
836
- if type in ["rewrite.java.tree.EnumValueSet", "org.openrewrite.java.tree.J$EnumValueSet"]:
837
- return EnumValueSet(
838
- ctx.receive_value(None, UUID),
839
- ctx.receive_node(None, JavaReceiver.receive_space),
840
- ctx.receive_node(None, ctx.receive_markers),
841
- ctx.receive_nodes(None, JavaReceiver.receive_right_padded_tree),
842
- ctx.receive_value(None, bool)
843
- )
844
-
845
- if type in ["rewrite.java.tree.FieldAccess", "org.openrewrite.java.tree.J$FieldAccess"]:
846
- return FieldAccess(
847
- ctx.receive_value(None, UUID),
848
- ctx.receive_node(None, JavaReceiver.receive_space),
849
- ctx.receive_node(None, ctx.receive_markers),
850
- ctx.receive_node(None, ctx.receive_tree),
851
- ctx.receive_node(None, JavaReceiver.receive_left_padded_tree),
852
- ctx.receive_value(None, JavaType)
853
- )
854
-
855
- if type in ["rewrite.java.tree.ForEachLoop", "org.openrewrite.java.tree.J$ForEachLoop"]:
856
- return ForEachLoop(
857
- ctx.receive_value(None, UUID),
858
- ctx.receive_node(None, JavaReceiver.receive_space),
859
- ctx.receive_node(None, ctx.receive_markers),
860
- ctx.receive_node(None, ctx.receive_tree),
861
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree)
862
- )
863
-
864
- if type in ["rewrite.java.tree.ForEachLoop.Control", "org.openrewrite.java.tree.J$ForEachLoop$Control"]:
865
- return ForEachLoop.Control(
866
- ctx.receive_value(None, UUID),
867
- ctx.receive_node(None, JavaReceiver.receive_space),
868
- ctx.receive_node(None, ctx.receive_markers),
869
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree),
870
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree)
871
- )
872
-
873
- if type in ["rewrite.java.tree.ForLoop", "org.openrewrite.java.tree.J$ForLoop"]:
874
- return ForLoop(
875
- ctx.receive_value(None, UUID),
876
- ctx.receive_node(None, JavaReceiver.receive_space),
877
- ctx.receive_node(None, ctx.receive_markers),
878
- ctx.receive_node(None, ctx.receive_tree),
879
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree)
880
- )
881
-
882
- if type in ["rewrite.java.tree.ForLoop.Control", "org.openrewrite.java.tree.J$ForLoop$Control"]:
883
- return ForLoop.Control(
884
- ctx.receive_value(None, UUID),
885
- ctx.receive_node(None, JavaReceiver.receive_space),
886
- ctx.receive_node(None, ctx.receive_markers),
887
- ctx.receive_nodes(None, JavaReceiver.receive_right_padded_tree),
888
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree),
889
- ctx.receive_nodes(None, JavaReceiver.receive_right_padded_tree)
890
- )
891
-
892
- if type in ["rewrite.java.tree.ParenthesizedTypeTree", "org.openrewrite.java.tree.J$ParenthesizedTypeTree"]:
893
- return ParenthesizedTypeTree(
894
- ctx.receive_value(None, UUID),
895
- ctx.receive_node(None, JavaReceiver.receive_space),
896
- ctx.receive_node(None, ctx.receive_markers),
897
- ctx.receive_nodes(None, ctx.receive_tree),
898
- ctx.receive_node(None, ctx.receive_tree)
899
- )
900
-
901
- if type in ["rewrite.java.tree.Identifier", "org.openrewrite.java.tree.J$Identifier"]:
902
- return Identifier(
903
- ctx.receive_value(None, UUID),
904
- ctx.receive_node(None, JavaReceiver.receive_space),
905
- ctx.receive_node(None, ctx.receive_markers),
906
- ctx.receive_nodes(None, ctx.receive_tree),
907
- ctx.receive_value(None, str),
908
- ctx.receive_value(None, JavaType),
909
- ctx.receive_value(None, JavaType.Variable)
910
- )
911
-
912
- if type in ["rewrite.java.tree.If", "org.openrewrite.java.tree.J$If"]:
913
- return If(
914
- ctx.receive_value(None, UUID),
915
- ctx.receive_node(None, JavaReceiver.receive_space),
916
- ctx.receive_node(None, ctx.receive_markers),
917
- ctx.receive_node(None, ctx.receive_tree),
918
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree),
919
- ctx.receive_node(None, ctx.receive_tree)
920
- )
921
-
922
- if type in ["rewrite.java.tree.If.Else", "org.openrewrite.java.tree.J$If$Else"]:
923
- return If.Else(
924
- ctx.receive_value(None, UUID),
925
- ctx.receive_node(None, JavaReceiver.receive_space),
926
- ctx.receive_node(None, ctx.receive_markers),
927
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree)
928
- )
929
-
930
- if type in ["rewrite.java.tree.Import", "org.openrewrite.java.tree.J$Import"]:
931
- return Import(
932
- ctx.receive_value(None, UUID),
933
- ctx.receive_node(None, JavaReceiver.receive_space),
934
- ctx.receive_node(None, ctx.receive_markers),
935
- ctx.receive_node(None, JavaReceiver.left_padded_value_receiver(bool)),
936
- ctx.receive_node(None, ctx.receive_tree),
937
- ctx.receive_node(None, JavaReceiver.receive_left_padded_tree)
938
- )
939
-
940
- if type in ["rewrite.java.tree.InstanceOf", "org.openrewrite.java.tree.J$InstanceOf"]:
941
- return InstanceOf(
942
- ctx.receive_value(None, UUID),
943
- ctx.receive_node(None, JavaReceiver.receive_space),
944
- ctx.receive_node(None, ctx.receive_markers),
945
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree),
946
- ctx.receive_node(None, ctx.receive_tree),
947
- ctx.receive_node(None, ctx.receive_tree),
948
- ctx.receive_value(None, JavaType)
949
- )
950
-
951
- if type in ["rewrite.java.tree.IntersectionType", "org.openrewrite.java.tree.J$IntersectionType"]:
952
- return IntersectionType(
953
- ctx.receive_value(None, UUID),
954
- ctx.receive_node(None, JavaReceiver.receive_space),
955
- ctx.receive_node(None, ctx.receive_markers),
956
- ctx.receive_node(None, JavaReceiver.receive_container)
957
- )
958
-
959
- if type in ["rewrite.java.tree.Label", "org.openrewrite.java.tree.J$Label"]:
960
- return Label(
961
- ctx.receive_value(None, UUID),
962
- ctx.receive_node(None, JavaReceiver.receive_space),
963
- ctx.receive_node(None, ctx.receive_markers),
964
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree),
965
- ctx.receive_node(None, ctx.receive_tree)
966
- )
967
-
968
- if type in ["rewrite.java.tree.Lambda", "org.openrewrite.java.tree.J$Lambda"]:
969
- return Lambda(
970
- ctx.receive_value(None, UUID),
971
- ctx.receive_node(None, JavaReceiver.receive_space),
972
- ctx.receive_node(None, ctx.receive_markers),
973
- ctx.receive_node(None, ctx.receive_tree),
974
- ctx.receive_node(None, JavaReceiver.receive_space),
975
- ctx.receive_node(None, ctx.receive_tree),
976
- ctx.receive_value(None, JavaType)
977
- )
978
-
979
- if type in ["rewrite.java.tree.Lambda.Parameters", "org.openrewrite.java.tree.J$Lambda$Parameters"]:
980
- return Lambda.Parameters(
981
- ctx.receive_value(None, UUID),
982
- ctx.receive_node(None, JavaReceiver.receive_space),
983
- ctx.receive_node(None, ctx.receive_markers),
984
- ctx.receive_value(None, bool),
985
- ctx.receive_nodes(None, JavaReceiver.receive_right_padded_tree)
986
- )
987
-
988
- if type in ["rewrite.java.tree.Literal", "org.openrewrite.java.tree.J$Literal"]:
989
- return Literal(
990
- ctx.receive_value(None, UUID),
991
- ctx.receive_node(None, JavaReceiver.receive_space),
992
- ctx.receive_node(None, ctx.receive_markers),
993
- ctx.receive_value(None, object),
994
- ctx.receive_value(None, str),
995
- ctx.receive_values(None, Literal.UnicodeEscape),
996
- ctx.receive_value(None, JavaType.Primitive)
997
- )
998
-
999
- if type in ["rewrite.java.tree.MemberReference", "org.openrewrite.java.tree.J$MemberReference"]:
1000
- return MemberReference(
1001
- ctx.receive_value(None, UUID),
1002
- ctx.receive_node(None, JavaReceiver.receive_space),
1003
- ctx.receive_node(None, ctx.receive_markers),
1004
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree),
1005
- ctx.receive_node(None, JavaReceiver.receive_container),
1006
- ctx.receive_node(None, JavaReceiver.receive_left_padded_tree),
1007
- ctx.receive_value(None, JavaType),
1008
- ctx.receive_value(None, JavaType.Method),
1009
- ctx.receive_value(None, JavaType.Variable)
1010
- )
1011
-
1012
- if type in ["rewrite.java.tree.MethodDeclaration", "org.openrewrite.java.tree.J$MethodDeclaration"]:
1013
- return MethodDeclaration(
1014
- ctx.receive_value(None, UUID),
1015
- ctx.receive_node(None, JavaReceiver.receive_space),
1016
- ctx.receive_node(None, ctx.receive_markers),
1017
- ctx.receive_nodes(None, ctx.receive_tree),
1018
- ctx.receive_nodes(None, ctx.receive_tree),
1019
- ctx.receive_node(None, ctx.receive_tree),
1020
- ctx.receive_node(None, ctx.receive_tree),
1021
- ctx.receive_node(None, JavaReceiver.receive_method_identifier_with_annotations),
1022
- ctx.receive_node(None, JavaReceiver.receive_container),
1023
- ctx.receive_node(None, JavaReceiver.receive_container),
1024
- ctx.receive_node(None, ctx.receive_tree),
1025
- ctx.receive_node(None, JavaReceiver.receive_left_padded_tree),
1026
- ctx.receive_value(None, JavaType.Method)
1027
- )
1028
-
1029
- if type in ["rewrite.java.tree.MethodInvocation", "org.openrewrite.java.tree.J$MethodInvocation"]:
1030
- return MethodInvocation(
1031
- ctx.receive_value(None, UUID),
1032
- ctx.receive_node(None, JavaReceiver.receive_space),
1033
- ctx.receive_node(None, ctx.receive_markers),
1034
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree),
1035
- ctx.receive_node(None, JavaReceiver.receive_container),
1036
- ctx.receive_node(None, ctx.receive_tree),
1037
- ctx.receive_node(None, JavaReceiver.receive_container),
1038
- ctx.receive_value(None, JavaType.Method)
1039
- )
1040
-
1041
- if type in ["rewrite.java.tree.Modifier", "org.openrewrite.java.tree.J$Modifier"]:
1042
- return Modifier(
1043
- ctx.receive_value(None, UUID),
1044
- ctx.receive_node(None, JavaReceiver.receive_space),
1045
- ctx.receive_node(None, ctx.receive_markers),
1046
- ctx.receive_value(None, str),
1047
- ctx.receive_value(None, Modifier.Type),
1048
- ctx.receive_nodes(None, ctx.receive_tree)
1049
- )
1050
-
1051
- if type in ["rewrite.java.tree.MultiCatch", "org.openrewrite.java.tree.J$MultiCatch"]:
1052
- return MultiCatch(
1053
- ctx.receive_value(None, UUID),
1054
- ctx.receive_node(None, JavaReceiver.receive_space),
1055
- ctx.receive_node(None, ctx.receive_markers),
1056
- ctx.receive_nodes(None, JavaReceiver.receive_right_padded_tree)
1057
- )
1058
-
1059
- if type in ["rewrite.java.tree.NewArray", "org.openrewrite.java.tree.J$NewArray"]:
1060
- return NewArray(
1061
- ctx.receive_value(None, UUID),
1062
- ctx.receive_node(None, JavaReceiver.receive_space),
1063
- ctx.receive_node(None, ctx.receive_markers),
1064
- ctx.receive_node(None, ctx.receive_tree),
1065
- ctx.receive_nodes(None, ctx.receive_tree),
1066
- ctx.receive_node(None, JavaReceiver.receive_container),
1067
- ctx.receive_value(None, JavaType)
1068
- )
1069
-
1070
- if type in ["rewrite.java.tree.ArrayDimension", "org.openrewrite.java.tree.J$ArrayDimension"]:
1071
- return ArrayDimension(
1072
- ctx.receive_value(None, UUID),
1073
- ctx.receive_node(None, JavaReceiver.receive_space),
1074
- ctx.receive_node(None, ctx.receive_markers),
1075
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree)
1076
- )
1077
-
1078
- if type in ["rewrite.java.tree.NewClass", "org.openrewrite.java.tree.J$NewClass"]:
1079
- return NewClass(
1080
- ctx.receive_value(None, UUID),
1081
- ctx.receive_node(None, JavaReceiver.receive_space),
1082
- ctx.receive_node(None, ctx.receive_markers),
1083
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree),
1084
- ctx.receive_node(None, JavaReceiver.receive_space),
1085
- ctx.receive_node(None, ctx.receive_tree),
1086
- ctx.receive_node(None, JavaReceiver.receive_container),
1087
- ctx.receive_node(None, ctx.receive_tree),
1088
- ctx.receive_value(None, JavaType.Method)
1089
- )
1090
-
1091
- if type in ["rewrite.java.tree.NullableType", "org.openrewrite.java.tree.J$NullableType"]:
1092
- return NullableType(
1093
- ctx.receive_value(None, UUID),
1094
- ctx.receive_node(None, JavaReceiver.receive_space),
1095
- ctx.receive_node(None, ctx.receive_markers),
1096
- ctx.receive_nodes(None, ctx.receive_tree),
1097
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree)
1098
- )
1099
-
1100
- if type in ["rewrite.java.tree.Package", "org.openrewrite.java.tree.J$Package"]:
1101
- return Package(
1102
- ctx.receive_value(None, UUID),
1103
- ctx.receive_node(None, JavaReceiver.receive_space),
1104
- ctx.receive_node(None, ctx.receive_markers),
1105
- ctx.receive_node(None, ctx.receive_tree),
1106
- ctx.receive_nodes(None, ctx.receive_tree)
1107
- )
1108
-
1109
- if type in ["rewrite.java.tree.ParameterizedType", "org.openrewrite.java.tree.J$ParameterizedType"]:
1110
- return ParameterizedType(
1111
- ctx.receive_value(None, UUID),
1112
- ctx.receive_node(None, JavaReceiver.receive_space),
1113
- ctx.receive_node(None, ctx.receive_markers),
1114
- ctx.receive_node(None, ctx.receive_tree),
1115
- ctx.receive_node(None, JavaReceiver.receive_container),
1116
- ctx.receive_value(None, JavaType)
1117
- )
1118
-
1119
- if type in ["rewrite.java.tree.Parentheses", "org.openrewrite.java.tree.J$Parentheses"]:
1120
- return Parentheses[J2](
1121
- ctx.receive_value(None, UUID),
1122
- ctx.receive_node(None, JavaReceiver.receive_space),
1123
- ctx.receive_node(None, ctx.receive_markers),
1124
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree)
1125
- )
1126
-
1127
- if type in ["rewrite.java.tree.ControlParentheses", "org.openrewrite.java.tree.J$ControlParentheses"]:
1128
- return ControlParentheses[J2](
1129
- ctx.receive_value(None, UUID),
1130
- ctx.receive_node(None, JavaReceiver.receive_space),
1131
- ctx.receive_node(None, ctx.receive_markers),
1132
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree)
1133
- )
1134
-
1135
- if type in ["rewrite.java.tree.Primitive", "org.openrewrite.java.tree.J$Primitive"]:
1136
- return Primitive(
1137
- ctx.receive_value(None, UUID),
1138
- ctx.receive_node(None, JavaReceiver.receive_space),
1139
- ctx.receive_node(None, ctx.receive_markers),
1140
- ctx.receive_value(None, JavaType.Primitive)
1141
- )
1142
-
1143
- if type in ["rewrite.java.tree.Return", "org.openrewrite.java.tree.J$Return"]:
1144
- return Return(
1145
- ctx.receive_value(None, UUID),
1146
- ctx.receive_node(None, JavaReceiver.receive_space),
1147
- ctx.receive_node(None, ctx.receive_markers),
1148
- ctx.receive_node(None, ctx.receive_tree)
1149
- )
1150
-
1151
- if type in ["rewrite.java.tree.Switch", "org.openrewrite.java.tree.J$Switch"]:
1152
- return Switch(
1153
- ctx.receive_value(None, UUID),
1154
- ctx.receive_node(None, JavaReceiver.receive_space),
1155
- ctx.receive_node(None, ctx.receive_markers),
1156
- ctx.receive_node(None, ctx.receive_tree),
1157
- ctx.receive_node(None, ctx.receive_tree)
1158
- )
1159
-
1160
- if type in ["rewrite.java.tree.SwitchExpression", "org.openrewrite.java.tree.J$SwitchExpression"]:
1161
- return SwitchExpression(
1162
- ctx.receive_value(None, UUID),
1163
- ctx.receive_node(None, JavaReceiver.receive_space),
1164
- ctx.receive_node(None, ctx.receive_markers),
1165
- ctx.receive_node(None, ctx.receive_tree),
1166
- ctx.receive_node(None, ctx.receive_tree)
1167
- )
1168
-
1169
- if type in ["rewrite.java.tree.Synchronized", "org.openrewrite.java.tree.J$Synchronized"]:
1170
- return Synchronized(
1171
- ctx.receive_value(None, UUID),
1172
- ctx.receive_node(None, JavaReceiver.receive_space),
1173
- ctx.receive_node(None, ctx.receive_markers),
1174
- ctx.receive_node(None, ctx.receive_tree),
1175
- ctx.receive_node(None, ctx.receive_tree)
1176
- )
1177
-
1178
- if type in ["rewrite.java.tree.Ternary", "org.openrewrite.java.tree.J$Ternary"]:
1179
- return Ternary(
1180
- ctx.receive_value(None, UUID),
1181
- ctx.receive_node(None, JavaReceiver.receive_space),
1182
- ctx.receive_node(None, ctx.receive_markers),
1183
- ctx.receive_node(None, ctx.receive_tree),
1184
- ctx.receive_node(None, JavaReceiver.receive_left_padded_tree),
1185
- ctx.receive_node(None, JavaReceiver.receive_left_padded_tree),
1186
- ctx.receive_value(None, JavaType)
1187
- )
1188
-
1189
- if type in ["rewrite.java.tree.Throw", "org.openrewrite.java.tree.J$Throw"]:
1190
- return Throw(
1191
- ctx.receive_value(None, UUID),
1192
- ctx.receive_node(None, JavaReceiver.receive_space),
1193
- ctx.receive_node(None, ctx.receive_markers),
1194
- ctx.receive_node(None, ctx.receive_tree)
1195
- )
1196
-
1197
- if type in ["rewrite.java.tree.Try", "org.openrewrite.java.tree.J$Try"]:
1198
- return Try(
1199
- ctx.receive_value(None, UUID),
1200
- ctx.receive_node(None, JavaReceiver.receive_space),
1201
- ctx.receive_node(None, ctx.receive_markers),
1202
- ctx.receive_node(None, JavaReceiver.receive_container),
1203
- ctx.receive_node(None, ctx.receive_tree),
1204
- ctx.receive_nodes(None, ctx.receive_tree),
1205
- ctx.receive_node(None, JavaReceiver.receive_left_padded_tree)
1206
- )
1207
-
1208
- if type in ["rewrite.java.tree.Try.Resource", "org.openrewrite.java.tree.J$Try$Resource"]:
1209
- return Try.Resource(
1210
- ctx.receive_value(None, UUID),
1211
- ctx.receive_node(None, JavaReceiver.receive_space),
1212
- ctx.receive_node(None, ctx.receive_markers),
1213
- ctx.receive_node(None, ctx.receive_tree),
1214
- ctx.receive_value(None, bool)
1215
- )
1216
-
1217
- if type in ["rewrite.java.tree.Try.Catch", "org.openrewrite.java.tree.J$Try$Catch"]:
1218
- return Try.Catch(
1219
- ctx.receive_value(None, UUID),
1220
- ctx.receive_node(None, JavaReceiver.receive_space),
1221
- ctx.receive_node(None, ctx.receive_markers),
1222
- ctx.receive_node(None, ctx.receive_tree),
1223
- ctx.receive_node(None, ctx.receive_tree)
1224
- )
1225
-
1226
- if type in ["rewrite.java.tree.TypeCast", "org.openrewrite.java.tree.J$TypeCast"]:
1227
- return TypeCast(
1228
- ctx.receive_value(None, UUID),
1229
- ctx.receive_node(None, JavaReceiver.receive_space),
1230
- ctx.receive_node(None, ctx.receive_markers),
1231
- ctx.receive_node(None, ctx.receive_tree),
1232
- ctx.receive_node(None, ctx.receive_tree)
1233
- )
1234
-
1235
- if type in ["rewrite.java.tree.TypeParameter", "org.openrewrite.java.tree.J$TypeParameter"]:
1236
- return TypeParameter(
1237
- ctx.receive_value(None, UUID),
1238
- ctx.receive_node(None, JavaReceiver.receive_space),
1239
- ctx.receive_node(None, ctx.receive_markers),
1240
- ctx.receive_nodes(None, ctx.receive_tree),
1241
- ctx.receive_nodes(None, ctx.receive_tree),
1242
- ctx.receive_node(None, ctx.receive_tree),
1243
- ctx.receive_node(None, JavaReceiver.receive_container)
1244
- )
1245
-
1246
- if type in ["rewrite.java.tree.TypeParameters", "org.openrewrite.java.tree.J$TypeParameters"]:
1247
- return TypeParameters(
1248
- ctx.receive_value(None, UUID),
1249
- ctx.receive_node(None, JavaReceiver.receive_space),
1250
- ctx.receive_node(None, ctx.receive_markers),
1251
- ctx.receive_nodes(None, ctx.receive_tree),
1252
- ctx.receive_nodes(None, JavaReceiver.receive_right_padded_tree)
1253
- )
1254
-
1255
- if type in ["rewrite.java.tree.Unary", "org.openrewrite.java.tree.J$Unary"]:
1256
- return Unary(
1257
- ctx.receive_value(None, UUID),
1258
- ctx.receive_node(None, JavaReceiver.receive_space),
1259
- ctx.receive_node(None, ctx.receive_markers),
1260
- ctx.receive_node(None, JavaReceiver.left_padded_value_receiver(Unary.Type)),
1261
- ctx.receive_node(None, ctx.receive_tree),
1262
- ctx.receive_value(None, JavaType)
1263
- )
1264
-
1265
- if type in ["rewrite.java.tree.VariableDeclarations", "org.openrewrite.java.tree.J$VariableDeclarations"]:
1266
- return VariableDeclarations(
1267
- ctx.receive_value(None, UUID),
1268
- ctx.receive_node(None, JavaReceiver.receive_space),
1269
- ctx.receive_node(None, ctx.receive_markers),
1270
- ctx.receive_nodes(None, ctx.receive_tree),
1271
- ctx.receive_nodes(None, ctx.receive_tree),
1272
- ctx.receive_node(None, ctx.receive_tree),
1273
- ctx.receive_node(None, JavaReceiver.receive_space),
1274
- ctx.receive_nodes(None, JavaReceiver.left_padded_node_receiver(Space)),
1275
- ctx.receive_nodes(None, JavaReceiver.receive_right_padded_tree)
1276
- )
1277
-
1278
- if type in ["rewrite.java.tree.VariableDeclarations.NamedVariable", "org.openrewrite.java.tree.J$VariableDeclarations$NamedVariable"]:
1279
- return VariableDeclarations.NamedVariable(
1280
- ctx.receive_value(None, UUID),
1281
- ctx.receive_node(None, JavaReceiver.receive_space),
1282
- ctx.receive_node(None, ctx.receive_markers),
1283
- ctx.receive_node(None, ctx.receive_tree),
1284
- ctx.receive_nodes(None, JavaReceiver.left_padded_node_receiver(Space)),
1285
- ctx.receive_node(None, JavaReceiver.receive_left_padded_tree),
1286
- ctx.receive_value(None, JavaType.Variable)
1287
- )
1288
-
1289
- if type in ["rewrite.java.tree.WhileLoop", "org.openrewrite.java.tree.J$WhileLoop"]:
1290
- return WhileLoop(
1291
- ctx.receive_value(None, UUID),
1292
- ctx.receive_node(None, JavaReceiver.receive_space),
1293
- ctx.receive_node(None, ctx.receive_markers),
1294
- ctx.receive_node(None, ctx.receive_tree),
1295
- ctx.receive_node(None, JavaReceiver.receive_right_padded_tree)
1296
- )
1297
-
1298
- if type in ["rewrite.java.tree.Wildcard", "org.openrewrite.java.tree.J$Wildcard"]:
1299
- return Wildcard(
1300
- ctx.receive_value(None, UUID),
1301
- ctx.receive_node(None, JavaReceiver.receive_space),
1302
- ctx.receive_node(None, ctx.receive_markers),
1303
- ctx.receive_node(None, JavaReceiver.left_padded_value_receiver(Wildcard.Bound)),
1304
- ctx.receive_node(None, ctx.receive_tree)
1305
- )
1306
-
1307
- if type in ["rewrite.java.tree.Yield", "org.openrewrite.java.tree.J$Yield"]:
1308
- return Yield(
1309
- ctx.receive_value(None, UUID),
1310
- ctx.receive_node(None, JavaReceiver.receive_space),
1311
- ctx.receive_node(None, ctx.receive_markers),
1312
- ctx.receive_value(None, bool),
1313
- ctx.receive_node(None, ctx.receive_tree)
1314
- )
1315
-
1316
- if type in ["rewrite.java.tree.Unknown", "org.openrewrite.java.tree.J$Unknown"]:
1317
- return Unknown(
1318
- ctx.receive_value(None, UUID),
1319
- ctx.receive_node(None, JavaReceiver.receive_space),
1320
- ctx.receive_node(None, ctx.receive_markers),
1321
- ctx.receive_node(None, ctx.receive_tree)
1322
- )
1323
-
1324
- if type in ["rewrite.java.tree.Unknown.Source", "org.openrewrite.java.tree.J$Unknown$Source"]:
1325
- return Unknown.Source(
1326
- ctx.receive_value(None, UUID),
1327
- ctx.receive_node(None, JavaReceiver.receive_space),
1328
- ctx.receive_node(None, ctx.receive_markers),
1329
- ctx.receive_value(None, str)
1330
- )
1331
-
1332
- raise NotImplementedError("No factory method for type: " + type)
1333
-
1334
- @classmethod
1335
- def receive_method_identifier_with_annotations(cls, before: MethodDeclaration.IdentifierWithAnnotations, type: Optional[str], ctx: ReceiverContext) -> MethodDeclaration.IdentifierWithAnnotations:
1336
- if before is not None:
1337
- before = before.with_identifier(ctx.receive_node(before.identifier, ctx.receive_tree))
1338
- before = before.with_annotations(ctx.receive_nodes(before.annotations, ctx.receive_tree))
1339
- else:
1340
- before = MethodDeclaration.IdentifierWithAnnotations(
1341
- ctx.receive_node(None, ctx.receive_tree),
1342
- ctx.receive_nodes(None, ctx.receive_tree)
1343
- )
1344
- return before
1345
-
1346
- @classmethod
1347
- def receive_container(cls, container: Optional[JContainer[T]], type: Optional[str], ctx: ReceiverContext) -> JContainer[T]:
1348
- return extensions.receive_container(container, type, ctx)
1349
-
1350
- @classmethod
1351
- def left_padded_value_receiver(cls, type_: Type) -> Callable[[Optional[JLeftPadded[T]], Optional[str], ReceiverContext], JLeftPadded[T]]:
1352
- return extensions.left_padded_value_receiver(type_)
1353
-
1354
- @classmethod
1355
- def left_padded_node_receiver(cls, type_: Type) -> Callable[[Optional[JLeftPadded[T]], Optional[str], ReceiverContext], JLeftPadded[T]]:
1356
- return extensions.left_padded_node_receiver(type_)
1357
-
1358
- @classmethod
1359
- def receive_left_padded_tree(cls, left_padded: Optional[JLeftPadded[T]], type: Optional[str], ctx: ReceiverContext) -> JLeftPadded[T]:
1360
- return extensions.receive_left_padded_tree(left_padded, type, ctx)
1361
-
1362
- @classmethod
1363
- def right_padded_value_receiver(cls, type_: Type) -> Callable[[Optional[JRightPadded[T]], Optional[str], ReceiverContext], JRightPadded[T]]:
1364
- return extensions.right_padded_value_receiver(type_)
1365
-
1366
- @classmethod
1367
- def right_padded_node_receiver(cls, type_: Type) -> Callable[[Optional[JRightPadded[T]], Optional[str], ReceiverContext], JRightPadded[T]]:
1368
- return extensions.right_padded_node_receiver(type_)
1369
-
1370
- @classmethod
1371
- def receive_right_padded_tree(cls, right_padded: Optional[JRightPadded[T]], type: Optional[str], ctx: ReceiverContext) -> JRightPadded[T]:
1372
- return extensions.receive_right_padded_tree(right_padded, type, ctx)
1373
-
1374
- @classmethod
1375
- def receive_space(cls, space: Optional[Space], type: Optional[str], ctx: ReceiverContext) -> Space:
1376
- return extensions.receive_space(space, type, ctx)