Skip to content

Instantly share code, notes, and snippets.

package dev.bitflippers;
import org.junit.jupiter.api.Test;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;
import static org.openrewrite.java.Assertions.java;
public class TestAddDummyAnnotation implements RewriteTest {
@Override
@Bit-Flipper
Bit-Flipper / AddDummyAnnotation.java
Created April 11, 2024 11:05
OpenRewrite recipe to demonstrate testing cycle errors
package dev.bitflippers;
import com.google.common.annotations.Beta;
import lombok.EqualsAndHashCode;
import org.openrewrite.ExecutionContext;
import org.openrewrite.Recipe;
import org.openrewrite.TreeVisitor;
import org.openrewrite.java.AnnotationMatcher;
import org.openrewrite.java.JavaIsoVisitor;
import org.openrewrite.java.JavaParser;

GroqDoc Scanning Recipe Example of Bad Generated Javadoc

 public interface MemberAccessValueStack {
 
+    /**
+     * Sets a set of {@link Pattern}s that represent the properties to be excluded.
+     * Any attempt to get or set a property that matches any of the patterns will
+     * result in an {@link UnsupportedOperationException}.
+     *

GroqDoc Scanning Recipe Example Generated Javadoc

 public interface ClassFinderFactory {
 
+    /**
+     * Creates a new {@link ClassFinder} instance using a specified {@link ClassLoaderInterface}, a collection of URLs, a flag indicating
+     * whether or not to extract base interfaces, a set of protocols to include in the search, and a test for filtering class names.
+     *
+     * @param classLoaderInterface A {@link ClassLoaderInterface} that will be used to load classes that are found by the {@link ClassFinder}.

GroqDoc Example of Bad Generated Javadoc

 public interface TagGenerator extends TagHandler {
 
+    /**
+     * Generates the tag.
+     *
+     * @throws IOException if an I/O error occurs
+ * @author Your Name

GroqDoc Recipe Example Generated Javadoc

 public interface Storage extends Serializable {
+	/**
+	 * Retrieves a single entity from the storage system by its class and id.
+	 *
+	 * @param entityClass The class of the entity to retrieve.
+	 * @param id The id of the entity to retrieve.
+	 * @return The entity with the given class and id, or null if no such entity exists.
package dev.bitflippers;
import org.junit.jupiter.api.Test;
import org.openrewrite.java.JavaParser;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;
import static org.openrewrite.java.Assertions.java;
public class TestDuplicateClass implements RewriteTest {
package dev.bitflippers;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.openrewrite.Cursor;
import org.openrewrite.ExecutionContext;
package org.example;
import org.junit.jupiter.api.Test;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;
import static org.openrewrite.java.Assertions.java;
public class TestJavaGetterToLombokGetter implements RewriteTest {
@Override
package org.example;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Value;
import org.openrewrite.ExecutionContext;
import org.openrewrite.Recipe;
import org.openrewrite.TreeVisitor;
import org.openrewrite.java.JavaIsoVisitor;
import org.openrewrite.java.JavaParser;