public interface NoLambda extends Serializable
Marker interface to prevent lambda implementations of single-method interfaces that require serializability.
In order for Spotless to support up-to-date checks, all of its parameters must be Serializable so that entries can be written to file, and they must implement equals and hashCode correctly.
This interface and its standard implementation, NoLambda.EqualityBasedOnSerialization, are a quick way to accomplish these goals.
| Modifier and Type | Interface and Description |
|---|---|
static class |
NoLambda.EqualityBasedOnSerialization
An implementation of NoLambda in which equality is based on the serialized representation of itself.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
toBytes()
Returns a byte array representation of everything inside this
SerializableFileFilter. |
byte[] toBytes()
Returns a byte array representation of everything inside this SerializableFileFilter.
The main purpose of this method is to ensure one can’t instantiate this class with lambda expressions, which are notoriously difficult to serialize and deserialize properly. (See SerializableFileFilterImpl.SkipFilesNamed for an example of how to make a serializable subclass.)