Skip to content

Commit

Permalink
Add a default constructor for test only to pass testing in Java recip…
Browse files Browse the repository at this point in the history
…e guide. (#326)

* Add a default constructor for test only to pass testing.

Signed-off-by: Addo.Zhang <[email protected]>

* Remove `@TestOnly` annotations from Java recipe doc

To minimize what folks need on the classpath.

---------

Signed-off-by: Addo.Zhang <[email protected]>
Co-authored-by: Tim te Beek <[email protected]>
  • Loading branch information
addozhang and timtebeek authored Nov 26, 2024
1 parent 0f7594d commit 7a0a16b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/authoring-recipes/writing-a-java-refactoring-recipe.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public class SayHelloRecipe extends Recipe {
@NonNull
String fullyQualifiedClassName;

public SayHelloRecipe() {
fullyQualifiedClassName = "";
}

// All recipes must be serializable. This is verified by RewriteTest.rewriteRun() in your tests.
@JsonCreator
public SayHelloRecipe(@NonNull @JsonProperty("fullyQualifiedClassName") String fullyQualifiedClassName) {
Expand Down Expand Up @@ -136,6 +140,10 @@ public class SayHelloRecipe extends Recipe {
return fullyQualifiedClassName;
}

public SayHelloRecipe() {
fullyQualifiedClassName = "";
}

// All recipes must be serializable. This is verified by RewriteTest.rewriteRun() in your tests.
@JsonCreator
public SayHelloRecipe(@NonNull @JsonProperty("fullyQualifiedClassName") String fullyQualifiedClassName) {
Expand Down

0 comments on commit 7a0a16b

Please sign in to comment.