title: NotSerializableException on anonymous class
body: <p>I have an interface for filtering items:</p>
  
  <pre><code>public interface KeyValFilter extends Serializable {
      public static final long serialVersionUID = 7069537470113689475L;
      public boolean acceptKey(String iKey, Iterable&lt;String&gt; iValues);
      public boolean acceptValue(String iKey, String value);
  }
  </code></pre>
  
  <p>and a class containing a member of type <code>KeyValFilter</code>.</p>
  
  <pre><code>public class KeyValFilterCollector extends KeyValCollectorSkeleton {
      private static final long serialVersionUID = -3364382369044221888L;
      KeyValFilter filter;
      public KeyValFilterCollector(KeyValFilter filter) {
          this.filter=filter;
      }
  }
  </code></pre>
  
  <p>When I try to initiate the <code>KeyValFilterCollector</code> with an anonymous class implementing <code>KeyValFilter</code>:</p>
  
  <pre><code>new KeyValFilterCollector(new KeyValFilter() {
          private static final long serialVersionUID = 7069537470113689475L;
          public boolean acceptKey(String iKey, Iterable&lt;String&gt; iValues) {
              for (String value : iValues) {
                  if (value.startsWith("1:"))
                          return true;
              }
              return false;
          }
          public boolean acceptValue(String iKey, String value) {
              return value.startsWith("0:");
          }
  });
  </code></pre>
  
  <p>I get an exception: <code>Exception in thread "main" java.io.NotSerializableException</code>.</p>
  
  <p>How do I make the anonymous class I wrote Serializable?</p>