openrewrite / rewrite

Automated mass refactoring of source code.
https://docs.openrewrite.org
Apache License 2.0
2.09k stars 312 forks source link

LowerCasePackage should not rename packages when types in use has an instannce of the same package which is not part of the SourceSet #2146

Closed pway99 closed 2 years ago

pway99 commented 2 years ago

Problem

org.openrewrite.java.cleanup.LowercasePackage renames the package which results in a compile error since org.jenkinsci.plugins.DependencyTrack.Messages is a generated source file

https://github.com/jenkinsci/dependency-track-plugin/blob/2bef65595e0d9b8691a77119ec1fb2ab63f333ab/src/main/java/org/jenkinsci/plugins/DependencyTrack/PluginUtil.java#L45

Example diff

    * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.jenkinsci.plugins.DependencyTrack;
+package org.jenkinsci.plugins.dependencytrack;

 import edu.umd.cs.findbugs.annotations.NonNull;
 import edu.umd.cs.findbugs.annotations.Nullable;

Recipes in example diff:

pway99 commented 2 years ago

Closing this issue since generated sources should be re-generated with correct package name