11/*
2- * Copyright 2016 DiffPlug
2+ * Copyright 2016-2024 DiffPlug
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1616package com .diffplug .spotless .sql ;
1717
1818import java .io .File ;
19- import java .io .Serializable ;
2019
2120import com .diffplug .spotless .FileSignature ;
2221import com .diffplug .spotless .FormatterFunc ;
@@ -32,24 +31,14 @@ public class DBeaverSQLFormatterStep {
3231 private DBeaverSQLFormatterStep () {}
3332
3433 public static FormatterStep create (Iterable <File > files ) {
35- return FormatterStep .createLazy (NAME ,
36- () -> new State ( files ) ,
37- State ::createFormat );
34+ return FormatterStep .create (NAME , FileSignature . promise ( files ) ,
35+ FileSignature . Promised :: get ,
36+ DBeaverSQLFormatterStep ::createFormat );
3837 }
3938
40- static final class State implements Serializable {
41- private static final long serialVersionUID = 1L ;
42-
43- final FileSignature settingsSignature ;
44-
45- State (final Iterable <File > settingsFiles ) throws Exception {
46- this .settingsSignature = FileSignature .signAsList (settingsFiles );
47- }
48-
49- FormatterFunc createFormat () throws Exception {
50- FormatterProperties preferences = FormatterProperties .from (settingsSignature .files ());
51- DBeaverSQLFormatter dbeaverSqlFormatter = new DBeaverSQLFormatter (preferences .getProperties ());
52- return dbeaverSqlFormatter ::format ;
53- }
39+ private static FormatterFunc createFormat (FileSignature settings ) {
40+ FormatterProperties preferences = FormatterProperties .from (settings .files ());
41+ DBeaverSQLFormatter dbeaverSqlFormatter = new DBeaverSQLFormatter (preferences .getProperties ());
42+ return dbeaverSqlFormatter ::format ;
5443 }
5544}
0 commit comments