Skip to content

Commit

Permalink
Use newlines in JavaToCsharp.compilationUnit for cleaner future diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Nov 28, 2024
1 parent 2feec02 commit 8c3d41a
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/test/java/org/openrewrite/staticanalysis/JavaToCsharp.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,27 @@
import java.util.List;
import java.util.stream.Collectors;

import static java.util.stream.Collectors.toList;

public class JavaToCsharp {

public static Cs.CompilationUnit compilationUnit(J.CompilationUnit cu) {
return new Cs.CompilationUnit(cu.getId(), cu.getPrefix(), cu.getMarkers(), cu.getSourcePath(),
cu.getFileAttributes(), cu.getCharset().name(), cu.isCharsetBomMarked(), cu.getChecksum(), List.of(), List.of(), List.of(), cu.getClasses().stream().map(Statement.class::cast).map(cd -> JRightPadded.build(cd)).collect(Collectors.toList()), cu.getEof());
return new Cs.CompilationUnit(
cu.getId(),
cu.getPrefix(),
cu.getMarkers(),
cu.getSourcePath(),
cu.getFileAttributes(),
cu.getCharset().name(),
cu.isCharsetBomMarked(),
cu.getChecksum(),
List.of(),
List.of(),
List.of(),
cu.getClasses().stream()
.map(Statement.class::cast)
.map(JRightPadded::build)
.collect(toList()),
cu.getEof());
}
}

0 comments on commit 8c3d41a

Please sign in to comment.