What is the smallest, simplest way to reproduce the problem?
/*
* header comment will be removed from this groovy script, but not from similar java file
*/
import java.util.regex.Pattern
def pattern = Pattern.compile("pattern")
def dependency = new org.apache.maven.model.Dependency()
The shortening of FQNs has worked fine, but the comment at the top is gone. I've tried creating a similar java reproducer with all kinds of comment position and style variations, but the comment was never deleted in the java files.
Probably not. However, I believe I have seen code in other recipes to explicitly copy comments during replacement, so maybe I can find something that might match this problem.
What version of OpenRewrite are you using?
I am using
What is the smallest, simplest way to reproduce the problem?
What did you see instead?
The shortening of FQNs has worked fine, but the comment at the top is gone. I've tried creating a similar java reproducer with all kinds of comment position and style variations, but the comment was never deleted in the java files.
Are you interested in contributing a fix to OpenRewrite?
Probably not. However, I believe I have seen code in other recipes to explicitly copy comments during replacement, so maybe I can find something that might match this problem.