@@ -70,28 +70,6 @@ default FormatterStep filterByFile(SerializableFileFilter filter) {
7070 return new FilterByFileFormatterStep (this , filter );
7171 }
7272
73- /**
74- * Implements a FormatterStep in a strict way which guarantees correct and lazy implementation
75- * of up-to-date checks. This maximizes performance for cases where the FormatterStep is not
76- * actually needed (e.g. don't load eclipse setting file unless this step is actually running)
77- * while also ensuring that Gradle can detect changes in a step's settings to determine that
78- * it needs to rerun a format.
79- */
80- abstract class Strict <State extends Serializable > extends LazyForwardingEquality <State > implements FormatterStep {
81- private static final long serialVersionUID = 1L ;
82-
83- /**
84- * Implements the formatting function strictly in terms
85- * of the input data and the result of {@link #calculateState()}.
86- */
87- protected abstract String format (State state , String rawUnix , File file ) throws Exception ;
88-
89- @ Override
90- public final String format (String rawUnix , File file ) throws Exception {
91- return format (state (), rawUnix , file );
92- }
93- }
94-
9573 /**
9674 * @param name
9775 * The name of the formatter step.
@@ -151,8 +129,8 @@ static <RoundtripState extends Serializable, EqualityState extends Serializable>
151129 static <State extends Serializable > FormatterStep createLazy (
152130 String name ,
153131 ThrowingEx .Supplier <State > stateSupplier ,
154- ThrowingEx . Function <State , FormatterFunc > stateToFormatter ) {
155- return new FormatterStepImpl . Standard <> (name , stateSupplier , stateToFormatter );
132+ SerializedFunction <State , FormatterFunc > stateToFormatter ) {
133+ return createLazy (name , stateSupplier , SerializedFunction . identity () , stateToFormatter );
156134 }
157135
158136 /**
@@ -168,7 +146,7 @@ static <State extends Serializable> FormatterStep createLazy(
168146 static <State extends Serializable > FormatterStep create (
169147 String name ,
170148 State state ,
171- ThrowingEx . Function <State , FormatterFunc > stateToFormatter ) {
149+ SerializedFunction <State , FormatterFunc > stateToFormatter ) {
172150 Objects .requireNonNull (state , "state" );
173151 return createLazy (name , () -> state , stateToFormatter );
174152 }
0 commit comments