Skip to content

ImportOrderStep reads its config file eagerly, rather than lazily #218

Closed
@nedtwigg

Description

@nedtwigg

public static FormatterStep createFromFile(File importsFile) {
Objects.requireNonNull(importsFile);
return createFromOrderImpl(getImportOrder(importsFile));
}

It shouldn't read the file until its state is calculated. First discovered in #217.

Activity

jbduncan

jbduncan commented on Mar 7, 2018

@jbduncan
Member

I suspect the easiest fix would be to make getImportOrder return a lazy Supplier<List<String>>.

jbduncan

jbduncan commented on Mar 7, 2018

@jbduncan
Member

...and then memoize the result of this supplier somehow.

nedtwigg

nedtwigg commented on Mar 8, 2018

@nedtwigg
MemberAuthor

FormatterStep.createLazy handles the memoization for you.

added a commit that references this issue on Feb 10, 2019

Fix #218 - `ImportOrderStep.createFromFile` is now lazy.

3005544
jbduncan

jbduncan commented on Feb 11, 2019

@jbduncan
Member

Cheers for tackling this, @nedtwigg. :)

nedtwigg

nedtwigg commented on Feb 12, 2019

@nedtwigg
MemberAuthor

Published in 3.18.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jbduncan@nedtwigg

        Issue actions

          ImportOrderStep reads its config file eagerly, rather than lazily · Issue #218 · diffplug/spotless