diff --git a/Makefile.am b/Makefile.am
index ff97538..cebfc6f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
 ACLOCAL_AMFLAGS = -I ./aclocal
 
-SUBDIRS = compiler/cpp lib if test
+SUBDIRS = compiler/cpp lib test
 ## Don't run make dist from a subversion working copy
 ## because it will pull in your .svn directories.
 EXTRA_DIST = bootstrap.sh cleanup.sh doc test tutorial contrib \
diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc
index 318c36b..6be3504 100644
--- a/compiler/cpp/src/generate/t_cpp_generator.cc
+++ b/compiler/cpp/src/generate/t_cpp_generator.cc
@@ -40,9 +40,6 @@
     iter = parsed_options.find("include_prefix");
     use_include_prefix_ = (iter != parsed_options.end());
 
-    iter = parsed_options.find("reflection_limited");
-    gen_reflection_limited_ = (iter != parsed_options.end());
-
     out_dir_base_ = "gen-cpp";
   }
 
@@ -94,10 +91,6 @@
   void generate_process_function  (t_service* tservice, t_function* tfunction);
   void generate_function_helpers  (t_service* tservice, t_function* tfunction);
 
-  void generate_service_limited_reflector(t_service* tservice);
-  bool generate_type_limited_reflection(t_type* ttype, std::string target);
-  bool generate_simple_type_limited_reflection(std::ostream& out, t_type* ttype, std::string target);
-
   /**
    * Serialization constructs
    */
@@ -195,11 +188,6 @@
   std::string get_include_prefix(const t_program& program) const;
 
   /**
-   * True iff we should generate limited reflectors for services.
-   */
-  bool gen_reflection_limited_;
-
-  /**
    * True iff we should generate local reflection metadata for TDenseProtocol.
    */
   bool gen_dense_;
@@ -266,7 +254,6 @@
   // Include base types
   f_types_ <<
     "#include <Thrift.h>" << endl <<
-    "#include <reflection_limited_types.h>" << endl <<
     "#include <protocol/TProtocol.h>" << endl <<
     "#include <transport/TTransport.h>" << endl <<
     endl;
@@ -1336,10 +1323,6 @@
 
     generate_function_helpers(tservice, *f_iter);
   }
-
-  if (gen_reflection_limited_) {
-    generate_service_limited_reflector(tservice);
-  }
 }
 
 /**
@@ -1359,21 +1342,6 @@
   f_header_ <<
     indent() << "virtual ~" << service_name_ << "If() {}" << endl;
 
-  if (gen_reflection_limited_) {
-    f_header_ <<
-      indent() << "static void getStaticLimitedReflection" <<
-      "(apache::thrift::reflection::limited::Service & _return);" << endl;
-    // TODO(dreiss): Uncomment and test this if we decide we need
-    // a virtual function with this effect.
-    //f_header_ <<
-    //  indent() << "virtual void getVirtualLimitedReflection" <<
-    //  "(apache::thrift::reflection::limited::Service & _return) ";
-    //scope_up(f_header_);
-    //f_header_ <<
-    //  indent() << "getStaticLimitedReflection(_return);" << endl;
-    //scope_down(f_header_);
-  }
-
   vector<t_function*> functions = tservice->get_functions();
   vector<t_function*>::iterator f_iter;
   for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
@@ -2158,166 +2126,6 @@
 }
 
 /**
- * Helper function for generate_service_limited_reflector.
- * Generates a reflection of a single simple type.
- *
- * @param ttype  The type to reflect
- * @param target  The name of the lvalue to reflect onto
- * @return  true iff the type really is simple
- *
- * Note: don't let this function output anything unless it is going to return true.
- */
-bool t_cpp_generator::generate_simple_type_limited_reflection(ostream & out, t_type* ttype, string target) {
-  if (ttype->is_base_type()) {
-    string type;
-    switch (((t_base_type*)ttype)->get_base()) {
-      case t_base_type::TYPE_VOID   : type = "T_VOID;"   ; break;
-      case t_base_type::TYPE_STRING : type = "T_STRING;" ; break;
-      case t_base_type::TYPE_BOOL   : type = "T_BOOL;"   ; break;
-      case t_base_type::TYPE_BYTE   : type = "T_BYTE;"   ; break;
-      case t_base_type::TYPE_I16    : type = "T_I16;"    ; break;
-      case t_base_type::TYPE_I32    : type = "T_I32;"    ; break;
-      case t_base_type::TYPE_I64    : type = "T_I64;"    ; break;
-      case t_base_type::TYPE_DOUBLE : type = "T_DOUBLE;" ; break;
-      default: return false;
-    }
-    out << indent() << target << ".ttype = " << type << endl;
-    return true;
-  }
-
-  if (ttype->is_enum()) {
-    out <<
-      indent() << target << ".ttype = T_ENUM;" << endl <<
-      indent() << target << ".name = \"" << ttype->get_name() << "\";" << endl;
-  }
-
-  if (ttype->is_struct()) {
-    out <<
-      indent() << target << ".ttype = T_STRUCT;" << endl <<
-      indent() << target << ".name = \"" << ttype->get_name() << "\";" << endl;
-    return true;
-  }
-
-  return false;
-}
-
-/**
- * Helper function for generate_service_limited_reflector.
- * Generates a reflection of a single type.
- *
- * @param ttype  The type to reflect
- * @param target  The name of the lvalue to reflect onto
- */
-bool t_cpp_generator::generate_type_limited_reflection(t_type* ttype, string target) {
-  bool is_simple = generate_simple_type_limited_reflection(f_service_, ttype, target + ".simple_type");
-  if (is_simple) {
-    f_service_ <<
-      indent() << target << ".is_container = false;" << endl <<
-      indent() << target << ".__isset.simple_type = true;" << endl;
-    return true;
-  }
-
-  ostringstream out;
-
-  out <<
-    indent() << target << ".is_container = true;" << endl <<
-    indent() << target << ".__isset.container_type = true;" << endl <<
-    indent() << target << ".container_type.ttype = ";
-
-  if (ttype->is_list()) out << "T_LIST;" << endl;
-  if (ttype->is_set())  out << "T_SET;"  << endl;
-  if (ttype->is_map())  out << "T_MAP;"  << endl;
-
-  bool reflected = false;
-
-  if (ttype->is_list()) {
-    reflected = generate_simple_type_limited_reflection(
-        out, ((t_list*)ttype)->get_elem_type(), target + ".container_type.subtype1");
-  }
-  if (ttype->is_set()) {
-    reflected = generate_simple_type_limited_reflection(
-        out, ((t_set*)ttype)->get_elem_type(), target + ".container_type.subtype1");
-  }
-  if (ttype->is_map()) {
-    reflected =
-      generate_simple_type_limited_reflection(
-        out, ((t_map*)ttype)->get_key_type(), target + ".container_type.subtype1")
-      &&
-      generate_simple_type_limited_reflection(
-        out, ((t_map*)ttype)->get_val_type(), target + ".container_type.subtype2");
-    out << indent() << target << ".container_type.__isset.subtype2 = true;" << endl;
-  }
-
-  if (reflected) {
-    f_service_ << out.str();
-    return true;
-  } else {
-    f_service_ <<
-      indent() << target << ".is_container = false;" << endl <<
-      indent() << target << ".__isset.simple_type = true;" << endl;
-    f_service_ << indent() << target << ".simple_type.ttype = T_NOT_REFLECTED;" << endl;
-    return false;
-  }
-}
-
-/**
- * Generates a service reflector definition.
- * This uses thrift::reflection::limited.
- *
- * @param tservice The service to write a reflector for
- */
-void t_cpp_generator::generate_service_limited_reflector(t_service* tservice) {
-  // Open function
-  f_service_ <<
-    indent() << "void " << tservice->get_name() << "If::getStaticLimitedReflection" <<
-    "(apache::thrift::reflection::limited::Service & _return) ";
-  scope_up(f_service_);
-
-  f_service_ << indent() << "using namespace apache::thrift::reflection::limited;" << endl;
-
-  f_service_ << indent() << "_return.name = \"" << tservice->get_name() << "\";" << endl;
-  f_service_ << indent() << "_return.fully_reflected = true;" << endl;
-
-  bool all_reflectable = true;
-  bool one_reflectable;
-
-  const vector<t_function*> & funcs = tservice->get_functions();
-  vector<t_function*>::const_iterator f_iter;
-  for (f_iter = funcs.begin(); f_iter != funcs.end(); ++f_iter) {
-
-    f_service_ << indent() << "_return.methods.resize(_return.methods.size() + 1);" << endl;
-    f_service_ << indent() << "_return.methods.back().name = \"" << (*f_iter)->get_name() << "\";" << endl;
-    one_reflectable = generate_type_limited_reflection(
-        (*f_iter)->get_returntype(), "_return.methods.back().return_type");
-    all_reflectable = all_reflectable && one_reflectable;
-
-    t_struct* arglist = (*f_iter)->get_arglist();
-    const vector<t_field*> & args = arglist->get_members();
-    vector<t_field*>::const_iterator a_iter;
-    for (a_iter = args.begin(); a_iter != args.end(); ++a_iter) {
-      f_service_ <<
-        indent() << "_return.methods.back().arguments.resize("
-          "_return.methods.back().arguments.size() + 1);" << endl <<
-        indent() << "_return.methods.back().arguments.back().name = \"" <<
-          (*a_iter)->get_name() << "\";" << endl <<
-        indent() << "_return.methods.back().arguments.back().key = " <<
-          (*a_iter)->get_key() << ";" << endl;
-      one_reflectable = generate_type_limited_reflection(
-          (*a_iter)->get_type(), "_return.methods.back().arguments.back().type");
-      all_reflectable = all_reflectable && one_reflectable;
-    }
-  }
-
-  if (!all_reflectable) {
-    f_service_ << indent() << "_return.fully_reflected = false;" << endl;
-  }
-
-  // Close function
-  scope_down(f_service_);
-  f_service_ << endl;
-}
-
-/**
  * Generates a skeleton file of a server
  *
  * @param tservice The service to generate a server for.
diff --git a/configure.ac b/configure.ac
index 7411bc8..f88bf49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -187,7 +187,6 @@
   lib/perl/test/Makefile
   lib/py/Makefile
   lib/rb/Makefile
-  if/Makefile
   test/Makefile
   test/py/Makefile
   test/rb/Makefile
diff --git a/contrib/fb303/cpp/FacebookBase.cpp b/contrib/fb303/cpp/FacebookBase.cpp
index aef8950..d942106 100644
--- a/contrib/fb303/cpp/FacebookBase.cpp
+++ b/contrib/fb303/cpp/FacebookBase.cpp
@@ -9,12 +9,9 @@
 using namespace facebook::fb303;
 using facebook::thrift::concurrency::Guard;
 
-FacebookBase::FacebookBase(std::string name, get_static_limref_ptr reflect_lim) :
+FacebookBase::FacebookBase(std::string name) :
   name_(name) {
   aliveSince_ = (int64_t) time(NULL);
-  if (reflect_lim) {
-    reflect_lim(reflection_limited_);
-  }
 }
 
 inline void FacebookBase::getName(std::string& _return) {
diff --git a/contrib/fb303/cpp/FacebookBase.h b/contrib/fb303/cpp/FacebookBase.h
index a5afe5b..174271b 100644
--- a/contrib/fb303/cpp/FacebookBase.h
+++ b/contrib/fb303/cpp/FacebookBase.h
@@ -26,8 +26,6 @@
 struct ReadWriteCounterMap : ReadWriteMutex,
                              std::map<std::string, ReadWriteInt> {};
 
-typedef void (*get_static_limref_ptr)(facebook::thrift::reflection::limited::Service &);
-
 /**
  * Base Facebook service implementation in C++.
  *
@@ -35,7 +33,7 @@
  */
 class FacebookBase : virtual public FacebookServiceIf {
  protected:
-  FacebookBase(std::string name, get_static_limref_ptr reflect_lim = NULL);
+  FacebookBase(std::string name);
   virtual ~FacebookBase() {}
 
  public:
@@ -51,10 +49,6 @@
 
   int64_t aliveSince();
 
-  void getLimitedReflection(facebook::thrift::reflection::limited::Service& _return) {
-    _return = reflection_limited_;
-  }
-
   virtual void reinitialize() {}
 
   virtual void shutdown() {
@@ -81,7 +75,6 @@
  private:
 
   std::string name_;
-  facebook::thrift::reflection::limited::Service reflection_limited_;
   int64_t aliveSince_;
 
   std::map<std::string, std::string> options_;
diff --git a/contrib/fb303/if/fb303.thrift b/contrib/fb303/if/fb303.thrift
index bf86cbf..dc10e50 100644
--- a/contrib/fb303/if/fb303.thrift
+++ b/contrib/fb303/if/fb303.thrift
@@ -16,8 +16,6 @@
  * @author Mark Slee <mcslee@facebook.com>
  */
 
-include "thrift/if/reflection_limited.thrift"
-
 namespace java com.facebook.fb303
 namespace cpp facebook.fb303
 
@@ -96,12 +94,6 @@
   i64 aliveSince(),
 
   /**
-   * Returns a limited description of this service.
-   */
-  reflection_limited.Service
-  getLimitedReflection(),
-
-  /**
    * Tell the server to reload its configuration, reopen log files, etc
    */
   async void reinitialize(),
diff --git a/contrib/fb303/java/FacebookBase.java b/contrib/fb303/java/FacebookBase.java
index 50c38ae..f8bc58c 100644
--- a/contrib/fb303/java/FacebookBase.java
+++ b/contrib/fb303/java/FacebookBase.java
@@ -83,10 +83,6 @@
     return "";
   }
 
-  public org.apache.thrift.reflection.limited.Service getLimitedReflection() {
-    return new org.apache.thrift.reflection.limited.Service();
-  }
-
   public void reinitialize() {}
 
   public void shutdown() {}
diff --git a/contrib/thrift.spec b/contrib/thrift.spec
index e937405..3568739 100644
--- a/contrib/thrift.spec
+++ b/contrib/thrift.spec
@@ -44,7 +44,6 @@
 %files
 %defattr(-,root,root)
 %{_bindir}/thrift
-%{_datadir}/thrift/if/reflection_limited.thrift
 
 
 %package lib-cpp
diff --git a/if/Makefile.am b/if/Makefile.am
deleted file mode 100644
index 0687aaa..0000000
--- a/if/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-thrift_ifdir = $(datadir)/thrift/if
-dist_thrift_if_DATA = \
-                      reflection_limited.thrift
-EXTRA_DIST = regen.sh
diff --git a/if/reflection_limited.thrift b/if/reflection_limited.thrift
deleted file mode 100644
index e7340d1..0000000
--- a/if/reflection_limited.thrift
+++ /dev/null
@@ -1,69 +0,0 @@
-// NOTICE!!!
-// DO NOT FORGET to run regen.sh if you change this file
-// (or if you change the compiler).
-
-// This interface is deprecated.
-// There is no replacement yet, but I hate it so much that
-// I'm deprecating it before it's done.
-// @author I'm too ashamed to say.
-
-// dreiss naively thinks he knows how to do this better,
-// so talk to him if you are interested in taking it on,
-// or if you just want someone to make it better for you.
-
-cpp_namespace facebook.thrift.reflection.limited
-java_package com.facebook.thrift.reflection.limited
-py_module thrift.reflection.limited
-
-enum TTypeTag {
-  T_VOID   = 1,
-  T_BOOL   = 2,
-  T_BYTE   = 3,
-  T_I16    = 6,
-  T_I32    = 8,
-  T_I64    = 10,
-  T_DOUBLE = 4,
-  T_STRING = 11,
-  T_STRUCT = 12,
-  T_MAP    = 13,
-  T_SET    = 14,
-  T_LIST   = 15,
-  // This doesn't exist in TBinaryProtocol, but it could be useful for reflection.
-  T_ENUM   = 101,
-  T_NOT_REFLECTED = 102,
-}
-
-struct SimpleType {
-  1: TTypeTag ttype,
-  2: string name,  // For structs and emums.
-}
-
-struct ContainerType {
-  1: TTypeTag ttype,
-  2:          SimpleType subtype1,
-  3: optional SimpleType subtype2,
-}
-
-struct ThriftType {
-  1: bool is_container,
-  2: optional SimpleType simple_type,
-  3: optional ContainerType container_type,
-}
-
-struct Argument {
-  1: i16 key,
-  2: string name,
-  3: ThriftType type,
-}
-
-struct Method {
-  1: string name,
-  2: ThriftType return_type,
-  3: list<Argument> arguments,
-}
-
-struct Service {
-  1: string name,
-  2: list<Method> methods,
-  3: bool fully_reflected,
-}
diff --git a/if/regen.sh b/if/regen.sh
deleted file mode 100755
index 02e9fa2..0000000
--- a/if/regen.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-cd "`dirname $0`"
-../compiler/cpp/thrift --gen cpp --gen py reflection_limited.thrift
-cp gen-cpp/reflection_limited_types.h   ../lib/cpp/src/
-cp gen-cpp/reflection_limited_types.cpp ../lib/cpp/src/
-cp -r gen-py/thrift/reflection ../lib/py/src
diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am
index 96e44e8..4592008 100644
--- a/lib/cpp/Makefile.am
+++ b/lib/cpp/Makefile.am
@@ -22,7 +22,6 @@
 # Define the source files for the module
 
 libthrift_la_SOURCES = src/Thrift.cpp \
-                       src/reflection_limited_types.cpp \
                        src/concurrency/Mutex.cpp \
                        src/concurrency/Monitor.cpp \
                        src/concurrency/PosixThreadFactory.cpp \
@@ -64,7 +63,6 @@
                          $(top_builddir)/config.h \
                          src/Thrift.h \
                          src/TReflectionLocal.h \
-                         src/reflection_limited_types.h \
                          src/TProcessor.h \
                          src/TLogging.h
 
diff --git a/lib/cpp/src/reflection_limited_types.cpp b/lib/cpp/src/reflection_limited_types.cpp
deleted file mode 100644
index 8bd4248..0000000
--- a/lib/cpp/src/reflection_limited_types.cpp
+++ /dev/null
@@ -1,505 +0,0 @@
-/**
- * Autogenerated by Thrift
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-#include "reflection_limited_types.h"
-
-namespace apache { namespace thrift { namespace reflection { namespace limited {
-
-const char* SimpleType::ascii_fingerprint = "19B5240589E680301A7E32DF3971EFBE";
-const uint8_t SimpleType::binary_fingerprint[16] = {0x19,0xB5,0x24,0x05,0x89,0xE6,0x80,0x30,0x1A,0x7E,0x32,0xDF,0x39,0x71,0xEF,0xBE};
-
-uint32_t SimpleType::read(apache::thrift::protocol::TProtocol* iprot) {
-
-  uint32_t xfer = 0;
-  std::string fname;
-  apache::thrift::protocol::TType ftype;
-  int16_t fid;
-
-  xfer += iprot->readStructBegin(fname);
-
-  using apache::thrift::protocol::TProtocolException;
-
-
-  while (true)
-  {
-    xfer += iprot->readFieldBegin(fname, ftype, fid);
-    if (ftype == apache::thrift::protocol::T_STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-        if (ftype == apache::thrift::protocol::T_I32) {
-          int32_t ecast0;
-          xfer += iprot->readI32(ecast0);
-          this->ttype = (TTypeTag)ecast0;
-          this->__isset.ttype = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      case 2:
-        if (ftype == apache::thrift::protocol::T_STRING) {
-          xfer += iprot->readString(this->name);
-          this->__isset.name = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      default:
-        xfer += iprot->skip(ftype);
-        break;
-    }
-    xfer += iprot->readFieldEnd();
-  }
-
-  xfer += iprot->readStructEnd();
-
-  return xfer;
-}
-
-uint32_t SimpleType::write(apache::thrift::protocol::TProtocol* oprot) const {
-  uint32_t xfer = 0;
-  xfer += oprot->writeStructBegin("SimpleType");
-  xfer += oprot->writeFieldBegin("ttype", apache::thrift::protocol::T_I32, 1);
-  xfer += oprot->writeI32((int32_t)this->ttype);
-  xfer += oprot->writeFieldEnd();
-  xfer += oprot->writeFieldBegin("name", apache::thrift::protocol::T_STRING, 2);
-  xfer += oprot->writeString(this->name);
-  xfer += oprot->writeFieldEnd();
-  xfer += oprot->writeFieldStop();
-  xfer += oprot->writeStructEnd();
-  return xfer;
-}
-
-const char* ContainerType::ascii_fingerprint = "654FA6EFFF8242F4C2A604B970686634";
-const uint8_t ContainerType::binary_fingerprint[16] = {0x65,0x4F,0xA6,0xEF,0xFF,0x82,0x42,0xF4,0xC2,0xA6,0x04,0xB9,0x70,0x68,0x66,0x34};
-
-uint32_t ContainerType::read(apache::thrift::protocol::TProtocol* iprot) {
-
-  uint32_t xfer = 0;
-  std::string fname;
-  apache::thrift::protocol::TType ftype;
-  int16_t fid;
-
-  xfer += iprot->readStructBegin(fname);
-
-  using apache::thrift::protocol::TProtocolException;
-
-
-  while (true)
-  {
-    xfer += iprot->readFieldBegin(fname, ftype, fid);
-    if (ftype == apache::thrift::protocol::T_STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-        if (ftype == apache::thrift::protocol::T_I32) {
-          int32_t ecast1;
-          xfer += iprot->readI32(ecast1);
-          this->ttype = (TTypeTag)ecast1;
-          this->__isset.ttype = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      case 2:
-        if (ftype == apache::thrift::protocol::T_STRUCT) {
-          xfer += this->subtype1.read(iprot);
-          this->__isset.subtype1 = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      case 3:
-        if (ftype == apache::thrift::protocol::T_STRUCT) {
-          xfer += this->subtype2.read(iprot);
-          this->__isset.subtype2 = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      default:
-        xfer += iprot->skip(ftype);
-        break;
-    }
-    xfer += iprot->readFieldEnd();
-  }
-
-  xfer += iprot->readStructEnd();
-
-  return xfer;
-}
-
-uint32_t ContainerType::write(apache::thrift::protocol::TProtocol* oprot) const {
-  uint32_t xfer = 0;
-  xfer += oprot->writeStructBegin("ContainerType");
-  xfer += oprot->writeFieldBegin("ttype", apache::thrift::protocol::T_I32, 1);
-  xfer += oprot->writeI32((int32_t)this->ttype);
-  xfer += oprot->writeFieldEnd();
-  xfer += oprot->writeFieldBegin("subtype1", apache::thrift::protocol::T_STRUCT, 2);
-  xfer += this->subtype1.write(oprot);
-  xfer += oprot->writeFieldEnd();
-  if (this->__isset.subtype2) {
-    xfer += oprot->writeFieldBegin("subtype2", apache::thrift::protocol::T_STRUCT, 3);
-    xfer += this->subtype2.write(oprot);
-    xfer += oprot->writeFieldEnd();
-  }
-  xfer += oprot->writeFieldStop();
-  xfer += oprot->writeStructEnd();
-  return xfer;
-}
-
-const char* ThriftType::ascii_fingerprint = "76BC1CC759001D7D85FEE75C4F183062";
-const uint8_t ThriftType::binary_fingerprint[16] = {0x76,0xBC,0x1C,0xC7,0x59,0x00,0x1D,0x7D,0x85,0xFE,0xE7,0x5C,0x4F,0x18,0x30,0x62};
-
-uint32_t ThriftType::read(apache::thrift::protocol::TProtocol* iprot) {
-
-  uint32_t xfer = 0;
-  std::string fname;
-  apache::thrift::protocol::TType ftype;
-  int16_t fid;
-
-  xfer += iprot->readStructBegin(fname);
-
-  using apache::thrift::protocol::TProtocolException;
-
-
-  while (true)
-  {
-    xfer += iprot->readFieldBegin(fname, ftype, fid);
-    if (ftype == apache::thrift::protocol::T_STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-        if (ftype == apache::thrift::protocol::T_BOOL) {
-          xfer += iprot->readBool(this->is_container);
-          this->__isset.is_container = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      case 2:
-        if (ftype == apache::thrift::protocol::T_STRUCT) {
-          xfer += this->simple_type.read(iprot);
-          this->__isset.simple_type = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      case 3:
-        if (ftype == apache::thrift::protocol::T_STRUCT) {
-          xfer += this->container_type.read(iprot);
-          this->__isset.container_type = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      default:
-        xfer += iprot->skip(ftype);
-        break;
-    }
-    xfer += iprot->readFieldEnd();
-  }
-
-  xfer += iprot->readStructEnd();
-
-  return xfer;
-}
-
-uint32_t ThriftType::write(apache::thrift::protocol::TProtocol* oprot) const {
-  uint32_t xfer = 0;
-  xfer += oprot->writeStructBegin("ThriftType");
-  xfer += oprot->writeFieldBegin("is_container", apache::thrift::protocol::T_BOOL, 1);
-  xfer += oprot->writeBool(this->is_container);
-  xfer += oprot->writeFieldEnd();
-  if (this->__isset.simple_type) {
-    xfer += oprot->writeFieldBegin("simple_type", apache::thrift::protocol::T_STRUCT, 2);
-    xfer += this->simple_type.write(oprot);
-    xfer += oprot->writeFieldEnd();
-  }
-  if (this->__isset.container_type) {
-    xfer += oprot->writeFieldBegin("container_type", apache::thrift::protocol::T_STRUCT, 3);
-    xfer += this->container_type.write(oprot);
-    xfer += oprot->writeFieldEnd();
-  }
-  xfer += oprot->writeFieldStop();
-  xfer += oprot->writeStructEnd();
-  return xfer;
-}
-
-const char* Argument::ascii_fingerprint = "8C45506BE0EFBB22FB19FA40DDCECB3F";
-const uint8_t Argument::binary_fingerprint[16] = {0x8C,0x45,0x50,0x6B,0xE0,0xEF,0xBB,0x22,0xFB,0x19,0xFA,0x40,0xDD,0xCE,0xCB,0x3F};
-
-uint32_t Argument::read(apache::thrift::protocol::TProtocol* iprot) {
-
-  uint32_t xfer = 0;
-  std::string fname;
-  apache::thrift::protocol::TType ftype;
-  int16_t fid;
-
-  xfer += iprot->readStructBegin(fname);
-
-  using apache::thrift::protocol::TProtocolException;
-
-
-  while (true)
-  {
-    xfer += iprot->readFieldBegin(fname, ftype, fid);
-    if (ftype == apache::thrift::protocol::T_STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-        if (ftype == apache::thrift::protocol::T_I16) {
-          xfer += iprot->readI16(this->key);
-          this->__isset.key = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      case 2:
-        if (ftype == apache::thrift::protocol::T_STRING) {
-          xfer += iprot->readString(this->name);
-          this->__isset.name = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      case 3:
-        if (ftype == apache::thrift::protocol::T_STRUCT) {
-          xfer += this->type.read(iprot);
-          this->__isset.type = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      default:
-        xfer += iprot->skip(ftype);
-        break;
-    }
-    xfer += iprot->readFieldEnd();
-  }
-
-  xfer += iprot->readStructEnd();
-
-  return xfer;
-}
-
-uint32_t Argument::write(apache::thrift::protocol::TProtocol* oprot) const {
-  uint32_t xfer = 0;
-  xfer += oprot->writeStructBegin("Argument");
-  xfer += oprot->writeFieldBegin("key", apache::thrift::protocol::T_I16, 1);
-  xfer += oprot->writeI16(this->key);
-  xfer += oprot->writeFieldEnd();
-  xfer += oprot->writeFieldBegin("name", apache::thrift::protocol::T_STRING, 2);
-  xfer += oprot->writeString(this->name);
-  xfer += oprot->writeFieldEnd();
-  xfer += oprot->writeFieldBegin("type", apache::thrift::protocol::T_STRUCT, 3);
-  xfer += this->type.write(oprot);
-  xfer += oprot->writeFieldEnd();
-  xfer += oprot->writeFieldStop();
-  xfer += oprot->writeStructEnd();
-  return xfer;
-}
-
-const char* Method::ascii_fingerprint = "E6573428C492D24C84A19432D39A17B0";
-const uint8_t Method::binary_fingerprint[16] = {0xE6,0x57,0x34,0x28,0xC4,0x92,0xD2,0x4C,0x84,0xA1,0x94,0x32,0xD3,0x9A,0x17,0xB0};
-
-uint32_t Method::read(apache::thrift::protocol::TProtocol* iprot) {
-
-  uint32_t xfer = 0;
-  std::string fname;
-  apache::thrift::protocol::TType ftype;
-  int16_t fid;
-
-  xfer += iprot->readStructBegin(fname);
-
-  using apache::thrift::protocol::TProtocolException;
-
-
-  while (true)
-  {
-    xfer += iprot->readFieldBegin(fname, ftype, fid);
-    if (ftype == apache::thrift::protocol::T_STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-        if (ftype == apache::thrift::protocol::T_STRING) {
-          xfer += iprot->readString(this->name);
-          this->__isset.name = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      case 2:
-        if (ftype == apache::thrift::protocol::T_STRUCT) {
-          xfer += this->return_type.read(iprot);
-          this->__isset.return_type = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      case 3:
-        if (ftype == apache::thrift::protocol::T_LIST) {
-          {
-            this->arguments.clear();
-            uint32_t _size2;
-            apache::thrift::protocol::TType _etype5;
-            iprot->readListBegin(_etype5, _size2);
-            this->arguments.resize(_size2);
-            uint32_t _i6;
-            for (_i6 = 0; _i6 < _size2; ++_i6)
-            {
-              xfer += this->arguments[_i6].read(iprot);
-            }
-            iprot->readListEnd();
-          }
-          this->__isset.arguments = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      default:
-        xfer += iprot->skip(ftype);
-        break;
-    }
-    xfer += iprot->readFieldEnd();
-  }
-
-  xfer += iprot->readStructEnd();
-
-  return xfer;
-}
-
-uint32_t Method::write(apache::thrift::protocol::TProtocol* oprot) const {
-  uint32_t xfer = 0;
-  xfer += oprot->writeStructBegin("Method");
-  xfer += oprot->writeFieldBegin("name", apache::thrift::protocol::T_STRING, 1);
-  xfer += oprot->writeString(this->name);
-  xfer += oprot->writeFieldEnd();
-  xfer += oprot->writeFieldBegin("return_type", apache::thrift::protocol::T_STRUCT, 2);
-  xfer += this->return_type.write(oprot);
-  xfer += oprot->writeFieldEnd();
-  xfer += oprot->writeFieldBegin("arguments", apache::thrift::protocol::T_LIST, 3);
-  {
-    xfer += oprot->writeListBegin(apache::thrift::protocol::T_STRUCT, this->arguments.size());
-    std::vector<Argument> ::const_iterator _iter7;
-    for (_iter7 = this->arguments.begin(); _iter7 != this->arguments.end(); ++_iter7)
-    {
-      xfer += (*_iter7).write(oprot);
-    }
-    xfer += oprot->writeListEnd();
-  }
-  xfer += oprot->writeFieldEnd();
-  xfer += oprot->writeFieldStop();
-  xfer += oprot->writeStructEnd();
-  return xfer;
-}
-
-const char* Service::ascii_fingerprint = "4673B0777B701D9B02A7A74CEC7908A7";
-const uint8_t Service::binary_fingerprint[16] = {0x46,0x73,0xB0,0x77,0x7B,0x70,0x1D,0x9B,0x02,0xA7,0xA7,0x4C,0xEC,0x79,0x08,0xA7};
-
-uint32_t Service::read(apache::thrift::protocol::TProtocol* iprot) {
-
-  uint32_t xfer = 0;
-  std::string fname;
-  apache::thrift::protocol::TType ftype;
-  int16_t fid;
-
-  xfer += iprot->readStructBegin(fname);
-
-  using apache::thrift::protocol::TProtocolException;
-
-
-  while (true)
-  {
-    xfer += iprot->readFieldBegin(fname, ftype, fid);
-    if (ftype == apache::thrift::protocol::T_STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-        if (ftype == apache::thrift::protocol::T_STRING) {
-          xfer += iprot->readString(this->name);
-          this->__isset.name = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      case 2:
-        if (ftype == apache::thrift::protocol::T_LIST) {
-          {
-            this->methods.clear();
-            uint32_t _size8;
-            apache::thrift::protocol::TType _etype11;
-            iprot->readListBegin(_etype11, _size8);
-            this->methods.resize(_size8);
-            uint32_t _i12;
-            for (_i12 = 0; _i12 < _size8; ++_i12)
-            {
-              xfer += this->methods[_i12].read(iprot);
-            }
-            iprot->readListEnd();
-          }
-          this->__isset.methods = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      case 3:
-        if (ftype == apache::thrift::protocol::T_BOOL) {
-          xfer += iprot->readBool(this->fully_reflected);
-          this->__isset.fully_reflected = true;
-        } else {
-          xfer += iprot->skip(ftype);
-        }
-        break;
-      default:
-        xfer += iprot->skip(ftype);
-        break;
-    }
-    xfer += iprot->readFieldEnd();
-  }
-
-  xfer += iprot->readStructEnd();
-
-  return xfer;
-}
-
-uint32_t Service::write(apache::thrift::protocol::TProtocol* oprot) const {
-  uint32_t xfer = 0;
-  xfer += oprot->writeStructBegin("Service");
-  xfer += oprot->writeFieldBegin("name", apache::thrift::protocol::T_STRING, 1);
-  xfer += oprot->writeString(this->name);
-  xfer += oprot->writeFieldEnd();
-  xfer += oprot->writeFieldBegin("methods", apache::thrift::protocol::T_LIST, 2);
-  {
-    xfer += oprot->writeListBegin(apache::thrift::protocol::T_STRUCT, this->methods.size());
-    std::vector<Method> ::const_iterator _iter13;
-    for (_iter13 = this->methods.begin(); _iter13 != this->methods.end(); ++_iter13)
-    {
-      xfer += (*_iter13).write(oprot);
-    }
-    xfer += oprot->writeListEnd();
-  }
-  xfer += oprot->writeFieldEnd();
-  xfer += oprot->writeFieldBegin("fully_reflected", apache::thrift::protocol::T_BOOL, 3);
-  xfer += oprot->writeBool(this->fully_reflected);
-  xfer += oprot->writeFieldEnd();
-  xfer += oprot->writeFieldStop();
-  xfer += oprot->writeStructEnd();
-  return xfer;
-}
-
-}}}} // namespace
diff --git a/lib/cpp/src/reflection_limited_types.h b/lib/cpp/src/reflection_limited_types.h
deleted file mode 100644
index 570397a..0000000
--- a/lib/cpp/src/reflection_limited_types.h
+++ /dev/null
@@ -1,297 +0,0 @@
-/**
- * Autogenerated by Thrift
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-#ifndef reflection_limited_TYPES_H
-#define reflection_limited_TYPES_H
-
-#include <Thrift.h>
-#include <reflection_limited_types.h>
-#include <protocol/TProtocol.h>
-#include <transport/TTransport.h>
-
-
-
-namespace apache { namespace thrift { namespace reflection { namespace limited {
-
-enum TTypeTag {
-  T_VOID = 1,
-  T_BOOL = 2,
-  T_BYTE = 3,
-  T_I16 = 6,
-  T_I32 = 8,
-  T_I64 = 10,
-  T_DOUBLE = 4,
-  T_STRING = 11,
-  T_STRUCT = 12,
-  T_MAP = 13,
-  T_SET = 14,
-  T_LIST = 15,
-  T_ENUM = 101,
-  T_NOT_REFLECTED = 102
-};
-
-class SimpleType {
- public:
-
-  static const char* ascii_fingerprint; // = "19B5240589E680301A7E32DF3971EFBE";
-  static const uint8_t binary_fingerprint[16]; // = {0x19,0xB5,0x24,0x05,0x89,0xE6,0x80,0x30,0x1A,0x7E,0x32,0xDF,0x39,0x71,0xEF,0xBE};
-
-  SimpleType() : name("") {
-  }
-
-  virtual ~SimpleType() throw() {}
-
-  TTypeTag ttype;
-  std::string name;
-
-  struct __isset {
-    __isset() : ttype(false), name(false) {}
-    bool ttype;
-    bool name;
-  } __isset;
-
-  bool operator == (const SimpleType & rhs) const
-  {
-    if (!(ttype == rhs.ttype))
-      return false;
-    if (!(name == rhs.name))
-      return false;
-    return true;
-  }
-  bool operator != (const SimpleType &rhs) const {
-    return !(*this == rhs);
-  }
-
-  bool operator < (const SimpleType & ) const;
-
-  uint32_t read(apache::thrift::protocol::TProtocol* iprot);
-  uint32_t write(apache::thrift::protocol::TProtocol* oprot) const;
-
-};
-
-class ContainerType {
- public:
-
-  static const char* ascii_fingerprint; // = "654FA6EFFF8242F4C2A604B970686634";
-  static const uint8_t binary_fingerprint[16]; // = {0x65,0x4F,0xA6,0xEF,0xFF,0x82,0x42,0xF4,0xC2,0xA6,0x04,0xB9,0x70,0x68,0x66,0x34};
-
-  ContainerType() {
-  }
-
-  virtual ~ContainerType() throw() {}
-
-  TTypeTag ttype;
-  SimpleType subtype1;
-  SimpleType subtype2;
-
-  struct __isset {
-    __isset() : ttype(false), subtype1(false), subtype2(false) {}
-    bool ttype;
-    bool subtype1;
-    bool subtype2;
-  } __isset;
-
-  bool operator == (const ContainerType & rhs) const
-  {
-    if (!(ttype == rhs.ttype))
-      return false;
-    if (!(subtype1 == rhs.subtype1))
-      return false;
-    if (__isset.subtype2 != rhs.__isset.subtype2)
-      return false;
-    else if (__isset.subtype2 && !(subtype2 == rhs.subtype2))
-      return false;
-    return true;
-  }
-  bool operator != (const ContainerType &rhs) const {
-    return !(*this == rhs);
-  }
-
-  bool operator < (const ContainerType & ) const;
-
-  uint32_t read(apache::thrift::protocol::TProtocol* iprot);
-  uint32_t write(apache::thrift::protocol::TProtocol* oprot) const;
-
-};
-
-class ThriftType {
- public:
-
-  static const char* ascii_fingerprint; // = "76BC1CC759001D7D85FEE75C4F183062";
-  static const uint8_t binary_fingerprint[16]; // = {0x76,0xBC,0x1C,0xC7,0x59,0x00,0x1D,0x7D,0x85,0xFE,0xE7,0x5C,0x4F,0x18,0x30,0x62};
-
-  ThriftType() : is_container(0) {
-  }
-
-  virtual ~ThriftType() throw() {}
-
-  bool is_container;
-  SimpleType simple_type;
-  ContainerType container_type;
-
-  struct __isset {
-    __isset() : is_container(false), simple_type(false), container_type(false) {}
-    bool is_container;
-    bool simple_type;
-    bool container_type;
-  } __isset;
-
-  bool operator == (const ThriftType & rhs) const
-  {
-    if (!(is_container == rhs.is_container))
-      return false;
-    if (__isset.simple_type != rhs.__isset.simple_type)
-      return false;
-    else if (__isset.simple_type && !(simple_type == rhs.simple_type))
-      return false;
-    if (__isset.container_type != rhs.__isset.container_type)
-      return false;
-    else if (__isset.container_type && !(container_type == rhs.container_type))
-      return false;
-    return true;
-  }
-  bool operator != (const ThriftType &rhs) const {
-    return !(*this == rhs);
-  }
-
-  bool operator < (const ThriftType & ) const;
-
-  uint32_t read(apache::thrift::protocol::TProtocol* iprot);
-  uint32_t write(apache::thrift::protocol::TProtocol* oprot) const;
-
-};
-
-class Argument {
- public:
-
-  static const char* ascii_fingerprint; // = "8C45506BE0EFBB22FB19FA40DDCECB3F";
-  static const uint8_t binary_fingerprint[16]; // = {0x8C,0x45,0x50,0x6B,0xE0,0xEF,0xBB,0x22,0xFB,0x19,0xFA,0x40,0xDD,0xCE,0xCB,0x3F};
-
-  Argument() : key(0), name("") {
-  }
-
-  virtual ~Argument() throw() {}
-
-  int16_t key;
-  std::string name;
-  ThriftType type;
-
-  struct __isset {
-    __isset() : key(false), name(false), type(false) {}
-    bool key;
-    bool name;
-    bool type;
-  } __isset;
-
-  bool operator == (const Argument & rhs) const
-  {
-    if (!(key == rhs.key))
-      return false;
-    if (!(name == rhs.name))
-      return false;
-    if (!(type == rhs.type))
-      return false;
-    return true;
-  }
-  bool operator != (const Argument &rhs) const {
-    return !(*this == rhs);
-  }
-
-  bool operator < (const Argument & ) const;
-
-  uint32_t read(apache::thrift::protocol::TProtocol* iprot);
-  uint32_t write(apache::thrift::protocol::TProtocol* oprot) const;
-
-};
-
-class Method {
- public:
-
-  static const char* ascii_fingerprint; // = "E6573428C492D24C84A19432D39A17B0";
-  static const uint8_t binary_fingerprint[16]; // = {0xE6,0x57,0x34,0x28,0xC4,0x92,0xD2,0x4C,0x84,0xA1,0x94,0x32,0xD3,0x9A,0x17,0xB0};
-
-  Method() : name("") {
-  }
-
-  virtual ~Method() throw() {}
-
-  std::string name;
-  ThriftType return_type;
-  std::vector<Argument>  arguments;
-
-  struct __isset {
-    __isset() : name(false), return_type(false), arguments(false) {}
-    bool name;
-    bool return_type;
-    bool arguments;
-  } __isset;
-
-  bool operator == (const Method & rhs) const
-  {
-    if (!(name == rhs.name))
-      return false;
-    if (!(return_type == rhs.return_type))
-      return false;
-    if (!(arguments == rhs.arguments))
-      return false;
-    return true;
-  }
-  bool operator != (const Method &rhs) const {
-    return !(*this == rhs);
-  }
-
-  bool operator < (const Method & ) const;
-
-  uint32_t read(apache::thrift::protocol::TProtocol* iprot);
-  uint32_t write(apache::thrift::protocol::TProtocol* oprot) const;
-
-};
-
-class Service {
- public:
-
-  static const char* ascii_fingerprint; // = "4673B0777B701D9B02A7A74CEC7908A7";
-  static const uint8_t binary_fingerprint[16]; // = {0x46,0x73,0xB0,0x77,0x7B,0x70,0x1D,0x9B,0x02,0xA7,0xA7,0x4C,0xEC,0x79,0x08,0xA7};
-
-  Service() : name(""), fully_reflected(0) {
-  }
-
-  virtual ~Service() throw() {}
-
-  std::string name;
-  std::vector<Method>  methods;
-  bool fully_reflected;
-
-  struct __isset {
-    __isset() : name(false), methods(false), fully_reflected(false) {}
-    bool name;
-    bool methods;
-    bool fully_reflected;
-  } __isset;
-
-  bool operator == (const Service & rhs) const
-  {
-    if (!(name == rhs.name))
-      return false;
-    if (!(methods == rhs.methods))
-      return false;
-    if (!(fully_reflected == rhs.fully_reflected))
-      return false;
-    return true;
-  }
-  bool operator != (const Service &rhs) const {
-    return !(*this == rhs);
-  }
-
-  bool operator < (const Service & ) const;
-
-  uint32_t read(apache::thrift::protocol::TProtocol* iprot);
-  uint32_t write(apache::thrift::protocol::TProtocol* oprot) const;
-
-};
-
-}}}} // namespace
-
-#endif
diff --git a/lib/java/src/org/apache/thrift/reflection/limited/Argument.java b/lib/java/src/org/apache/thrift/reflection/limited/Argument.java
deleted file mode 100644
index 9dc7d95..0000000
--- a/lib/java/src/org/apache/thrift/reflection/limited/Argument.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * Autogenerated by Thrift
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-package org.apache.thrift.reflection.limited;
-
-import java.util.ArrayList;
-import java.util.AbstractMap;
-import java.util.HashMap;
-import java.util.HashSet;
-import org.apache.thrift.*;
-
-import org.apache.thrift.protocol.*;
-import org.apache.thrift.transport.*;
-
-public class Argument implements java.io.Serializable {
-  public short key;
-  public String name;
-  public ThriftType type;
-
-  public final Isset __isset = new Isset();
-  public static final class Isset {
-    public boolean key = false;
-    public boolean name = false;
-    public boolean type = false;
-  }
-
-  public Argument() {
-  }
-
-  public Argument(
-    short key,
-    String name,
-    ThriftType type)
-  {
-    this();
-    this.key = key;
-    this.__isset.key = true;
-    this.name = name;
-    this.__isset.name = true;
-    this.type = type;
-    this.__isset.type = true;
-  }
-
-  public void read(TProtocol iprot) throws TException {
-    TField field;
-    iprot.readStructBegin();
-    while (true)
-    {
-      field = iprot.readFieldBegin();
-      if (field.type == TType.STOP) {
-        break;
-      }
-      switch (field.id)
-      {
-        case 1:
-          if (field.type == TType.I16) {
-            this.key = iprot.readI16();
-            this.__isset.key = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 2:
-          if (field.type == TType.STRING) {
-            this.name = iprot.readString();
-            this.__isset.name = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 3:
-          if (field.type == TType.STRUCT) {
-            this.type = new ThriftType();
-            this.type.read(iprot);
-            this.__isset.type = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
-          break;
-      }
-      iprot.readFieldEnd();
-    }
-    iprot.readStructEnd();
-  }
-
-  public void write(TProtocol oprot) throws TException {
-    TStruct struct = new TStruct("Argument");
-    oprot.writeStructBegin(struct);
-    TField field = new TField();
-    field.name = "key";
-    field.type = TType.I16;
-    field.id = 1;
-    oprot.writeFieldBegin(field);
-    oprot.writeI16(this.key);
-    oprot.writeFieldEnd();
-    if (this.name != null) {
-      field.name = "name";
-      field.type = TType.STRING;
-      field.id = 2;
-      oprot.writeFieldBegin(field);
-      oprot.writeString(this.name);
-      oprot.writeFieldEnd();
-    }
-    if (this.type != null) {
-      field.name = "type";
-      field.type = TType.STRUCT;
-      field.id = 3;
-      oprot.writeFieldBegin(field);
-      this.type.write(oprot);
-      oprot.writeFieldEnd();
-    }
-    oprot.writeFieldStop();
-    oprot.writeStructEnd();
-  }
-
-  public String toString() {
-    StringBuilder sb = new StringBuilder("Argument(");
-    sb.append("key:");
-    sb.append(this.key);
-    sb.append(",name:");
-    sb.append(this.name);
-    sb.append(",type:");
-    sb.append(this.type.toString());
-    sb.append(")");
-    return sb.toString();
-  }
-
-}
-
diff --git a/lib/java/src/org/apache/thrift/reflection/limited/Constants.java b/lib/java/src/org/apache/thrift/reflection/limited/Constants.java
deleted file mode 100644
index 2e6cc51..0000000
--- a/lib/java/src/org/apache/thrift/reflection/limited/Constants.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Autogenerated by Thrift
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-package org.apache.thrift.reflection.limited;
-
-import java.util.ArrayList;
-import java.util.AbstractMap;
-import java.util.HashMap;
-import java.util.HashSet;
-import org.apache.thrift.*;
-
-public class Constants {
-
-}
diff --git a/lib/java/src/org/apache/thrift/reflection/limited/ContainerType.java b/lib/java/src/org/apache/thrift/reflection/limited/ContainerType.java
deleted file mode 100644
index c006dc3..0000000
--- a/lib/java/src/org/apache/thrift/reflection/limited/ContainerType.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * Autogenerated by Thrift
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-package org.apache.thrift.reflection.limited;
-
-import java.util.ArrayList;
-import java.util.AbstractMap;
-import java.util.HashMap;
-import java.util.HashSet;
-import org.apache.thrift.*;
-
-import org.apache.thrift.protocol.*;
-import org.apache.thrift.transport.*;
-
-public class ContainerType implements java.io.Serializable {
-  public int ttype;
-  public SimpleType subtype1;
-  public SimpleType subtype2;
-
-  public final Isset __isset = new Isset();
-  public static final class Isset {
-    public boolean ttype = false;
-    public boolean subtype1 = false;
-    public boolean subtype2 = false;
-  }
-
-  public ContainerType() {
-  }
-
-  public ContainerType(
-    int ttype,
-    SimpleType subtype1,
-    SimpleType subtype2)
-  {
-    this();
-    this.ttype = ttype;
-    this.__isset.ttype = true;
-    this.subtype1 = subtype1;
-    this.__isset.subtype1 = true;
-    this.subtype2 = subtype2;
-    this.__isset.subtype2 = true;
-  }
-
-  public void read(TProtocol iprot) throws TException {
-    TField field;
-    iprot.readStructBegin();
-    while (true)
-    {
-      field = iprot.readFieldBegin();
-      if (field.type == TType.STOP) {
-        break;
-      }
-      switch (field.id)
-      {
-        case 1:
-          if (field.type == TType.I32) {
-            this.ttype = iprot.readI32();
-            this.__isset.ttype = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 2:
-          if (field.type == TType.STRUCT) {
-            this.subtype1 = new SimpleType();
-            this.subtype1.read(iprot);
-            this.__isset.subtype1 = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 3:
-          if (field.type == TType.STRUCT) {
-            this.subtype2 = new SimpleType();
-            this.subtype2.read(iprot);
-            this.__isset.subtype2 = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
-          break;
-      }
-      iprot.readFieldEnd();
-    }
-    iprot.readStructEnd();
-  }
-
-  public void write(TProtocol oprot) throws TException {
-    TStruct struct = new TStruct("ContainerType");
-    oprot.writeStructBegin(struct);
-    TField field = new TField();
-    field.name = "ttype";
-    field.type = TType.I32;
-    field.id = 1;
-    oprot.writeFieldBegin(field);
-    oprot.writeI32(this.ttype);
-    oprot.writeFieldEnd();
-    if (this.subtype1 != null) {
-      field.name = "subtype1";
-      field.type = TType.STRUCT;
-      field.id = 2;
-      oprot.writeFieldBegin(field);
-      this.subtype1.write(oprot);
-      oprot.writeFieldEnd();
-    }
-    if (this.subtype2 != null) {
-      field.name = "subtype2";
-      field.type = TType.STRUCT;
-      field.id = 3;
-      oprot.writeFieldBegin(field);
-      this.subtype2.write(oprot);
-      oprot.writeFieldEnd();
-    }
-    oprot.writeFieldStop();
-    oprot.writeStructEnd();
-  }
-
-  public String toString() {
-    StringBuilder sb = new StringBuilder("ContainerType(");
-    sb.append("ttype:");
-    sb.append(this.ttype);
-    sb.append(",subtype1:");
-    sb.append(this.subtype1.toString());
-    sb.append(",subtype2:");
-    sb.append(this.subtype2.toString());
-    sb.append(")");
-    return sb.toString();
-  }
-
-}
-
diff --git a/lib/java/src/org/apache/thrift/reflection/limited/Method.java b/lib/java/src/org/apache/thrift/reflection/limited/Method.java
deleted file mode 100644
index 34d9164..0000000
--- a/lib/java/src/org/apache/thrift/reflection/limited/Method.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * Autogenerated by Thrift
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-package org.apache.thrift.reflection.limited;
-
-import java.util.ArrayList;
-import java.util.AbstractMap;
-import java.util.HashMap;
-import java.util.HashSet;
-import org.apache.thrift.*;
-
-import org.apache.thrift.protocol.*;
-import org.apache.thrift.transport.*;
-
-public class Method implements java.io.Serializable {
-  public String name;
-  public ThriftType return_type;
-  public ArrayList<Argument> arguments;
-
-  public final Isset __isset = new Isset();
-  public static final class Isset {
-    public boolean name = false;
-    public boolean return_type = false;
-    public boolean arguments = false;
-  }
-
-  public Method() {
-  }
-
-  public Method(
-    String name,
-    ThriftType return_type,
-    ArrayList<Argument> arguments)
-  {
-    this();
-    this.name = name;
-    this.__isset.name = true;
-    this.return_type = return_type;
-    this.__isset.return_type = true;
-    this.arguments = arguments;
-    this.__isset.arguments = true;
-  }
-
-  public void read(TProtocol iprot) throws TException {
-    TField field;
-    iprot.readStructBegin();
-    while (true)
-    {
-      field = iprot.readFieldBegin();
-      if (field.type == TType.STOP) {
-        break;
-      }
-      switch (field.id)
-      {
-        case 1:
-          if (field.type == TType.STRING) {
-            this.name = iprot.readString();
-            this.__isset.name = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 2:
-          if (field.type == TType.STRUCT) {
-            this.return_type = new ThriftType();
-            this.return_type.read(iprot);
-            this.__isset.return_type = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 3:
-          if (field.type == TType.LIST) {
-            {
-              TList _list0 = iprot.readListBegin();
-              this.arguments = new ArrayList<Argument>(_list0.size);
-              for (int _i1 = 0; _i1 < _list0.size; ++_i1)
-              {
-                Argument _elem2 = new Argument();
-                _elem2 = new Argument();
-                _elem2.read(iprot);
-                this.arguments.add(_elem2);
-              }
-              iprot.readListEnd();
-            }
-            this.__isset.arguments = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
-          break;
-      }
-      iprot.readFieldEnd();
-    }
-    iprot.readStructEnd();
-  }
-
-  public void write(TProtocol oprot) throws TException {
-    TStruct struct = new TStruct("Method");
-    oprot.writeStructBegin(struct);
-    TField field = new TField();
-    if (this.name != null) {
-      field.name = "name";
-      field.type = TType.STRING;
-      field.id = 1;
-      oprot.writeFieldBegin(field);
-      oprot.writeString(this.name);
-      oprot.writeFieldEnd();
-    }
-    if (this.return_type != null) {
-      field.name = "return_type";
-      field.type = TType.STRUCT;
-      field.id = 2;
-      oprot.writeFieldBegin(field);
-      this.return_type.write(oprot);
-      oprot.writeFieldEnd();
-    }
-    if (this.arguments != null) {
-      field.name = "arguments";
-      field.type = TType.LIST;
-      field.id = 3;
-      oprot.writeFieldBegin(field);
-      {
-        oprot.writeListBegin(new TList(TType.STRUCT, this.arguments.size()));
-        for (Argument _iter3 : this.arguments)        {
-          _iter3.write(oprot);
-          oprot.writeListEnd();
-        }
-      }
-      oprot.writeFieldEnd();
-    }
-    oprot.writeFieldStop();
-    oprot.writeStructEnd();
-  }
-
-  public String toString() {
-    StringBuilder sb = new StringBuilder("Method(");
-    sb.append("name:");
-    sb.append(this.name);
-    sb.append(",return_type:");
-    sb.append(this.return_type.toString());
-    sb.append(",arguments:");
-    sb.append(this.arguments);
-    sb.append(")");
-    return sb.toString();
-  }
-
-}
-
diff --git a/lib/java/src/org/apache/thrift/reflection/limited/Service.java b/lib/java/src/org/apache/thrift/reflection/limited/Service.java
deleted file mode 100644
index dd5f901..0000000
--- a/lib/java/src/org/apache/thrift/reflection/limited/Service.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/**
- * Autogenerated by Thrift
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-package org.apache.thrift.reflection.limited;
-
-import java.util.ArrayList;
-import java.util.AbstractMap;
-import java.util.HashMap;
-import java.util.HashSet;
-import org.apache.thrift.*;
-
-import org.apache.thrift.protocol.*;
-import org.apache.thrift.transport.*;
-
-public class Service implements java.io.Serializable {
-  public String name;
-  public ArrayList<Method> methods;
-  public boolean fully_reflected;
-
-  public final Isset __isset = new Isset();
-  public static final class Isset {
-    public boolean name = false;
-    public boolean methods = false;
-    public boolean fully_reflected = false;
-  }
-
-  public Service() {
-  }
-
-  public Service(
-    String name,
-    ArrayList<Method> methods,
-    boolean fully_reflected)
-  {
-    this();
-    this.name = name;
-    this.__isset.name = true;
-    this.methods = methods;
-    this.__isset.methods = true;
-    this.fully_reflected = fully_reflected;
-    this.__isset.fully_reflected = true;
-  }
-
-  public void read(TProtocol iprot) throws TException {
-    TField field;
-    iprot.readStructBegin();
-    while (true)
-    {
-      field = iprot.readFieldBegin();
-      if (field.type == TType.STOP) {
-        break;
-      }
-      switch (field.id)
-      {
-        case 1:
-          if (field.type == TType.STRING) {
-            this.name = iprot.readString();
-            this.__isset.name = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 2:
-          if (field.type == TType.LIST) {
-            {
-              TList _list4 = iprot.readListBegin();
-              this.methods = new ArrayList<Method>(_list4.size);
-              for (int _i5 = 0; _i5 < _list4.size; ++_i5)
-              {
-                Method _elem6 = new Method();
-                _elem6 = new Method();
-                _elem6.read(iprot);
-                this.methods.add(_elem6);
-              }
-              iprot.readListEnd();
-            }
-            this.__isset.methods = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 3:
-          if (field.type == TType.BOOL) {
-            this.fully_reflected = iprot.readBool();
-            this.__isset.fully_reflected = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
-          break;
-      }
-      iprot.readFieldEnd();
-    }
-    iprot.readStructEnd();
-  }
-
-  public void write(TProtocol oprot) throws TException {
-    TStruct struct = new TStruct("Service");
-    oprot.writeStructBegin(struct);
-    TField field = new TField();
-    if (this.name != null) {
-      field.name = "name";
-      field.type = TType.STRING;
-      field.id = 1;
-      oprot.writeFieldBegin(field);
-      oprot.writeString(this.name);
-      oprot.writeFieldEnd();
-    }
-    if (this.methods != null) {
-      field.name = "methods";
-      field.type = TType.LIST;
-      field.id = 2;
-      oprot.writeFieldBegin(field);
-      {
-        oprot.writeListBegin(new TList(TType.STRUCT, this.methods.size()));
-        for (Method _iter7 : this.methods)        {
-          _iter7.write(oprot);
-          oprot.writeListEnd();
-        }
-      }
-      oprot.writeFieldEnd();
-    }
-    field.name = "fully_reflected";
-    field.type = TType.BOOL;
-    field.id = 3;
-    oprot.writeFieldBegin(field);
-    oprot.writeBool(this.fully_reflected);
-    oprot.writeFieldEnd();
-    oprot.writeFieldStop();
-    oprot.writeStructEnd();
-  }
-
-  public String toString() {
-    StringBuilder sb = new StringBuilder("Service(");
-    sb.append("name:");
-    sb.append(this.name);
-    sb.append(",methods:");
-    sb.append(this.methods);
-    sb.append(",fully_reflected:");
-    sb.append(this.fully_reflected);
-    sb.append(")");
-    return sb.toString();
-  }
-
-}
-
diff --git a/lib/java/src/org/apache/thrift/reflection/limited/SimpleType.java b/lib/java/src/org/apache/thrift/reflection/limited/SimpleType.java
deleted file mode 100644
index 3cbdd89..0000000
--- a/lib/java/src/org/apache/thrift/reflection/limited/SimpleType.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Autogenerated by Thrift
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-package org.apache.thrift.reflection.limited;
-
-import java.util.ArrayList;
-import java.util.AbstractMap;
-import java.util.HashMap;
-import java.util.HashSet;
-import org.apache.thrift.*;
-
-import org.apache.thrift.protocol.*;
-import org.apache.thrift.transport.*;
-
-public class SimpleType implements java.io.Serializable {
-  public int ttype;
-  public String name;
-
-  public final Isset __isset = new Isset();
-  public static final class Isset {
-    public boolean ttype = false;
-    public boolean name = false;
-  }
-
-  public SimpleType() {
-  }
-
-  public SimpleType(
-    int ttype,
-    String name)
-  {
-    this();
-    this.ttype = ttype;
-    this.__isset.ttype = true;
-    this.name = name;
-    this.__isset.name = true;
-  }
-
-  public void read(TProtocol iprot) throws TException {
-    TField field;
-    iprot.readStructBegin();
-    while (true)
-    {
-      field = iprot.readFieldBegin();
-      if (field.type == TType.STOP) {
-        break;
-      }
-      switch (field.id)
-      {
-        case 1:
-          if (field.type == TType.I32) {
-            this.ttype = iprot.readI32();
-            this.__isset.ttype = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 2:
-          if (field.type == TType.STRING) {
-            this.name = iprot.readString();
-            this.__isset.name = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
-          break;
-      }
-      iprot.readFieldEnd();
-    }
-    iprot.readStructEnd();
-  }
-
-  public void write(TProtocol oprot) throws TException {
-    TStruct struct = new TStruct("SimpleType");
-    oprot.writeStructBegin(struct);
-    TField field = new TField();
-    field.name = "ttype";
-    field.type = TType.I32;
-    field.id = 1;
-    oprot.writeFieldBegin(field);
-    oprot.writeI32(this.ttype);
-    oprot.writeFieldEnd();
-    if (this.name != null) {
-      field.name = "name";
-      field.type = TType.STRING;
-      field.id = 2;
-      oprot.writeFieldBegin(field);
-      oprot.writeString(this.name);
-      oprot.writeFieldEnd();
-    }
-    oprot.writeFieldStop();
-    oprot.writeStructEnd();
-  }
-
-  public String toString() {
-    StringBuilder sb = new StringBuilder("SimpleType(");
-    sb.append("ttype:");
-    sb.append(this.ttype);
-    sb.append(",name:");
-    sb.append(this.name);
-    sb.append(")");
-    return sb.toString();
-  }
-
-}
-
diff --git a/lib/java/src/org/apache/thrift/reflection/limited/TTypeTag.java b/lib/java/src/org/apache/thrift/reflection/limited/TTypeTag.java
deleted file mode 100644
index e196c78..0000000
--- a/lib/java/src/org/apache/thrift/reflection/limited/TTypeTag.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Autogenerated by Thrift
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-package org.apache.thrift.reflection.limited;
-
-
-public class TTypeTag {
-  public static final int T_VOID = 1;
-  public static final int T_BOOL = 2;
-  public static final int T_BYTE = 3;
-  public static final int T_I16 = 6;
-  public static final int T_I32 = 8;
-  public static final int T_I64 = 10;
-  public static final int T_DOUBLE = 4;
-  public static final int T_STRING = 11;
-  public static final int T_STRUCT = 12;
-  public static final int T_MAP = 13;
-  public static final int T_SET = 14;
-  public static final int T_LIST = 15;
-  public static final int T_ENUM = 101;
-  public static final int T_NOT_REFLECTED = 102;
-}
diff --git a/lib/java/src/org/apache/thrift/reflection/limited/ThriftType.java b/lib/java/src/org/apache/thrift/reflection/limited/ThriftType.java
deleted file mode 100644
index 91586df..0000000
--- a/lib/java/src/org/apache/thrift/reflection/limited/ThriftType.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * Autogenerated by Thrift
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-package org.apache.thrift.reflection.limited;
-
-import java.util.ArrayList;
-import java.util.AbstractMap;
-import java.util.HashMap;
-import java.util.HashSet;
-import org.apache.thrift.*;
-
-import org.apache.thrift.protocol.*;
-import org.apache.thrift.transport.*;
-
-public class ThriftType implements java.io.Serializable {
-  public boolean is_container;
-  public SimpleType simple_type;
-  public ContainerType container_type;
-
-  public final Isset __isset = new Isset();
-  public static final class Isset {
-    public boolean is_container = false;
-    public boolean simple_type = false;
-    public boolean container_type = false;
-  }
-
-  public ThriftType() {
-  }
-
-  public ThriftType(
-    boolean is_container,
-    SimpleType simple_type,
-    ContainerType container_type)
-  {
-    this();
-    this.is_container = is_container;
-    this.__isset.is_container = true;
-    this.simple_type = simple_type;
-    this.__isset.simple_type = true;
-    this.container_type = container_type;
-    this.__isset.container_type = true;
-  }
-
-  public void read(TProtocol iprot) throws TException {
-    TField field;
-    iprot.readStructBegin();
-    while (true)
-    {
-      field = iprot.readFieldBegin();
-      if (field.type == TType.STOP) {
-        break;
-      }
-      switch (field.id)
-      {
-        case 1:
-          if (field.type == TType.BOOL) {
-            this.is_container = iprot.readBool();
-            this.__isset.is_container = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 2:
-          if (field.type == TType.STRUCT) {
-            this.simple_type = new SimpleType();
-            this.simple_type.read(iprot);
-            this.__isset.simple_type = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 3:
-          if (field.type == TType.STRUCT) {
-            this.container_type = new ContainerType();
-            this.container_type.read(iprot);
-            this.__isset.container_type = true;
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
-          break;
-      }
-      iprot.readFieldEnd();
-    }
-    iprot.readStructEnd();
-  }
-
-  public void write(TProtocol oprot) throws TException {
-    TStruct struct = new TStruct("ThriftType");
-    oprot.writeStructBegin(struct);
-    TField field = new TField();
-    field.name = "is_container";
-    field.type = TType.BOOL;
-    field.id = 1;
-    oprot.writeFieldBegin(field);
-    oprot.writeBool(this.is_container);
-    oprot.writeFieldEnd();
-    if (this.simple_type != null) {
-      field.name = "simple_type";
-      field.type = TType.STRUCT;
-      field.id = 2;
-      oprot.writeFieldBegin(field);
-      this.simple_type.write(oprot);
-      oprot.writeFieldEnd();
-    }
-    if (this.container_type != null) {
-      field.name = "container_type";
-      field.type = TType.STRUCT;
-      field.id = 3;
-      oprot.writeFieldBegin(field);
-      this.container_type.write(oprot);
-      oprot.writeFieldEnd();
-    }
-    oprot.writeFieldStop();
-    oprot.writeStructEnd();
-  }
-
-  public String toString() {
-    StringBuilder sb = new StringBuilder("ThriftType(");
-    sb.append("is_container:");
-    sb.append(this.is_container);
-    sb.append(",simple_type:");
-    sb.append(this.simple_type.toString());
-    sb.append(",container_type:");
-    sb.append(this.container_type.toString());
-    sb.append(")");
-    return sb.toString();
-  }
-
-}
-
diff --git a/lib/py/setup.py b/lib/py/setup.py
index c727db4..00839a5 100644
--- a/lib/py/setup.py
+++ b/lib/py/setup.py
@@ -23,8 +23,6 @@
         'thrift.protocol',
         'thrift.transport',
         'thrift.server',
-        'thrift.reflection',
-        'thrift.reflection.limited',
       ],
       package_dir = {'thrift' : 'src'},
       ext_modules = [fastbinarymod],
diff --git a/lib/py/src/reflection/__init__.py b/lib/py/src/reflection/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/lib/py/src/reflection/__init__.py
+++ /dev/null
diff --git a/lib/py/src/reflection/limited/__init__.py b/lib/py/src/reflection/limited/__init__.py
deleted file mode 100644
index adefd8e..0000000
--- a/lib/py/src/reflection/limited/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-__all__ = ['ttypes', 'constants']
diff --git a/lib/py/src/reflection/limited/constants.py b/lib/py/src/reflection/limited/constants.py
deleted file mode 100644
index 2f17ec3..0000000
--- a/lib/py/src/reflection/limited/constants.py
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# Autogenerated by Thrift
-#
-# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
-#
-
-from thrift.Thrift import *
-from ttypes import *
-
diff --git a/lib/py/src/reflection/limited/ttypes.py b/lib/py/src/reflection/limited/ttypes.py
deleted file mode 100644
index f6e6398..0000000
--- a/lib/py/src/reflection/limited/ttypes.py
+++ /dev/null
@@ -1,535 +0,0 @@
-#
-# Autogenerated by Thrift
-#
-# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
-#
-
-from thrift.Thrift import *
-
-from thrift.transport import TTransport
-from thrift.protocol import TBinaryProtocol
-try:
-  from thrift.protocol import fastbinary
-except:
-  fastbinary = None
-
-
-class TTypeTag:
-  T_VOID = 1
-  T_BOOL = 2
-  T_BYTE = 3
-  T_I16 = 6
-  T_I32 = 8
-  T_I64 = 10
-  T_DOUBLE = 4
-  T_STRING = 11
-  T_STRUCT = 12
-  T_MAP = 13
-  T_SET = 14
-  T_LIST = 15
-  T_ENUM = 101
-  T_NOT_REFLECTED = 102
-
-class SimpleType:
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.I32, 'ttype', None, None, ), # 1
-    (2, TType.STRING, 'name', None, None, ), # 2
-  )
-
-  def __init__(self, d=None):
-    self.ttype = None
-    self.name = None
-    if isinstance(d, dict):
-      if 'ttype' in d:
-        self.ttype = d['ttype']
-      if 'name' in d:
-        self.name = d['name']
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.I32:
-          self.ttype = iprot.readI32();
-        else:
-          iprot.skip(ftype)
-      elif fid == 2:
-        if ftype == TType.STRING:
-          self.name = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('SimpleType')
-    if self.ttype != None:
-      oprot.writeFieldBegin('ttype', TType.I32, 1)
-      oprot.writeI32(self.ttype)
-      oprot.writeFieldEnd()
-    if self.name != None:
-      oprot.writeFieldBegin('name', TType.STRING, 2)
-      oprot.writeString(self.name)
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def __str__(self):
-    return str(self.__dict__)
-
-  def __repr__(self):
-    return repr(self.__dict__)
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
-class ContainerType:
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.I32, 'ttype', None, None, ), # 1
-    (2, TType.STRUCT, 'subtype1', (SimpleType, SimpleType.thrift_spec), None, ), # 2
-    (3, TType.STRUCT, 'subtype2', (SimpleType, SimpleType.thrift_spec), None, ), # 3
-  )
-
-  def __init__(self, d=None):
-    self.ttype = None
-    self.subtype1 = None
-    self.subtype2 = None
-    if isinstance(d, dict):
-      if 'ttype' in d:
-        self.ttype = d['ttype']
-      if 'subtype1' in d:
-        self.subtype1 = d['subtype1']
-      if 'subtype2' in d:
-        self.subtype2 = d['subtype2']
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.I32:
-          self.ttype = iprot.readI32();
-        else:
-          iprot.skip(ftype)
-      elif fid == 2:
-        if ftype == TType.STRUCT:
-          self.subtype1 = SimpleType()
-          self.subtype1.read(iprot)
-        else:
-          iprot.skip(ftype)
-      elif fid == 3:
-        if ftype == TType.STRUCT:
-          self.subtype2 = SimpleType()
-          self.subtype2.read(iprot)
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('ContainerType')
-    if self.ttype != None:
-      oprot.writeFieldBegin('ttype', TType.I32, 1)
-      oprot.writeI32(self.ttype)
-      oprot.writeFieldEnd()
-    if self.subtype1 != None:
-      oprot.writeFieldBegin('subtype1', TType.STRUCT, 2)
-      self.subtype1.write(oprot)
-      oprot.writeFieldEnd()
-    if self.subtype2 != None:
-      oprot.writeFieldBegin('subtype2', TType.STRUCT, 3)
-      self.subtype2.write(oprot)
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def __str__(self):
-    return str(self.__dict__)
-
-  def __repr__(self):
-    return repr(self.__dict__)
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
-class ThriftType:
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.BOOL, 'is_container', None, None, ), # 1
-    (2, TType.STRUCT, 'simple_type', (SimpleType, SimpleType.thrift_spec), None, ), # 2
-    (3, TType.STRUCT, 'container_type', (ContainerType, ContainerType.thrift_spec), None, ), # 3
-  )
-
-  def __init__(self, d=None):
-    self.is_container = None
-    self.simple_type = None
-    self.container_type = None
-    if isinstance(d, dict):
-      if 'is_container' in d:
-        self.is_container = d['is_container']
-      if 'simple_type' in d:
-        self.simple_type = d['simple_type']
-      if 'container_type' in d:
-        self.container_type = d['container_type']
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.BOOL:
-          self.is_container = iprot.readBool();
-        else:
-          iprot.skip(ftype)
-      elif fid == 2:
-        if ftype == TType.STRUCT:
-          self.simple_type = SimpleType()
-          self.simple_type.read(iprot)
-        else:
-          iprot.skip(ftype)
-      elif fid == 3:
-        if ftype == TType.STRUCT:
-          self.container_type = ContainerType()
-          self.container_type.read(iprot)
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('ThriftType')
-    if self.is_container != None:
-      oprot.writeFieldBegin('is_container', TType.BOOL, 1)
-      oprot.writeBool(self.is_container)
-      oprot.writeFieldEnd()
-    if self.simple_type != None:
-      oprot.writeFieldBegin('simple_type', TType.STRUCT, 2)
-      self.simple_type.write(oprot)
-      oprot.writeFieldEnd()
-    if self.container_type != None:
-      oprot.writeFieldBegin('container_type', TType.STRUCT, 3)
-      self.container_type.write(oprot)
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def __str__(self):
-    return str(self.__dict__)
-
-  def __repr__(self):
-    return repr(self.__dict__)
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
-class Argument:
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.I16, 'key', None, None, ), # 1
-    (2, TType.STRING, 'name', None, None, ), # 2
-    (3, TType.STRUCT, 'type', (ThriftType, ThriftType.thrift_spec), None, ), # 3
-  )
-
-  def __init__(self, d=None):
-    self.key = None
-    self.name = None
-    self.type = None
-    if isinstance(d, dict):
-      if 'key' in d:
-        self.key = d['key']
-      if 'name' in d:
-        self.name = d['name']
-      if 'type' in d:
-        self.type = d['type']
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.I16:
-          self.key = iprot.readI16();
-        else:
-          iprot.skip(ftype)
-      elif fid == 2:
-        if ftype == TType.STRING:
-          self.name = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 3:
-        if ftype == TType.STRUCT:
-          self.type = ThriftType()
-          self.type.read(iprot)
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('Argument')
-    if self.key != None:
-      oprot.writeFieldBegin('key', TType.I16, 1)
-      oprot.writeI16(self.key)
-      oprot.writeFieldEnd()
-    if self.name != None:
-      oprot.writeFieldBegin('name', TType.STRING, 2)
-      oprot.writeString(self.name)
-      oprot.writeFieldEnd()
-    if self.type != None:
-      oprot.writeFieldBegin('type', TType.STRUCT, 3)
-      self.type.write(oprot)
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def __str__(self):
-    return str(self.__dict__)
-
-  def __repr__(self):
-    return repr(self.__dict__)
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
-class Method:
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.STRING, 'name', None, None, ), # 1
-    (2, TType.STRUCT, 'return_type', (ThriftType, ThriftType.thrift_spec), None, ), # 2
-    (3, TType.LIST, 'arguments', (TType.STRUCT,(Argument, Argument.thrift_spec)), None, ), # 3
-  )
-
-  def __init__(self, d=None):
-    self.name = None
-    self.return_type = None
-    self.arguments = None
-    if isinstance(d, dict):
-      if 'name' in d:
-        self.name = d['name']
-      if 'return_type' in d:
-        self.return_type = d['return_type']
-      if 'arguments' in d:
-        self.arguments = d['arguments']
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.STRING:
-          self.name = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 2:
-        if ftype == TType.STRUCT:
-          self.return_type = ThriftType()
-          self.return_type.read(iprot)
-        else:
-          iprot.skip(ftype)
-      elif fid == 3:
-        if ftype == TType.LIST:
-          self.arguments = []
-          (_etype3, _size0) = iprot.readListBegin()
-          for _i4 in xrange(_size0):
-            _elem5 = Argument()
-            _elem5.read(iprot)
-            self.arguments.append(_elem5)
-          iprot.readListEnd()
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('Method')
-    if self.name != None:
-      oprot.writeFieldBegin('name', TType.STRING, 1)
-      oprot.writeString(self.name)
-      oprot.writeFieldEnd()
-    if self.return_type != None:
-      oprot.writeFieldBegin('return_type', TType.STRUCT, 2)
-      self.return_type.write(oprot)
-      oprot.writeFieldEnd()
-    if self.arguments != None:
-      oprot.writeFieldBegin('arguments', TType.LIST, 3)
-      oprot.writeListBegin(TType.STRUCT, len(self.arguments))
-      for iter6 in self.arguments:
-        iter6.write(oprot)
-      oprot.writeListEnd()
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def __str__(self):
-    return str(self.__dict__)
-
-  def __repr__(self):
-    return repr(self.__dict__)
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
-class Service:
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.STRING, 'name', None, None, ), # 1
-    (2, TType.LIST, 'methods', (TType.STRUCT,(Method, Method.thrift_spec)), None, ), # 2
-    (3, TType.BOOL, 'fully_reflected', None, None, ), # 3
-  )
-
-  def __init__(self, d=None):
-    self.name = None
-    self.methods = None
-    self.fully_reflected = None
-    if isinstance(d, dict):
-      if 'name' in d:
-        self.name = d['name']
-      if 'methods' in d:
-        self.methods = d['methods']
-      if 'fully_reflected' in d:
-        self.fully_reflected = d['fully_reflected']
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.STRING:
-          self.name = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 2:
-        if ftype == TType.LIST:
-          self.methods = []
-          (_etype10, _size7) = iprot.readListBegin()
-          for _i11 in xrange(_size7):
-            _elem12 = Method()
-            _elem12.read(iprot)
-            self.methods.append(_elem12)
-          iprot.readListEnd()
-        else:
-          iprot.skip(ftype)
-      elif fid == 3:
-        if ftype == TType.BOOL:
-          self.fully_reflected = iprot.readBool();
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('Service')
-    if self.name != None:
-      oprot.writeFieldBegin('name', TType.STRING, 1)
-      oprot.writeString(self.name)
-      oprot.writeFieldEnd()
-    if self.methods != None:
-      oprot.writeFieldBegin('methods', TType.LIST, 2)
-      oprot.writeListBegin(TType.STRUCT, len(self.methods))
-      for iter13 in self.methods:
-        iter13.write(oprot)
-      oprot.writeListEnd()
-      oprot.writeFieldEnd()
-    if self.fully_reflected != None:
-      oprot.writeFieldBegin('fully_reflected', TType.BOOL, 3)
-      oprot.writeBool(self.fully_reflected)
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def __str__(self):
-    return str(self.__dict__)
-
-  def __repr__(self):
-    return repr(self.__dict__)
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
diff --git a/test/DebugProtoTest.thrift b/test/DebugProtoTest.thrift
index e8eb9a3..2d2e120 100644
--- a/test/DebugProtoTest.thrift
+++ b/test/DebugProtoTest.thrift
@@ -82,16 +82,6 @@
   i32 Janky(i32 arg)
 }
 
-service PartiallyReflectable {
-  map<i32,map<i32,i32>> returnNotReflectable(1: i32 hello),
-  void argNotReflectable(1: list<set<i32>> arg),
-  void arg2NotReflectable(1: i32 arg1, 2: list<set<i32>> argNotReflectable),
-  void withMap(1: map<i32, string> amap),
-
-  OneOfEach refl1(1: list<Bonk> arg1),
-  OneOfEach refl2(2: list<string> arg1, 1: Bonk arg2);
-}
-
 // The only purpose of this thing is to increase the size of the generated code
 // so that ZlibTest has more highly compressible data to play with.
 struct BlowUp {
diff --git a/test/DenseLinkingTest.thrift b/test/DenseLinkingTest.thrift
index 787c501..90f0bd6 100644
--- a/test/DenseLinkingTest.thrift
+++ b/test/DenseLinkingTest.thrift
@@ -71,13 +71,3 @@
 service Srv {
   i32 Janky(i32 arg)
 }
-
-service PartiallyReflectable {
-  map<i32,map<i32,i32>> returnNotReflectable(1: i32 hello),
-  void argNotReflectable(1: list<set<i32>> arg),
-  void arg2NotReflectable(1: i32 arg1, 2: list<set<i32>> argNotReflectable),
-  void withMap(1: map<i32, string> amap),
-
-  OneOfEachZZ refl1(1: list<BonkZZ> arg1),
-  OneOfEachZZ refl2(2: list<string> arg1, 1: BonkZZ arg2);
-}
diff --git a/test/Makefile.am b/test/Makefile.am
index 0c201c1..5f2ce8d 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -13,7 +13,6 @@
 	gen-cpp/DebugProtoTest_types.cpp \
 	gen-cpp/OptionalRequiredTest_types.cpp \
 	gen-cpp/DebugProtoTest_types.cpp \
-	gen-cpp/PartiallyReflectable.cpp \
 	gen-cpp/Service.cpp \
 	gen-cpp/StressTest_types.cpp \
 	gen-cpp/SecondService.cpp \
@@ -37,7 +36,6 @@
 	DebugProtoTest \
 	JSONProtoTest \
 	OptionalRequiredTest \
-	ReflectionTest \
 	UnitTests
 
 TESTS = \
@@ -96,29 +94,21 @@
 
 
 #
-# ReflectionTest
-#
-ReflectionTest_SOURCES = \
-	ReflectionTest.cpp
-
-ReflectionTest_LDADD = libtestgencpp.la
-
-#
 # Common thrift code generation rules
 #
 THRIFT = $(top_builddir)/compiler/cpp/thrift
 
-gen-cpp/DebugProtoTest_types.cpp gen-cpp/PartiallyReflectable.cpp: DebugProtoTest.thrift
-	$(THRIFT) --gen cpp:dense,reflection_limited $<
+gen-cpp/DebugProtoTest_types.cpp: DebugProtoTest.thrift
+	$(THRIFT) --gen cpp:dense $<
 
 gen-cpp/OptionalRequiredTest_types.cpp: OptionalRequiredTest.thrift
 	$(THRIFT) --gen cpp:dense $<
 
 gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp: StressTest.thrift
-	$(THRIFT) --gen cpp:dense,reflection_limited $<
+	$(THRIFT) --gen cpp:dense $<
 
 gen-cpp/SecondService.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp: ThriftTest.thrift
-	$(THRIFT) --gen cpp:dense,reflection_limited $<
+	$(THRIFT) --gen cpp:dense $<
 
 INCLUDES = \
 	-I$(top_srcdir)/lib/cpp/src
diff --git a/test/ReflectionTest.cpp b/test/ReflectionTest.cpp
deleted file mode 100644
index c670c82..0000000
--- a/test/ReflectionTest.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <iostream>
-#include "gen-cpp/PartiallyReflectable.h"
-#include "gen-cpp/Service.h"
-#include "../lib/cpp/src/protocol/TDebugProtocol.h"
-
-int main() {
-  using std::cout;
-  using std::endl;
-
-  apache::thrift::reflection::limited::Service srv1;
-  thrift::test::debug::PartiallyReflectableIf::getStaticLimitedReflection(srv1);
-  cout << apache::thrift::ThriftDebugString(srv1) << endl << endl;
-
-  apache::thrift::reflection::limited::Service srv2;
-  test::stress::ServiceIf::getStaticLimitedReflection(srv2);
-  cout << apache::thrift::ThriftDebugString(srv2) << endl << endl;
-
-  return 0;
-}
