title: ClassCastException thrown even though there is no cast
body: <p>I've got a <code>HashMap&lt;ObjectId, Integer&gt;</code> in which I want to add a new entry.
  <code>ObjectId</code> is a <code>BSON</code> class which comes with the <code>MongoDB-Driver</code> in my case.</p>
  
  <pre><code> 1   @Expose private Map&lt;ObjectId, Integer&gt; usedPaths;
   2   
   3   public Project()
   4   {
   5      this.usedPaths = new HashMap&lt;&gt;();
   6   }
   7
   8   public void usePath(ObjectId someId, int pathId)
   9   {
  10      this.usedPaths.put(someId, pathId);
  11   }
  12
  13   public void debug()
  14   {
  15      usePath(new ObjectId("5bfd98a2c06178796e66c204"), 1);
  16   }
  </code></pre>
  
  <p>When I call the debug method, a <code>ClassCastException</code> is thrown:</p>
  
  <pre><code>    SCHWERWIEGEND: Servlet.service() for servlet [Jersey Web Application] in context with path [/KnowledgerServer] threw exception [java.lang.ClassCastException:
  org.bson.types.ObjectId cannot be cast to java.lang.String] with root cause
  java.lang.ClassCastException: org.bson.types.ObjectId cannot be cast to java.lang.String
      at org.bson.BasicBSONObject.put(BasicBSONObject.java:36)
      at de.knowledger.model.Project.usePath(Project.java:10)
      at de.knowledger.model.Project.debug(Project.java:15)
  </code></pre>
  
  <p>As far as I know and see I don't even try to cast an ObjectId to String, furthermore I'm never accessing the <code>BasicBSONObject</code> class in my code, <code>ObjectId</code> doesn't extend it either.</p>
  
  <p>Thanks in advance :)</p>