title: Java type erasure: How is type safety ensured?
body: <p>As per type erasure mechanism in Java generics, a method:</p>
  <pre><code>boolean add(E e);
  </code></pre>
  <p>..gets compiled to</p>
  <pre><code>boolean add(Object e);
  </code></pre>
  <p>But then how is type safety ensured? As add now takes Object, I can pass String, Integer, Employee etc as all are sub-types of Object.</p>