Skip to content
Discussion options

You must be logged in to vote

For visibility, here's the solution using dependsOn:

class RecipeTest implements RewriteTest {

    @Override
    public void defaults(RecipeSpec spec) {
        spec
                .parser(JavaParser.fromJavaVersion()
                        .dependsOn("package com.old; public class OldType {}"))
                .recipes(new FindMissingTypes(false),
                        new ChangeType("com.old.OldType", "com.new.NewType", false))
                .typeValidationOptions(TypeValidation.builder().allowMissingType(ignore -> true).build());
    }

    @Test
    void testTypeChangeInClass() {
        rewriteRun(
                java("""
                        package com.example;

        …

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@timtebeek
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by timtebeek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants