Skip to content

Style defined in <configLocation> is ignored by OrderImports / RemoveUnusedImports #1128

@mensinda

Description

@mensinda

What version of OpenRewrite are you using?

I am using

  • OpenRewrite v8.75.8
  • Maven/Gradle plugin v6.34.0

How are you running OpenRewrite?

I made a small reproducer repository: https://github.com/mensinda/quarkus-stuff/tree/rewrite1

The plugin is used in the optimize-imports profile of the pom.xml.

It references activeStyles and activeRecipes, which are both defined in the rewrite.yaml.

The goal is to sort the imports in the TestStuff class:

package root;

import root.foo.Foo;

import java.util.*;
import java.util.concurrent.*;

public class TestStuff {

    public static void main(String[] args) {
        // Content main
    }

}

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

git clone https://github.com/mensinda/quarkus-stuff.git
cd quarkus-stuff
git switch rewrite1

mvn -Poptimize-imports validate

What did you expect to see?

package root;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentSkipListMap;

import root.foo.Foo;

public class TestStuff {

    public static void main(String[] args) {
        // Content main
    }

}

What did you see instead?

package root;

import root.foo.Foo;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentSkipListMap;

public class TestStuff {

    public static void main(String[] args) {
        // Content main
    }

}

Are you interested in contributing a fix to OpenRewrite?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions