This has been leaking memory in the compiler, but it has also been
preventing the dynamic generators destructors from being called.
This can prevent a stream from being flushed properly.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665586 13f79535-47bb-0310-9956-ffa450edef68
The "if" block here always results in a return (or an exception),
so there is no need for an "else". We can just put the rest of the code
under the "if" block. This actually makes a little more sense because
the "if" block here is an exceptional case.
Also deleted a stale comment.
Reviewed By: lhastings
Test Plan: diff'ed the old and new code.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665580 13f79535-47bb-0310-9956-ffa450edef68
Summary: Otherwise, readMessageEnd will be performed twice; once in the extension and once in PHP-land. Since TBinaryProtocol readMessageEnd is a no-op this isn't a huge deal, but it's bad style.
Reviewed By: mcslee
Test Plan: Inspect generated php code
Revert: OK
TracCamp Project: Thrift
DiffCamp Revision: 9155
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665567 13f79535-47bb-0310-9956-ffa450edef68
Summary:
All PHP serialization and deserialization can now happen in extension-land,
which should be much faster. This includes reading message headers and all
complex types (structs, exceptions, whatever).
The compiler has been updated to always emit the $_TSPEC static array for
generated PHP code, since the new extension depends on it.
As before, the PHP code gates enabling the accelerated serialization on
the protocol being an instance of TBinaryProtocolAcclerated and the function
for the [de]serialization operation existing.
The function names have changed since the last version of the extension,
so old and new generated code can coexist, and new generated code can run on
a server with the old extension (but it will not use accelerated serialization).
Reviewed by: hzhao
Test Plan: Generated a couple of endpoints and called their services through the
new extension. Both use a variety of nested complex types. Built and ran the
extension in php-5.2.3 in debug mode, killed the reported memory leaks.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665548 13f79535-47bb-0310-9956-ffa450edef68
This feature is turned off by default because it adds a new dependency:
Apache Commons Lang. This package seems enough like Boost that
I would be open to turning this feature on by default.
Also updated test/java/build.xml to use this new option.
ant test still passes.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665542 13f79535-47bb-0310-9956-ffa450edef68
- Add a new method to t_java_generator that generates a .equals() method.
- Add a correct but useless implementation of hashCode for structs.
(This is required by conventino when overriding .equals().)
- Add java_package to DebugProtoTest and OptionalRequiredTest.
- Add a new structure to OptionalRequiredTest to assist testing the behavior
of .equals() with respect to null and unset fields.
- Clean up test/java/build.xml a bit. (It still has a ways to go.)
- Add EqualityTest.java to test .equals().
- Add IdentityTest.java to test that writing and reading a structure
preserves equality.
Tested by runnint atn test.
I also looked at the generated code for OptionalRequiredTest.thrift.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665541 13f79535-47bb-0310-9956-ffa450edef68
Summary:
I thought I had eliminated all the places where work was only done
if cpp_use_include_path was set. I guess I missed one.
Reviewed By: mcslee, mrabkin, kholst
Test Plan:
Built BigGrep and looked at the generated code.
Revert Plan: ok
DiffCamp Revision: 8375
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665530 13f79535-47bb-0310-9956-ffa450edef68
Some people want to use sets of Thrift structs. This has interesting
implications, but it is a reasonable request. However, in C++,
this requires structures to have a less-than operator.
It seems a little dangerous to auto-generate an arbitrary comparator,
but allowing users to define their own operator< implementations
seems fine. This change makes that a lot easier.
The one downside of this change is that developers who try to compare
structures with operator< (including trying to make sets of them)
will now get a linker error instead of a compiler error.
However, the old compiler error was so scary that
I'm not sure this is any worse.
Reviewed By: kholst, mcslee
Test Plan: make check
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665527 13f79535-47bb-0310-9956-ffa450edef68
Limited reflection is deprecated, and it is slowing down compilation.
This change will disable generation of static reflection by default,
but it adds a command line argument to re-enable it.
Tested by running make check and building the C++ test client and server.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665520 13f79535-47bb-0310-9956-ffa450edef68
- Make the Java generator use program->get_namespace("java")
instead of program->get_java_namespace()
- Eliminate the explicit "java_namespace" in t_program.
- Deprecate the java_namespace token.
- Update example .thrift files and syntax files.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665514 13f79535-47bb-0310-9956-ffa450edef68
- Make the C++ generator use program->get_namespace("cpp")
instead of program->get_cpp_namespace()
- Eliminate the explicit "cpp_namespace" in t_program.
- Deprecate the cpp_namespace token.
- Update example .thrift files and syntax files.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665513 13f79535-47bb-0310-9956-ffa450edef68
Altered the once-deprecated "namespace" directive in .thrift files
to take two identifiers: the language and the namespace.
They are stored in a map inside of the program object.
Future changes will convert specific generators to use this map
and deprecate the old language-specific tokens.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665512 13f79535-47bb-0310-9956-ffa450edef68
t_java_generator.h is no longer included anywhere, because
the Java generator uses the new dynamic generator framework.
Therefore, we can collapse the class definition into the .cc file.
Also cleaned up its includes a little bit.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665511 13f79535-47bb-0310-9956-ffa450edef68
- Modify the Java generator constructor to fit the new generic interface.
- Register the Java genrator with the central registry.
- Deprecate the old way of invoking the Java generator.
- main.cc no longer includes t_java_generator.h.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665510 13f79535-47bb-0310-9956-ffa450edef68
t_cpp_generator.h is no longer included anywhere, because
the C++ generator uses the new dynamic generator framework.
Therefore, we can collapse the class definition into the .cc file.
Also cleaned up its includes a little bit.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665509 13f79535-47bb-0310-9956-ffa450edef68
- Modify the C++ generator constructor to fit the new generic interface.
- Register the C++ genrator with the central registry.
- Deprecate the old way of invoking the C++ generator.
- main.cc no longer includes t_cpp_generator.h.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665508 13f79535-47bb-0310-9956-ffa450edef68
Add a generic and easy-to-use mechanism for Thrift code generators to
register themselves centrally. The central registry is used to
obtain documentation for the options accepted by individual generators
and get instances of individual generators. It also does a little bit of
option parsing that will be useful for all generators.
Obviously, this change cannot be tested on its own. I can only say
that Thrift still builds and runs correctly. Subsequent changes
will apply this infrastructure to specific code generators.
Steve Grimm has assured me that this is standard Git practice.
In fact, I ran this test after converting the C++ and Java generators:
dreiss@dreiss-vmware:dynamic_generators:thrift/test$ mkdir old new
dreiss@dreiss-vmware:dynamic_generators:thrift/test$ cd old
dreiss@dreiss-vmware:dynamic_generators:thrift/test/old$ ../../compiler/cpp/thrift -cpp -dense -java -javabean ../DebugProtoTest.thrift
[WARNING::1] -cpp is deprecated. Use --gen cpp
[WARNING::1] -java is deprecated. Use --gen java
[WARNING::1] -javabean is deprecated. Use --gen java:beans
dreiss@dreiss-vmware:dynamic_generators:thrift/test/old$ cd ../new/
dreiss@dreiss-vmware:dynamic_generators:thrift/test/new$ ../../compiler/cpp/thrift --gen cpp:dense --gen java --gen java:beans ../DebugProtoTest.thrift
dreiss@dreiss-vmware:dynamic_generators:thrift/test/new$ cd ..
dreiss@dreiss-vmware:dynamic_generators:thrift/test$ diff -ur old/ new/
dreiss@dreiss-vmware:dynamic_generators:thrift/test$
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665507 13f79535-47bb-0310-9956-ffa450edef68
Reviewed by: mcslee
Warning and error messages from the Thrift compiler include
the file currently being parsed and the line number.
This change sets those to dummy values for stages that
have nothing to do with parsing.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665506 13f79535-47bb-0310-9956-ffa450edef68
For Thrift exceptions that contain only a single string field, integrate
these even more tightly with Ruby exceptions by aliasing Ruby's
Exception#message field with the Thrift field.
Ruby exception objects created by Thrift will now display properly in
Ruby backtraces, etc. without any special handling by client code.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665503 13f79535-47bb-0310-9956-ffa450edef68
Rather than the generated code needing to handle simple fielded
creation of objects, the ThriftStruct module constructor is extended to
handle hash arguments. Statements such as
o = ThriftObject.new :field1 => value1, :field2 => value2, ...
are supported as before, and the string form,
o = ThriftObject.new "field1" => value1, "field2" => value2, ...
disabled by the previous patch now also works.
Placing this code in the module is also just a cleaner solution.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665502 13f79535-47bb-0310-9956-ffa450edef68
The Ruby exception constructor is modified to accept 0 arguments, which is
how Thrift library code creates exception objects. Without this fix, Thrift
Ruby clients that receive exception objects crash.
The call to super (resolving to ThriftStruct#initialize) is retained, but
is called with the default value (an empty hash) instead of passing the
message along.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665501 13f79535-47bb-0310-9956-ffa450edef68
Summary:
make-generic is some sort of internal undocumented thing.
make-local is what is supposed to be used for this stuff.
Also use $(RM) instead of "rm -f".
Reviewed By: marc
Test Plan: make clean
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665498 13f79535-47bb-0310-9956-ffa450edef68
Actually, it is not a typo. The original authors didn't convert one call
to get_java_package to get_csharp_namespace.
Tested by building Thrift.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665489 13f79535-47bb-0310-9956-ffa450edef68
Summary:
The upcoming TJSONProtocol handles string and binary types quite differently.
This change makes that distinction in all parts of the C++ binding.
Java already distinguished between string and binary, but this change
also updates the Java skip method to skip over strings as binary
so we don't get encoding errors when skipping binary data.
Reviewed By: mcslee
Test Plan: make check
Revert Plan: ok
Other Notes:
I just pulled this out of Chad Walters' JSON patch.
The only other change was adding readBinary (or was it writeBinary)
to TDenseProtocol. Maybe inheriting from TBinaryProtocol wasn't a good idea.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665481 13f79535-47bb-0310-9956-ffa450edef68
Summary: introducing a $bin_accel variable in struct reader scope that
can be reference by the deserializers of each field
Reviewed By: dreiss, mcslee
Test Plan: regenerated a thrift service, compared before and after calls
Revert Plan: sure
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665478 13f79535-47bb-0310-9956-ffa450edef68
Summary: getTransport is now a method of Protocol. To flush the transport one does tflush (getTransport p) instead of pflush p. This is more like how it is done with other languages.
Reviewed By: dcorson
Test Plan: Ran thrifttest for haskell.
Revert: OK
DiffCamp Revision: 7515
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665473 13f79535-47bb-0310-9956-ffa450edef68
Summary:
References to "local reflections" in other thrift files were not given
namespace prefixes, give undefined symbol errors. This change
distinguishes between relfection names being generated for declarations
(not namespaced) and those that could be external references (namespaced).
Reviewed By: mcslee
Test Plan:
Got the following files to build and link correctly with -dense.
==> test1.thrift <==
cpp_namespace ns
enum foo { bar }
==> test2.thrift <==
include "test1.thrift"
enum dummy_enum_workaround { I_AM_A_WORKAROUND }
struct baz {
1: test1.foo qux
}
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665472 13f79535-47bb-0310-9956-ffa450edef68
Summary: Not AbstractMap or HashSet, etc. use Map, List, Set
Reviewed By: dreiss
Test Plan: Generate Java code and build java tests
Other Notes: Submitted by Seth Falcon
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665470 13f79535-47bb-0310-9956-ffa450edef68