title: Why aren't generic types required when calling a constructor?
body: <p>I understand about type erasure surrounding generics, but I was still surprised to find that this code generates no error:</p>
  
  <pre><code>public class MyClass {
    private final HashMap&lt;ClassA,ClassB&gt; hashMap;
  
    public MyClass() {
      this.hashMap = new HashMap&lt;&gt;();
    }
  }
  </code></pre>
  
  <p>Mostly, I use the Java Standard version of Eclipse with Java 1.6, and the generic types are auto-filled when I select the auto-completed constructor name.  I'm now using the J2EE version of Eclipse and Java 1.7, and they're not.  The code compiles and it's fine.  It's completely redundant information, so I don't see why it should be required.  But it just feels wrong that you don't have to put it.</p>
  
  <p>Why is this not required, or am I totally missing something here?</p>