-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved support for large repositories #3118
Conversation
9abdf16
to
abc96dc
Compare
a7082ab
to
3b88694
Compare
a28d770
to
e38cf82
Compare
rewrite-core/src/main/java/org/openrewrite/internal/InMemoryLargeIterable.java
Outdated
Show resolved
Hide resolved
rewrite-core/src/test/java/org/openrewrite/RecipeLifecycleTest.java
Outdated
Show resolved
Hide resolved
A bunch of files just have import starting merges, which bloats this changeset. Can those be backed out so that the change is smaller and slightly more reasonable to review? |
…re they wont name collide with java tests
`Assertions#addTypesToSourceSet()` now no longer iterates over the `TypesInUse` of each compilation unit to add the `JavaType`s to the `JavaSourceSet` classpath.
…tion in MigrateRecipeToRewrite8
private static <J2 extends J> J2 parseAndBuild(@Language("java") String code, | ||
Class<J2> expected, | ||
Collection<Path> classpath) { | ||
JavaParser.Builder<? extends JavaParser, ?> builder = JavaParser.fromJavaVersion().classpath(classpath); | ||
|
||
J.CompilationUnit cu = builder.build() | ||
.parse(code) | ||
.findFirst() | ||
.orElseThrow(() -> new IllegalArgumentException("Could not parse as Java")); | ||
List<J2> parts = new ArrayList<>(1); | ||
new JavaVisitor<List<J2>>() { | ||
@Override | ||
public @Nullable J visit(@Nullable Tree tree, List<J2> j2s) { | ||
if (expected.isInstance(tree)) { | ||
//noinspection unchecked | ||
J2 j2 = (J2) tree; | ||
j2s.add(j2); | ||
return j2; | ||
} | ||
return super.visit(tree, j2s); | ||
} | ||
}.visit(cu, parts); | ||
|
||
return parts.get(0); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why not to make this a public API? This could be incredibly useful for synthesizing types.
rewrite-security
already has a utility to do something very similar:
# Conflicts: # rewrite-gradle/src/main/java/org/openrewrite/gradle/AddDependency.java
# Conflicts: # rewrite-java-test/src/test/java/org/openrewrite/java/JavaParserTest.java
This reverts commit 486c30e.
What happend to |
They were removed. There is a plan to bring back the functionality with an alternative mechanism. @jkschneide can better speak to this What's the use case you are looking to support? |
I get compilation errors when upgrading the dependencies on my custom recipes. |
What's changed
Parser#parseInputs
returnsStream
.Recipe#run
takesLargeIterable
argument.Recipe#visit
takesLargeIterable
argument.A lot more... blog to follow.