Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing jspecify dependency in refaster recipes documentation #297

Closed
Bananeweizen opened this issue Aug 19, 2024 · 4 comments
Closed

missing jspecify dependency in refaster recipes documentation #297

Bananeweizen opened this issue Aug 19, 2024 · 4 comments
Labels
bug Something isn't working question Further information is requested

Comments

@Bananeweizen
Copy link
Contributor

The main repo recently added jspecify: openrewrite/rewrite#4418. That leads to transitive dependencies. Creating a custom template based recipe following https://docs.openrewrite.org/authoring-recipes/refaster-recipes therefore fails with compile errors for the generated code, specifically the places using the jspecify annotations.

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

Just have a pom.xml with the contents from https://docs.openrewrite.org/authoring-recipes/refaster-recipes and a trivial recipe.

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

Compilation failure:
[ERROR] FooRecipes.java:[3,32] package org.jspecify.annotations does not exist
[ERROR] FooRecipes.java:[54,6] cannot find symbol
[ERROR]   symbol:   class NullMarked

To fix this, it's sufficient to add

		<dependency>
			<groupId>org.jspecify</groupId>
			<artifactId>jspecify</artifactId>
			<version>1.0.0</version>
		</dependency>

Are you interested in contributing a fix to OpenRewrite?

No. I'm not sure whether the documentation should be updated to just include that dependency (for both gradle and maven builds), or whether something can be done to explicitly re-export the dependency already from the rewrite core module.

Side note: If the documentation is going to be updated, then you may want to think about removing the lombok annotation processor from the same page. It's not needed AFAIK.

@Bananeweizen Bananeweizen added the bug Something isn't working label Aug 19, 2024
@timtebeek
Copy link
Contributor

The next release of openrewrite/rewrite will see rewrite-core bring in jspecify transitively; we figured that would be easiest, but still need to do that likely patch release somewhere this week. That would then also remove the need to add jspecify to the docs.

I'm not seeing lombok referenced on the page you linked above. Did I miss anything?

@timtebeek timtebeek added the question Further information is requested label Aug 19, 2024
@timtebeek
Copy link
Contributor

We just released a new version of OpenRewrite which should have solved this issue already:

Since I'm not seeing any lombok references I'm going to proactively close this issue. If I missed anything let me know!

@Bananeweizen
Copy link
Contributor Author

@timtebeek Thanks, I'm always surprised by how fast this projects reacts and releases new versions.

The lombok annotation processor is referenced here:

<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.32</version>
</path>
(that's the maven tab of https://docs.openrewrite.org/authoring-recipes/refaster-recipes). So the situation is

I'm not exactly sure what to make of that, but you may want to make it consistent, one way or another. :)

@timtebeek
Copy link
Contributor

Ah that makes sense why I didn't find it initially with a quick search, thanks! I think it might be best to keep it there, as we do recommend lombok for @Value annotations on our recipes elsewhere, and we'll want folks not to see that break when adding the refaster template processor. In isolation it's true that it's not necessary for Maven; in practice I think it'll likely end up being used anyway.

For Gradle there's less of a need to list lombok, as there's no need to edit the same maven compiler plugin configuration block if lombok were to be added to a Gradle project already using our refaster support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
Archived in project
Development

No branches or pull requests

2 participants