Skip to content

Plugin + Intellij optimize Import for static imports out of order  #200

Open
@thespags

Description

@thespags

If the formating is different than expected:

  • make sure you are comparing with the same Eclipse version
  • provide a code example (both from Eclipse and from IntelliJ) and settings files

Define this class,

package somePackage;

import static somePackage.SomeZClass;
import static somePackage.SomeEnum.Bar;

import java.util.function.Supplier;

// Use as a type argument to be a static import.
public class Foo implements Supplier<SomeZClass> {

    public void someMethod() {
        SomeEnum e = Bar;
    }

    @Override
    public SomeZClass get() {
        return null;
    }

    public enum SomeEnum {
        Bar
    }

    // Add Z this should be sorted after SomeEnum
    public static class SomeZClass {

    }
}

What steps will reproduce the issue?

Run optimize import in the IDE.

What is the expected result?

import static somePackage.SomeEnum.Bar;
import static somePackage.SomeZClass;

What happens instead?

import static somePackage.SomeZClass;
import static somePackage.SomeEnum.Bar;

Paste information about IDE and OS (it can be copied from Help | About dialog).

Intellij Version: 193.6015.39
Using Plugin with Eclipse Format: 4.5.1+

Note: mvn spotless:apply uses the expected behavior, and turning off the eclipse formatter plugin then Intellij will optimize the import with the expected behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions