@SuppressWarnings("unchecked") private T readReference(Class<T> type,BufferInput<?> buffer,Serializer serializer){
  ReferencePool<?> pool=pools.get(type);
  if (pool == null) {
    Constructor<?> constructor=constructorMap.get(type);
    if (constructor == null) {
      try {
        constructor=type.getDeclaredConstructor(ReferenceManager.class);
        constructor.setAccessible(true);
        constructorMap.put(type,constructor);
      }
 catch (      NoSuchMethodException e) {
        throw new SerializationException("failed to instantiate reference: must provide a single argument constructor",e);
      }
    }
    pool=new ReferencePool<>(createFactory(constructor));
    pools.put(type,pool);
  }
  T object=(T)pool.acquire();
  object.readObject(buffer,serializer);
  return object;
}

@ SuppressWarnings ( "unchecked" ) private T readReference ( Class < T > type , BufferInput < ? > buffer , Serializer serializer ) { ReferencePool < ? > pool = pools . get ( type ) ; if ( pool == null ) { Constructor < ? > constructor = constructorMap . get ( type ) ; if ( constructor == null ) { try { constructor = type . getDeclaredConstructor ( ReferenceManager . class ) ; constructor . setAccessible ( true ) ; constructorMap . put ( type , constructor ) ; } catch ( NoSuchMethodException e ) { throw new SerializationException ( "failed to instantiate reference: must provide a single argument constructor" , e ) ; } } pool = new ReferencePool < > ( createFactory ( constructor ) ) ; pools . put ( type , pool ) ; } T object = ( T ) pool . acquire ( ) ; object . readObject ( buffer , serializer ) ; return object ; }
reads an object reference .
