Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
nedtwigg opened this issue Mar 7, 2018 · 5 comments
Closed

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

nedtwigg opened this issue Mar 7, 2018 · 5 comments

Comments

@nedtwigg
Copy link
Member

nedtwigg commented Mar 7, 2018

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.

@nedtwigg nedtwigg added the bug label Mar 7, 2018
@jbduncan
Copy link
Member

jbduncan commented Mar 7, 2018

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

@jbduncan
Copy link
Member

jbduncan commented Mar 7, 2018

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

@nedtwigg
Copy link
Member Author

nedtwigg commented Mar 8, 2018

FormatterStep.createLazy handles the memoization for you.

@jbduncan
Copy link
Member

Cheers for tackling this, @nedtwigg. :)

@nedtwigg
Copy link
Member Author

Published in 3.18.0

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants