Skip to content

NullMarked on package-info.java is not added by "Recipe nullability best practices" #6324

@hkampbjorn

Description

@hkampbjorn

https://docs.openrewrite.org/recipes/java/recipes/recipenullabilitybestpractices

What version of OpenRewrite are you using?

Release version as suggested by the article

How are you running OpenRewrite?

I'm using the maven CLI as suggested by the article

 mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-rewrite:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.recipes.RecipeNullabilityBestPractices -Drewrite.exportDatatables=true

What is the smallest, simplest way to reproduce the problem?

A empty java class in a package without package-info.java file

What did you expect to see?

The description on the recipe says

Use JSpecify nullable annotations; drop Nonnull annotations;
use NullMarked on package-info.java instead.

I expected that the recipe created a package-info.java file with @NullMarked annotation

What did you see instead?

A package-info.java was not created, but all @NotNull annotations were removed

What is the full stack trace of any errors you encountered?

No errors

Are you interested in [contributing a fix to OpenRewrite]

Maybe

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions