openrewrite / openrewrite/rewrite

CountToUseStarImport settings not working

Open
#5,885 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
3.7k
Forks
570
Avg merge
13h 12m
Merged PRs (30d)
261

Description

What version of OpenRewrite are you using?

org.openrewrite.rewrite Gradle plugin, version 7.12.1.

How are you running OpenRewrite?

Running it from IntelliJ with the rewriteRun task, and from the command line with ./gradlew rewriteRun

Single module project.

Gradle plugin.

Can you share your configuration so that we can rule out any configuration issues?

Yes, see attached zip.

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

Unzip the attached zip, create a command window on the wildcarded-imports project, and execute ./gradlew rewriteRun

What did you expect to see?

wildcarded-imports/src/main/java/org/foo/bar/moo/hoot/model/Port.java should not have import com.fasterxml.jackson.annotation.*;

Also, the imports should be ordered, and separated by blank lines, as specified in rewrite.yml.

What did you see instead?

Wildcarded imports were not expanded.

Imports were not ordered or separated.

It's not clear that openrewrite did anything.

Is this a bug in openrewrite (seems unlikely), or is something wrong with our rewrite.yml? If so, what?

What is the full stack trace of any errors you encountered?

No errors. It runs fine. It just doesn't exhibit the behavior we expected.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by unpacking the attached reproduction and running ./gradlew rewriteRun in the wildcarded-imports project. Inspect rewrite.yml and wildcarded-imports/src/main/java/org/foo/bar/moo/hoot/model/Port.java to verify the configured import recipes and their expected scope. Done means wildcard imports are expanded, and imports are ordered and separated as specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.