title: Deserializing objects in Avro with Map<String,Object> field returns values with wrong class
body: <p>Trying to serialize objects that contain a Map instance in Apache Avro and the string keys of the Map are being deserialized but values are deserialized as class Object.</p>
  
  <p>Able to use a <code>GenericDatumWriter</code> with a <code>GenericData.Record</code> instance with the properties copied into it but need to serialize the objects directly without having to copy the Map properties into a temporary object just to serialize it.</p>
  
  <pre><code>public void test1() {
  
      TimeDot dot = new TimeDot();
      dot.lat = 12;
      dot.lon = 34;
      dot.putProperty("id", 1234);
      dot.putProperty("s", "foo");
      System.out.println("BEFORE: " + dot);
  
      // serialize
      ReflectDatumWriter&lt;TimeDot&gt; reflectDatumWriter = new ReflectDatumWriter&lt;&gt;(TimeDot.class);
      Schema schema = ReflectData.get().getSchema(TimeDot.class);
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      DataFileWriter&lt;TimeDot&gt; writer = new DataFileWriter&lt;&gt;(reflectDatumWriter).create(schema, out);
      writer.append(dot);
      writer.close();
  
      // deserialize
      ReflectDatumReader&lt;TimeDot&gt; reflectDatumReader = new ReflectDatumReader&lt;&gt;(TimeDot.class);
      ByteArrayInputStream inputStream = new ByteArrayInputStream(out.toByteArray());
      DataFileStream&lt;TimeDot&gt; reader = new DataFileStream&lt;&gt;(inputStream, reflectDatumReader);
      Object dot2 = reader.next();
      reader.close();
      System.out.println("AFTER: " + dot2);
  }
  
  public static class TimeDot {
      Map&lt;String, Object&gt; props = new LinkedHashMap&lt;&gt;();
      double lat;
      double lon;
  
      public void putProperty(String key, Object value) {
          props.put(key, value);
      }
  
      public String toString() {
          return "lat="+ lat +", lon="+ lon +", props="+props;
      }
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code> BEFORE: lat=12.0, lon=34.0, props={id=1234, s=foo}
  
   AFTER:  lat=12.0, lon=34.0, props={id=java.lang.Object@2b9627bc, s=java.lang.Object@65e2dbf3}
  </code></pre>
  
  <p>Next tried to manually create the Schema but that fails to serialize.</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.NullPointerException: in TimeDot
    in map in java.lang.Object null of java.lang.Object of map in field
    props of TimeDot</p>
  </blockquote>
  
  <pre><code>public void test2() throws IOException {        
  
      TimeDot dot = new TimeDot();
      dot.lat = 12;
      dot.lon = 34;
      dot.putProperty("id", 1234);
      dot.putProperty("s", "foo");
      System.out.println(dot);
  
      // create Schema
      List&lt;Schema.Field&gt; propFields = new ArrayList&lt;&gt;();
      propFields.add(new Schema.Field("id", Schema.create(Schema.Type.INT)));
      propFields.add(new Schema.Field("s", Schema.create(Schema.Type.STRING)));
      Schema propRecSchema = Schema.createRecord("Object",null,"java.lang",false,propFields);
      Schema propSchema = Schema.createMap(propRecSchema);
      List&lt;Schema.Field&gt; fields = new ArrayList&lt;&gt;(3);
      fields.add(new Schema.Field("lat", Schema.create(Schema.Type.DOUBLE)));
      fields.add(new Schema.Field("lon", Schema.create(Schema.Type.DOUBLE)));
      fields.add(new Schema.Field("props", propSchema));
      Schema schema = Schema.createRecord("TimeDot", null, "", false, fields);
      System.out.println("\nschema:\n" + schema);
  
      // serialize
      ReflectDatumWriter&lt;TimeDot&gt; reflectDatumWriter = new ReflectDatumWriter&lt;&gt;(TimeDot.class);
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      DataFileWriter&lt;TimeDot&gt; writer = new DataFileWriter&lt;&gt;(reflectDatumWriter).create(schema, out);
      writer.append(dot); // *** fails here &gt; NullPointerException ***
      writer.close();
  
      // deserialize
      ReflectDatumReader&lt;TimeDot&gt; reader = new ReflectDatumReader&lt;&gt;(schema);
      TimeDot dot2 = reader.read(null,
              DecoderFactory.get().binaryDecoder(out.toByteArray(), null));
      System.out.println(dot2);
  }
  </code></pre>