Skip to content

Commit

Permalink
Regenerate Java remoting code
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwannheden committed Dec 16, 2024
1 parent 5c6155f commit a2a19ff
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDeclarat
classDeclaration = classDeclaration.withPrefix(ctx.receiveNonNullNode(classDeclaration.getPrefix(), PythonReceiver::receiveSpace));
classDeclaration = classDeclaration.withMarkers(ctx.receiveNonNullNode(classDeclaration.getMarkers(), ctx::receiveMarkers));
classDeclaration = classDeclaration.withLeadingAnnotations(ctx.receiveNonNullNodes(classDeclaration.getLeadingAnnotations(), ctx::receiveTree));
classDeclaration = classDeclaration.withModifiers(ctx.receiveNonNullNodes(classDeclaration.getModifiers(), PythonReceiver::receiveModifier));
classDeclaration = classDeclaration.withModifiers(ctx.receiveNonNullNodes(classDeclaration.getModifiers(), ctx::receiveTree));
classDeclaration = classDeclaration.getPadding().withKind(ctx.receiveNonNullNode(classDeclaration.getPadding().getKind(), PythonReceiver::receiveClassDeclarationKind));
classDeclaration = classDeclaration.withName(ctx.receiveNonNullNode(classDeclaration.getName(), ctx::receiveTree));
classDeclaration = classDeclaration.getPadding().withTypeParameters(ctx.receiveNode(classDeclaration.getPadding().getTypeParameters(), PythonReceiver::receiveContainer));
Expand Down Expand Up @@ -820,7 +820,7 @@ public J.MethodDeclaration visitMethodDeclaration(J.MethodDeclaration methodDecl
methodDeclaration = methodDeclaration.withPrefix(ctx.receiveNonNullNode(methodDeclaration.getPrefix(), PythonReceiver::receiveSpace));
methodDeclaration = methodDeclaration.withMarkers(ctx.receiveNonNullNode(methodDeclaration.getMarkers(), ctx::receiveMarkers));
methodDeclaration = methodDeclaration.withLeadingAnnotations(ctx.receiveNonNullNodes(methodDeclaration.getLeadingAnnotations(), ctx::receiveTree));
methodDeclaration = methodDeclaration.withModifiers(ctx.receiveNonNullNodes(methodDeclaration.getModifiers(), PythonReceiver::receiveModifier));
methodDeclaration = methodDeclaration.withModifiers(ctx.receiveNonNullNodes(methodDeclaration.getModifiers(), ctx::receiveTree));
methodDeclaration = methodDeclaration.getAnnotations().withTypeParameters(ctx.receiveNode(methodDeclaration.getAnnotations().getTypeParameters(), PythonReceiver::receiveMethodTypeParameters));
methodDeclaration = methodDeclaration.withReturnTypeExpression(ctx.receiveNode(methodDeclaration.getReturnTypeExpression(), ctx::receiveTree));
methodDeclaration = methodDeclaration.getAnnotations().withName(ctx.receiveNonNullNode(methodDeclaration.getAnnotations().getName(), PythonReceiver::receiveMethodIdentifierWithAnnotations));
Expand All @@ -845,6 +845,17 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation methodInvocat
return methodInvocation;
}

@Override
public J.Modifier visitModifier(J.Modifier modifier, ReceiverContext ctx) {
modifier = modifier.withId(ctx.receiveNonNullValue(modifier.getId(), UUID.class));
modifier = modifier.withPrefix(ctx.receiveNonNullNode(modifier.getPrefix(), PythonReceiver::receiveSpace));
modifier = modifier.withMarkers(ctx.receiveNonNullNode(modifier.getMarkers(), ctx::receiveMarkers));
modifier = modifier.withKeyword(ctx.receiveValue(modifier.getKeyword(), String.class));
modifier = modifier.withType(ctx.receiveNonNullValue(modifier.getType(), J.Modifier.Type.class));
modifier = modifier.withAnnotations(ctx.receiveNonNullNodes(modifier.getAnnotations(), ctx::receiveTree));
return modifier;
}

