-
Notifications
You must be signed in to change notification settings - Fork 502
Closed
openrewrite/rewrite-migrate-java
#955Labels
bugSomething isn't workingSomething isn't working
Description
What version of OpenRewrite are you using?
rewrite-maven-plugin : 6.1.0
rewrite-migrate-java : 3.2.0
How are you running OpenRewrite?
Standalone Maven project
<profile>
<id>rewrite</id>
<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>6.1.0</version>
<executions>
<execution>
<goals>
<goal>run</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
<configuration>
<exportDatatables>true</exportDatatables>
<activeRecipes>
<recipe>org.openrewrite.java.migrate.lombok.UseLombokGetter</recipe>
<recipe>org.openrewrite.java.migrate.lombok.UseLombokSetter</recipe>
</activeRecipes>
</configuration>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-migrate-java</artifactId>
<version>3.2.0</version>
</dependency>
</dependencies>
</plugin>
What is the smallest, simplest way to reproduce the problem?
Example is using Lombok + Spring.
@Service
@Slf4j
public class MyService {
@Getter
private String configuration;
@Getter
private MyRepository repository;
@Value("${spring.application.name}")
public void setConfiguration(String configuration) {
this.configuration = configuration;
}
@Autowired
public void setRepository(MyRepository repository) {
this.repository = repository;
}
}What did you expect to see?
@Service
@Slf4j
public class MyService {
@Getter
@Setter
@Value("${spring.application.name}")
private String configuration;
@Getter
@Setter
@Autowired
private MyRepository repository;
}What did you see instead?
@Service
@Slf4j
public class MyService {
@Getter
@Setter
private String configuration;
@Getter
@Setter
private MyRepository repository;
}The recipe deletes the setter method but it also deletes given annotations.
The recipe should delete the setter if an annotation is present or moves the annotation to the field - if possible.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done