Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/main/resources/META-INF/rewrite/jspecify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.jspecify.JSpecifyBestPractices
displayName: JSpecify best practices
description: >-
Apply JSpecify best practices, such as migrating off of alternatives, and adding missing `@Nullable` annotations.
tags:
- java
recipeList:
- org.openrewrite.java.jspecify.MigrateToJSpecify
- org.openrewrite.staticanalysis.AnnotateNullableMethods
- org.openrewrite.staticanalysis.AnnotateNullableParameters
- org.openrewrite.staticanalysis.NullableOnMethodReturnType

---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.jspecify.MigrateToJspecify
name: org.openrewrite.java.jspecify.MigrateToJSpecify
displayName: Migrate to JSpecify
description: >-
This recipe will migrate to JSpecify annotations from various other nullability annotation standards.
Expand All @@ -27,7 +40,7 @@ recipeList:
- org.openrewrite.java.jspecify.MigrateFromJakartaAnnotationApi
- org.openrewrite.java.jspecify.MigrateFromJetbrainsAnnotations
# Running the following recipe on current versions of Spring can cause Spring to misunderstand a nullable field.
# For instance, a custom Prometheus scrape endpoint with @Nullable Set<String> includedNames will fail if
# For instance, a custom Prometheus scrape endpoint with @Nullable Set<String> includedNames will fail if
# includedNames is null and if @Nullable is @org.jspecify.annotations.Nullable.
# - org.openrewrite.java.jspecify.MigrateFromSpringFrameworkAnnotations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
import static org.openrewrite.maven.Assertions.pomXml;

@SuppressWarnings("NotNullFieldNotInitialized")
class MigrateToJspecifyTest implements RewriteTest {
class JSpecifyBestPracticesTest implements RewriteTest {

@Override
public void defaults(RecipeSpec spec) {
spec
.recipeFromResource("/META-INF/rewrite/jspecify.yml", "org.openrewrite.java.jspecify.MigrateToJspecify")
.recipeFromResource("/META-INF/rewrite/jspecify.yml", "org.openrewrite.java.jspecify.JSpecifyBestPractices")
.parser(JavaParser.fromJavaVersion().classpath("jsr305", "jakarta.annotation-api", "annotations", "spring-core"));
}

Expand Down