title: Why is Firebase silently converting my Longs to Integers?
body: <p>Under certain circumstances, I am seeing some surprising behavior with Firebase's Java API: it's returning instances of java.lang.Integer when I'm dealing with java.lang.Long. Here's an example JUnit test case:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class LongsTest extends TestCase {
    public void testSetLong() throws Exception {
      Firebase firebase = new Firebase("http://www.example.com");
      firebase.addChildEventListener(new ChildEventListener() {
        @Override public void onChildRemoved(DataSnapshot s) {}
        @Override public void onChildMoved(DataSnapshot s, String p) {}
        @Override public void onChildChanged(DataSnapshot s, String p) {}
        @Override public void onChildAdded(DataSnapshot s, String p) {
          Map&lt;String, Object&gt; map = s.getValue(new GenericTypeIndicator&lt;Map&lt;String,Object&gt;&gt;() {});
          System.out.println(map.get("key").getClass());
        }
        @Override public void onCancelled() {}
      });
      Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;();
      map.put("key", new Long(15));
      firebase.child("foo").setValue(map);
      Thread.sleep(1000);
    }
  }
  </code></pre>
  
  <p>Running this code prints out <code>class java.lang.Integer</code>! Firebase obviously still knows I have a Long somewhere in its code, because changing the body of <code>onChildAdded</code> to this:</p>
  
  <pre class="lang-java prettyprint-override"><code>Map&lt;String,Object&gt; map2 = (Map&lt;String,Object&gt;)s.getValue();
  System.out.println(map2.get("key").getClass())
  </code></pre>
  
  <p>Correctly prints out <code>class java.lang.Long</code>. What's going on here?</p>