Interface NoLambda

All Superinterfaces:
Serializable
All Known Subinterfaces:
LineEnding.Policy, SerializableFileFilter
All Known Implementing Classes:
LazyForwardingEquality, NoLambda.EqualityBasedOnSerialization

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.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    An implementation of NoLambda in which equality is based on the serialized representation of itself.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Returns a byte array representation of everything inside this SerializableFileFilter.
  • Method Details

    • toBytes

      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.)