@Override
public J.MultiCatch visitMultiCatch(J.MultiCatch multiCatch, ReceiverContext ctx) {
multiCatch = multiCatch.withId(ctx.receiveNonNullValue(multiCatch.getId(), UUID.class));
Expand Down Expand Up @@ -1055,7 +1066,7 @@ public J.TypeParameter visitTypeParameter(J.TypeParameter typeParameter, Receive
typeParameter = typeParameter.withPrefix(ctx.receiveNonNullNode(typeParameter.getPrefix(), PythonReceiver::receiveSpace));
typeParameter = typeParameter.withMarkers(ctx.receiveNonNullNode(typeParameter.getMarkers(), ctx::receiveMarkers));
typeParameter = typeParameter.withAnnotations(ctx.receiveNonNullNodes(typeParameter.getAnnotations(), ctx::receiveTree));
typeParameter = typeParameter.withModifiers(ctx.receiveNonNullNodes(typeParameter.getModifiers(), PythonReceiver::receiveModifier));
typeParameter = typeParameter.withModifiers(ctx.receiveNonNullNodes(typeParameter.getModifiers(), ctx::receiveTree));
typeParameter = typeParameter.withName(ctx.receiveNonNullNode(typeParameter.getName(), ctx::receiveTree));
typeParameter = typeParameter.getPadding().withBounds(ctx.receiveNode(typeParameter.getPadding().getBounds(), PythonReceiver::receiveContainer));
return typeParameter;
Expand All @@ -1078,7 +1089,7 @@ public J.VariableDeclarations visitVariableDeclarations(J.VariableDeclarations v
variableDeclarations = variableDeclarations.withPrefix(ctx.receiveNonNullNode(variableDeclarations.getPrefix(), PythonReceiver::receiveSpace));
variableDeclarations = variableDeclarations.withMarkers(ctx.receiveNonNullNode(variableDeclarations.getMarkers(), ctx::receiveMarkers));
variableDeclarations = variableDeclarations.withLeadingAnnotations(ctx.receiveNonNullNodes(variableDeclarations.getLeadingAnnotations(), ctx::receiveTree));
variableDeclarations = variableDeclarations.withModifiers(ctx.receiveNonNullNodes(variableDeclarations.getModifiers(), PythonReceiver::receiveModifier));
variableDeclarations = variableDeclarations.withModifiers(ctx.receiveNonNullNodes(variableDeclarations.getModifiers(), ctx::receiveTree));
variableDeclarations = variableDeclarations.withTypeExpression(ctx.receiveNode(variableDeclarations.getTypeExpression(), ctx::receiveTree));
variableDeclarations = variableDeclarations.withVarargs(ctx.receiveNode(variableDeclarations.getVarargs(), PythonReceiver::receiveSpace));
variableDeclarations = variableDeclarations.withDimensionsBeforeName(ctx.receiveNonNullNodes(variableDeclarations.getDimensionsBeforeName(), leftPaddedNodeReceiver(org.openrewrite.java.tree.Space.class)));
Expand Down Expand Up @@ -1772,7 +1783,7 @@ private static J.ClassDeclaration createJClassDeclaration(ReceiverContext ctx) {
ctx.receiveNonNullNode(null, PythonReceiver::receiveSpace),
ctx.receiveNonNullNode(null, ctx::receiveMarkers),
ctx.receiveNonNullNodes(null, ctx::receiveTree),
ctx.receiveNonNullNodes(null, PythonReceiver::receiveModifier),
ctx.receiveNonNullNodes(null, ctx::receiveTree),
ctx.receiveNonNullNode(null, PythonReceiver::receiveClassDeclarationKind),
ctx.receiveNonNullNode(null, ctx::receiveTree),
ctx.receiveNode(null, PythonReceiver::receiveContainer),
Expand Down Expand Up @@ -2033,7 +2044,7 @@ private static J.MethodDeclaration createJMethodDeclaration(ReceiverContext ctx)
ctx.receiveNonNullNode(null, PythonReceiver::receiveSpace),
ctx.receiveNonNullNode(null, ctx::receiveMarkers),
ctx.receiveNonNullNodes(null, ctx::receiveTree),
ctx.receiveNonNullNodes(null, PythonReceiver::receiveModifier),
ctx.receiveNonNullNodes(null, ctx::receiveTree),
ctx.receiveNode(null, PythonReceiver::receiveMethodTypeParameters),
ctx.receiveNode(null, ctx::receiveTree),
ctx.receiveNonNullNode(null, PythonReceiver::receiveMethodIdentifierWithAnnotations),
Expand Down Expand Up @@ -2279,7 +2290,7 @@ private static J.TypeParameter createJTypeParameter(ReceiverContext ctx) {
ctx.receiveNonNullNode(null, PythonReceiver::receiveSpace),
ctx.receiveNonNullNode(null, ctx::receiveMarkers),
ctx.receiveNonNullNodes(null, ctx::receiveTree),
ctx.receiveNonNullNodes(null, PythonReceiver::receiveModifier),
ctx.receiveNonNullNodes(null, ctx::receiveTree),
ctx.receiveNonNullNode(null, ctx::receiveTree),
ctx.receiveNode(null, PythonReceiver::receiveContainer)
);
Expand Down Expand Up @@ -2312,7 +2323,7 @@ private static J.VariableDeclarations createJVariableDeclarations(ReceiverContex
ctx.receiveNonNullNode(null, PythonReceiver::receiveSpace),
ctx.receiveNonNullNode(null, ctx::receiveMarkers),
ctx.receiveNonNullNodes(null, ctx::receiveTree),
ctx.receiveNonNullNodes(null, PythonReceiver::receiveModifier),
ctx.receiveNonNullNodes(null, ctx::receiveTree),
ctx.receiveNode(null, ctx::receiveTree),
ctx.receiveNode(null, PythonReceiver::receiveSpace),
ctx.receiveNonNullNodes(null, leftPaddedNodeReceiver(org.openrewrite.java.tree.Space.class)),
Expand Down Expand Up @@ -2433,27 +2444,6 @@ private static J.MethodDeclaration.IdentifierWithAnnotations receiveMethodIdenti
return identifierWithAnnotations;
}

private static J.Modifier receiveModifier(J.@Nullable Modifier modifier, @Nullable Class<?> type, ReceiverContext ctx) {
if (modifier != null) {
modifier = modifier.withId(ctx.receiveNonNullValue(modifier.getId(), UUID.class));
modifier = modifier.withPrefix(ctx.receiveNonNullNode(modifier.getPrefix(), PythonReceiver::receiveSpace));
modifier = modifier.withMarkers(ctx.receiveNonNullNode(modifier.getMarkers(), ctx::receiveMarkers));
modifier = modifier.withKeyword(ctx.receiveValue(modifier.getKeyword(), String.class));
modifier = modifier.withType(ctx.receiveNonNullValue(modifier.getType(), J.Modifier.Type.class));
modifier = modifier.withAnnotations(ctx.receiveNonNullNodes(modifier.getAnnotations(), ctx::receiveTree));
} else {
modifier = new J.Modifier(
ctx.receiveNonNullValue(null, UUID.class),
ctx.receiveNonNullNode(null, PythonReceiver::receiveSpace),
ctx.receiveNonNullNode(null, ctx::receiveMarkers),
ctx.receiveValue(null, String.class),
ctx.receiveNonNullValue(null, J.Modifier.Type.class),
ctx.receiveNonNullNodes(null, ctx::receiveTree)
);
}
return modifier;
}

private static J.TypeParameters receiveMethodTypeParameters(J.@Nullable TypeParameters typeParameters, @Nullable Class<?> type, ReceiverContext ctx) {
if (typeParameters != null) {
typeParameters = typeParameters.withId(ctx.receiveNonNullValue(typeParameters.getId(), UUID.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDeclarat
ctx.sendNode(classDeclaration, J.ClassDeclaration::getPrefix, PythonSender::sendSpace);
ctx.sendNode(classDeclaration, J.ClassDeclaration::getMarkers, ctx::sendMarkers);
ctx.sendNodes(classDeclaration, J.ClassDeclaration::getLeadingAnnotations, ctx::sendTree, Tree::getId);
ctx.sendNodes(classDeclaration, J.ClassDeclaration::getModifiers, this::sendModifier, Tree::getId);
ctx.sendNodes(classDeclaration, J.ClassDeclaration::getModifiers, ctx::sendTree, Tree::getId);
ctx.sendNode(classDeclaration, e -> e.getPadding().getKind(), this::sendClassDeclarationKind);
ctx.sendNode(classDeclaration, J.ClassDeclaration::getName, ctx::sendTree);
ctx.sendNode(classDeclaration, e -> e.getPadding().getTypeParameters(), PythonSender::sendContainer);
Expand Down Expand Up @@ -818,7 +818,7 @@ public J.MethodDeclaration visitMethodDeclaration(J.MethodDeclaration methodDecl
ctx.sendNode(methodDeclaration, J.MethodDeclaration::getPrefix, PythonSender::sendSpace);
ctx.sendNode(methodDeclaration, J.MethodDeclaration::getMarkers, ctx::sendMarkers);
ctx.sendNodes(methodDeclaration, J.MethodDeclaration::getLeadingAnnotations, ctx::sendTree, Tree::getId);
ctx.sendNodes(methodDeclaration, J.MethodDeclaration::getModifiers, this::sendModifier, Tree::getId);
ctx.sendNodes(methodDeclaration, J.MethodDeclaration::getModifiers, ctx::sendTree, Tree::getId);
ctx.sendNode(methodDeclaration, e -> e.getAnnotations().getTypeParameters(), this::sendMethodTypeParameters);
ctx.sendNode(methodDeclaration, J.MethodDeclaration::getReturnTypeExpression, ctx::sendTree);
ctx.sendNode(methodDeclaration, e -> e.getAnnotations().getName(), this::sendMethodIdentifierWithAnnotations);
Expand Down Expand Up @@ -848,13 +848,15 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation methodInvocat
return methodInvocation;
}

private void sendModifier(J.Modifier modifier, SenderContext ctx) {
@Override
public J.Modifier visitModifier(J.Modifier modifier, SenderContext ctx) {
ctx.sendValue(modifier, J.Modifier::getId);
ctx.sendNode(modifier, J.Modifier::getPrefix, PythonSender::sendSpace);
ctx.sendNode(modifier, J.Modifier::getMarkers, ctx::sendMarkers);
ctx.sendValue(modifier, J.Modifier::getKeyword);
ctx.sendValue(modifier, J.Modifier::getType);
ctx.sendNodes(modifier, J.Modifier::getAnnotations, ctx::sendTree, Tree::getId);
return modifier;
}

@Override
Expand Down Expand Up @@ -1067,7 +1069,7 @@ public J.TypeParameter visitTypeParameter(J.TypeParameter typeParameter, SenderC
ctx.sendNode(typeParameter, J.TypeParameter::getPrefix, PythonSender::sendSpace);
ctx.sendNode(typeParameter, J.TypeParameter::getMarkers, ctx::sendMarkers);
ctx.sendNodes(typeParameter, J.TypeParameter::getAnnotations, ctx::sendTree, Tree::getId);
ctx.sendNodes(typeParameter, J.TypeParameter::getModifiers, this::sendModifier, Tree::getId);
ctx.sendNodes(typeParameter, J.TypeParameter::getModifiers, ctx::sendTree, Tree::getId);
ctx.sendNode(typeParameter, J.TypeParameter::getName, ctx::sendTree);
ctx.sendNode(typeParameter, e -> e.getPadding().getBounds(), PythonSender::sendContainer);
return typeParameter;
Expand Down Expand Up @@ -1098,7 +1100,7 @@ public J.VariableDeclarations visitVariableDeclarations(J.VariableDeclarations v
ctx.sendNode(variableDeclarations, J.VariableDeclarations::getPrefix, PythonSender::sendSpace);
ctx.sendNode(variableDeclarations, J.VariableDeclarations::getMarkers, ctx::sendMarkers);
ctx.sendNodes(variableDeclarations, J.VariableDeclarations::getLeadingAnnotations, ctx::sendTree, Tree::getId);
ctx.sendNodes(variableDeclarations, J.VariableDeclarations::getModifiers, this::sendModifier, Tree::getId);
ctx.sendNodes(variableDeclarations, J.VariableDeclarations::getModifiers, ctx::sendTree, Tree::getId);
ctx.sendNode(variableDeclarations, J.VariableDeclarations::getTypeExpression, ctx::sendTree);
ctx.sendNode(variableDeclarations, J.VariableDeclarations::getVarargs, PythonSender::sendSpace);
ctx.sendNodes(variableDeclarations, J.VariableDeclarations::getDimensionsBeforeName, PythonSender::sendLeftPadded, Function.identity());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,12 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation methodInvocat
return methodInvocation;
}

@Override
public J.Modifier visitModifier(J.Modifier modifier, P p) {
ListUtils.map(modifier.getAnnotations(), el -> visitAndValidateNonNull(el, J.Annotation.class, p));
return modifier;
}

@Override
public J.MultiCatch visitMultiCatch(J.MultiCatch multiCatch, P p) {
ListUtils.map(multiCatch.getAlternatives(), el -> visitAndValidateNonNull(el, NameTree.class, p));
Expand Down

0 comments on commit a2a19ff

Please sign in to comment.