title: Can an interface somehow prevent lambda expression implementations?
body: <p><strong>Background</strong></p>
  
  <p>I am exposing the following interface as part of an API:</p>
  
  <pre><code>public interface Pasture {
      /**
       * @param t         The time of the visit (as measured from optimization starting point).
       * @param tLast     The time of the preceding visit (as measured from optimization starting point).
       * @return          The expected reward that will be reaped by visiting under the given conditions.
       */
      double yield(long t, long tLast);    
  }
  </code></pre>
  
  <p>The client passes me models of "pastures" as objects implementing this interface. Each object represents one pasture.</p>
  
  <p>On my side of the API, I keep track of "visits" to these objects at various times, then invoke <code>pasture.yield(time, lastVisitTime)</code> when I need to know how much the pasture would have produced in the mean time.</p>
  
  <p>The problem arises that this interface can be implemented on the client side as a lambda expression, and <a href="https://stackoverflow.com/questions/22776511/java-8-lambda-expression-identity-contract">apparently each lambda expression instantiation does not necessarily create a new object with a new identity</a>, which is what I rely on in order to keep track of which pastures were visited at what times.</p>
  
  <p><strong>Question</strong></p>
  
  <p>Is there a way of preventing the interface from being implemented as a lambda expression, forcing instead that the client implements it as an anonymous class. Adding a dummy method to it would do the trick, of course, but that would be arbitrary and untidy in my opinion. Is there another way?</p>