Skip to content

Missing "Add explicit Common Annotations dependencies" in "Migrate to Java 11" #455

@ghusta

Description

@ghusta

When trying to apply the recipe Migrate to Java 11, there is no recipe for adding missing dependencies for Common Annotations (JSR-250).
This dependency contains classes like javax.annotation.Generated or javax.annotation.security.RolesAllowed.
It's also mentioned in JEP 320, for your information.

What version of OpenRewrite are you using?

I am using

  • Maven plugin v5.28.0
  • rewrite-migrate-java v2.11.0

How are you running OpenRewrite?

With Maven plugin, like :

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.migrate.Java8toJava11

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

This code should compile with a JDK 11 :

import javax.annotation.Generated;

@Generated("xxx")
public class A {
}

What did you expect to see?

In Maven pom.xml :

        <!-- Common Annotations -->
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>

Or rather the jakarta variant :

        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <version>1.3.5</version>
        </dependency>

What did you see instead?

Previous dependency declaration is absent.

Are you interested in [contributing a fix to OpenRewrite]

Why not

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions