openrewrite / openrewrite/rewrite
Add import should not remove preceding comment
Open
Nobody has claimed this yet.
bug
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 570
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
Description
Example diff
From: src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java
package org.apache.maven.report.projectinfo;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
+import org.apache.commons.lang3.StringUtils;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.model.MailingList;
import org.apache.maven.model.Model;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.Mojo;
import org.codehaus.plexus.i18n.I18N;
-import org.codehaus.plexus.util.StringUtils;
import java.net.URI;
import java.util.ArrayList;
Recipes in example diff:
org.openrewrite.java.ChangeMethodTargetToStatic
References:
- View original result
- Recipe ID:
org.openrewrite.java.ChangeMethodTargetToStatic - Recipe Name:
Change method target to static - Repository:
apache/maven-project-info-reports-plugin/master - Created at Mon Apr 03 2023 21:38:35 GMT+0200 (Central European Summer Time)
This issue originally created by @timtebeek on: https://github.com/moderneinc/support-public/issues/37
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the org.openrewrite.java.ChangeMethodTargetToStatic recipe and reproduce its result using src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java. Trace how the recipe handles the import change and preceding comment, then add a regression test demonstrating that the comment remains and run the relevant Java recipe tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100