Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ protected ProcessBuilder configureProcess(ProcessBuilder processBuilder) {
ProcessBuilder result = super.configureProcess(processBuilder);
List<String> commands = result.command();
commands.add("--dummy");
result = result.command(commands);
return result;
return result.command(commands);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ public void testParse() {
pathToSolution,
pathToSolution.getParent(),
ctx)
.forEach(sf -> {
.forEach(sf ->
System.out.println(sf.print(new Cursor(new Cursor(
null,
Cursor.ROOT_VALUE), sf)));
}));
Cursor.ROOT_VALUE), sf)))));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,13 @@
import lombok.extern.java.Log;
import org.junit.jupiter.api.Test;
import org.openrewrite.*;
import org.openrewrite.config.RecipeDescriptor;
import org.openrewrite.csharp.tree.Cs;
import org.openrewrite.internal.InMemoryLargeSourceSet;
import org.openrewrite.java.JavaParser;
import org.openrewrite.java.tree.J;
import org.openrewrite.java.tree.JRightPadded;
import org.openrewrite.java.tree.Space;
import org.openrewrite.marker.Markers;
import org.openrewrite.remote.InstallableRemotingRecipe;
import org.openrewrite.remote.PackageSource;
import org.openrewrite.remote.RemotingContext;
import org.openrewrite.remote.RemotingExecutionContextView;
import org.openrewrite.remote.RemotingRecipe;
import org.openrewrite.remote.RemotingRecipeManager;
import org.openrewrite.remote.TcpUtils;
import org.openrewrite.remote.*;

import java.io.File;
import java.net.URL;
Expand Down Expand Up @@ -92,7 +84,7 @@ public void testRemotingRecipeInstallAndRun() throws Exception {
ctx
);

Recipe selectedRecipe = recipes.getRecipes().stream().filter(x -> x.getName().equals("Rewrite.Recipes.FindClass"))
Recipe selectedRecipe = recipes.getRecipes().stream().filter(x -> "Rewrite.Recipes.FindClass".equals(x.getName()))
.findFirst()
.orElseThrow();

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
import org.openrewrite.Cursor;
import org.openrewrite.Tree;
import org.openrewrite.csharp.CSharpVisitor;
import org.openrewrite.csharp.tree.*;
import org.openrewrite.java.*;
import org.openrewrite.csharp.tree.Cs;
import org.openrewrite.java.tree.*;
import org.openrewrite.remote.Sender;
import org.openrewrite.remote.SenderContext;
Expand Down Expand Up @@ -1976,8 +1975,4 @@ private static void sendSpace(Space space, SenderContext ctx) {
Extensions.sendSpace(space, ctx);
}

