Skip to content

Commit 7408f38

Browse files
committed
Add docs for the SerializeToByteArrayHack.
1 parent 0c66cb0 commit 7408f38

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/src/main/java/com/diffplug/spotless/yaml/SerializeToByteArrayHack.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@
2121

2222
import com.diffplug.spotless.FormatterStep;
2323

24+
/**
25+
* This step is a flag which marks that `ConfigurationCacheHackList` should
26+
* serialize each item individually into `byte[]` array, rather than using normal
27+
* serialization.
28+
*
29+
* The reason to use this is if you are using `toggleOffOn` *and* two kinds of
30+
* google-java-format (e.g. one for format and the other for imports), then
31+
* problems with Java's handling of object graphs will cause your up-to-date checks
32+
* to always fail. `CombinedJavaFormatStepTest` recreates this situation. By adding
33+
* this step, it will trigger this workaround which fixes the up-to-dateness bug.
34+
*
35+
* But, turning it on will break all `custom` steps that use Groovy closures. So
36+
* by default you get regular serialization. If you're using `toggleOffOn` and having
37+
* problems with up-to-dateness, then adding this step can be a workaround.
38+
*/
2439
public class SerializeToByteArrayHack implements FormatterStep {
2540
private static final long serialVersionUID = 8071047581828362545L;
2641

0 commit comments

Comments
 (0)