title: Contract Checking in Java - In Built? E.g. Hashcode/Equals
body: <p>Is there any in-built contract checking in Java e.g. for the contract between a hashcode and the equals function?</p>
  
  <p>For this question, let's stick with the hashcode/equals contract as an example, but I'm interested in contract checking in general. I have read in multiple places that equals and hashcode must satisfy a "contract" in Java:</p>
  
  <ul>
  <li>Equals must follow the three rules of an <a href="https://en.wikipedia.org/wiki/Equivalence_relation" rel="nofollow noreferrer">equivalence relation</a> and also must be consistent on repeated calls</li>
  <li>Equal objects implies equal hashcodes</li>
  </ul>
  
  <p>I understand the conditions, and they make sense to me. However, I'm wondering, is this just a contract that's written down on paper- essentially a strong guideline for developers to not write buggy code- or is it something that will be caught by Java as either a compile time or run time exception?</p>