private static void sendComment(Comment comment, SenderContext ctx) {
Extensions.sendComment(comment, ctx);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,8 @@

package org.openrewrite.csharp;

import org.jspecify.annotations.Nullable;
import org.openrewrite.*;
import org.openrewrite.internal.ListUtils;
import org.openrewrite.marker.Markers;
import org.openrewrite.tree.*;
import org.openrewrite.java.JavaVisitor;
import org.openrewrite.java.tree.*;
import org.openrewrite.csharp.tree.*;

import java.util.List;
import org.openrewrite.csharp.tree.Cs;
import org.openrewrite.java.tree.J;

public class CSharpIsoVisitor<P> extends CSharpVisitor<P>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.openrewrite.marker.Markers;

import java.util.List;
import java.util.Objects;
import java.util.function.UnaryOperator;

public class CSharpPrinter<P> extends CSharpVisitor<PrintOutputCapture<P>> {
Expand All @@ -43,9 +42,8 @@ public J visit(@Nullable Tree tree, PrintOutputCapture<P> p) {
if (!(tree instanceof Cs)) {
// re-route printing to the java printer
return delegate.visit(tree, p);
} else {
return super.visit(tree, p);
}
return super.visit(tree, p);
}

@Override
Expand Down Expand Up @@ -92,13 +90,15 @@ public J visitOperatorDeclaration(Cs.OperatorDeclaration node, PrintOutputCaptur
return node;
}

@Override
public J visitPointerType(Cs.PointerType node, PrintOutputCapture<P> p) {
beforeSyntax(node, CsSpace.Location.POINTER_TYPE_PREFIX, p);
visitRightPadded(node.getPadding().getElementType(), CsRightPadded.Location.POINTER_TYPE_ELEMENT_TYPE, "*", p);
afterSyntax(node, p);
return node;
}

@Override
public Cs visitTry(Cs.Try tryable, PrintOutputCapture<P> p) {
beforeSyntax(tryable, Space.Location.TRY_PREFIX, p);
p.append("try");
Expand All @@ -110,6 +110,7 @@ public Cs visitTry(Cs.Try tryable, PrintOutputCapture<P> p) {
}


@Override
public Cs visitTryCatch(Cs.Try.Catch catch_, PrintOutputCapture<P> p) {
beforeSyntax(catch_, Space.Location.CATCH_PREFIX, p);
p.append("catch");
Expand Down Expand Up @@ -248,6 +249,7 @@ public J visitOrderByClause(Cs.OrderByClause node, PrintOutputCapture<P> p) {
return node;
}

@Override
public J visitForEachVariableLoop(Cs.ForEachVariableLoop forEachLoop, PrintOutputCapture<P> p) {
beforeSyntax(forEachLoop, Space.Location.FOR_EACH_LOOP_PREFIX, p);
p.append("foreach");
Expand Down Expand Up @@ -306,6 +308,7 @@ protected <T extends J> void visitRightPadded(@Nullable JRightPadded<T> rightPad
}
}

@Override
public J visitSwitchExpression(Cs.SwitchExpression node, PrintOutputCapture<P> p) {
beforeSyntax(node, CsSpace.Location.SWITCH_EXPRESSION_PREFIX, p);
visitRightPadded(node.getPadding().getExpression(), CsRightPadded.Location.SWITCH_EXPRESSION_EXPRESSION, p);
Expand All @@ -315,6 +318,7 @@ public J visitSwitchExpression(Cs.SwitchExpression node, PrintOutputCapture<P> p
return node;
}

@Override
public J visitSwitchStatement(Cs.SwitchStatement node, PrintOutputCapture<P> p) {
beforeSyntax(node, CsSpace.Location.SWITCH_STATEMENT_PREFIX, p);
p.append("switch");
Expand All @@ -324,6 +328,7 @@ public J visitSwitchStatement(Cs.SwitchStatement node, PrintOutputCapture<P> p)
return node;
}

@Override
public J visitSwitchSection(Cs.SwitchSection node, PrintOutputCapture<P> p) {
beforeSyntax(node, CsSpace.Location.SWITCH_SECTION_PREFIX, p);
visit(node.getLabels(), p);
Expand All @@ -332,6 +337,7 @@ public J visitSwitchSection(Cs.SwitchSection node, PrintOutputCapture<P> p) {
return node;
}

@Override
public J visitUnsafeStatement(Cs.UnsafeStatement node, PrintOutputCapture<P> p) {
beforeSyntax(node, CsSpace.Location.UNSAFE_STATEMENT_PREFIX, p);
p.append("unsafe");
Expand All @@ -349,6 +355,7 @@ public J visitCheckedExpression(Cs.CheckedExpression node, PrintOutputCapture<P>
return node;
}

@Override
public J visitCheckedStatement(Cs.CheckedStatement node, PrintOutputCapture<P> p) {
beforeSyntax(node, CsSpace.Location.CHECKED_STATEMENT_PREFIX, p);
visit(node.getKeyword(), p);
Expand Down Expand Up @@ -376,6 +383,7 @@ public J visitRefType(Cs.RefType node, PrintOutputCapture<P> p) {
return node;
}

@Override
public J visitRangeExpression(Cs.RangeExpression node, PrintOutputCapture<P> p) {
beforeSyntax(node, CsSpace.Location.RANGE_EXPRESSION_PREFIX, p);
visitRightPadded(node.getPadding().getStart(), CsRightPadded.Location.RANGE_EXPRESSION_START, p);
Expand All @@ -385,6 +393,7 @@ public J visitRangeExpression(Cs.RangeExpression node, PrintOutputCapture<P> p)
return node;
}

@Override
public J visitFixedStatement(Cs.FixedStatement node, PrintOutputCapture<P> p) {
beforeSyntax(node, CsSpace.Location.FIXED_STATEMENT_PREFIX, p);
p.append("fixed");
Expand All @@ -394,6 +403,7 @@ public J visitFixedStatement(Cs.FixedStatement node, PrintOutputCapture<P> p) {
return node;
}

@Override
public J visitLockStatement(Cs.LockStatement node, PrintOutputCapture<P> p) {
beforeSyntax(node, CsSpace.Location.LOCK_STATEMENT_PREFIX, p);
p.append("lock");
Expand All @@ -403,6 +413,7 @@ public J visitLockStatement(Cs.LockStatement node, PrintOutputCapture<P> p) {
return node;
}

@Override
public J visitCasePatternSwitchLabel(Cs.CasePatternSwitchLabel node, PrintOutputCapture<P> p) {
beforeSyntax(node, CsSpace.Location.CASE_PATTERN_SWITCH_LABEL_PREFIX, p);
p.append("case");
Expand All @@ -414,6 +425,7 @@ public J visitCasePatternSwitchLabel(Cs.CasePatternSwitchLabel node, PrintOutput
return node;
}

@Override
public J visitDefaultSwitchLabel(Cs.DefaultSwitchLabel node, PrintOutputCapture<P> p) {
beforeSyntax(node, CsSpace.Location.DEFAULT_SWITCH_LABEL_PREFIX, p);
p.append("default");
Expand All @@ -423,6 +435,7 @@ public J visitDefaultSwitchLabel(Cs.DefaultSwitchLabel node, PrintOutputCapture<
return node;
}

@Override
public J visitSwitchExpressionArm(Cs.SwitchExpressionArm node, PrintOutputCapture<P> p) {
beforeSyntax(node, CsSpace.Location.SWITCH_EXPRESSION_ARM_PREFIX, p);
visit(node.getPattern(), p);
Expand Down Expand Up @@ -1374,7 +1387,7 @@ public J visitTypeParameterConstraintClause(Cs.TypeParameterConstraintClause typ
public J visitClassOrStructConstraint(Cs.ClassOrStructConstraint classOrStructConstraint, PrintOutputCapture<P> p)
{
beforeSyntax(classOrStructConstraint, CsSpace.Location.TYPE_PARAMETERS_CONSTRAINT_PREFIX, p);
p.append(classOrStructConstraint.getKind().equals(Cs.ClassOrStructConstraint.TypeKind.Class) ? "class" : "struct");
p.append(classOrStructConstraint.getKind() == Cs.ClassOrStructConstraint.TypeKind.Class ? "class" : "struct");
return classOrStructConstraint;
}

Expand Down Expand Up @@ -1420,9 +1433,8 @@ public J visit(@Nullable Tree tree, PrintOutputCapture<P> p) {
if (tree instanceof Cs) {
// re-route printing back up to groovy
return CSharpPrinter.this.visit(tree, p);
} else {
return super.visit(tree, p);
}
return super.visit(tree, p);
}

@Override
Expand Down
Loading
Loading