Commit graph

649 commits

Author SHA1 Message Date
Jon Skeet
e2368c9022 Fix attribute mistake and regenerate code. 2015-07-22 13:47:16 +01:00
Jon Skeet
4668c3dc39 Remove the usage of attributes for field/method discovery.
Instead, introduce GeneratedCodeInfo which passes in what we need, and adjust the codegen to take account of this.
2015-07-22 11:38:22 +01:00
Jon Skeet
53c399a1d6 Revamp to reflection.
Changes in brief:
1. Descriptor is now the entry point for all reflection.
2. IReflectedMessage has gone; there's now a Descriptor property in IMessage, which is explicitly implemented (due to the static property).
3. FieldAccessorTable has gone away
4. IFieldAccessor and OneofFieldAccessor still exist; we *could* put the functionality straight into FieldDescriptor and OneofDescriptor... I'm unsure about that.
5. There's a temporary property MessageDescriptor.FieldAccessorsByFieldNumber to make the test changes small - we probably want this to go away
6. Discovery for delegates is now via attributes applied to properties and the Clear method of a oneof

I'm happy with 1-3.
4 I'm unsure about - feedback welcome.
5 will go away
6 I'm unsure about, both in design and implementation. Should we have a ProtobufMessageAttribute too? Should we find all the relevant attributes in MessageDescriptor and pass them down, to avoid an O(N^2) scenario?

Generated code changes coming in the next commit.
2015-07-21 12:59:40 +01:00
Jon Skeet
2ee4b56655 Merge pull request #629 from google/master
Integrate changes from upstream/master into csharp-experimental
2015-07-21 12:58:43 +01:00
Jisi Liu
d119a27549 Merge pull request #621 from nico/staticass
Let GOOGLE_COMPILE_ASSERT use static_assert if available.
2015-07-20 17:36:00 -07:00
Joshua Haberman
aba42edd8c Merge pull request #604 from haberman/ruby-conformance
Added Ruby to conformance tests.
2015-07-20 11:06:17 -07:00
Jisi Liu
58035596e7 Merge pull request #622 from pherl/splitheaders
Addming missing includes in stubs headers.
2015-07-17 15:40:42 -07:00
Jisi Liu
51053120db Addming missing includes in stubs headers.
This is to prepare removing those additional headers in common.h

Change-Id: I707d6d8eaf193eb28195a827c7fec738b968ab3e
2015-07-17 15:40:03 -07:00
Nico Weber
56a90a2081 Let GOOGLE_COMPILE_ASSERT use static_assert if available.
The motivation is that gcc 4.8+ and clang trunk warn on unused local
typedefs, which COMPILE_ASSERT adds. After this change, the warning
will be happy at least in C++11 builds. static_assert also produces a
slighly nicer diagnostic than the typedef method.

eb93e8bc43
did the same change in re2.
2015-07-17 14:18:36 -07:00
Jisi Liu
798ed10e7a Merge pull request #613 from pherl/splitheaders
Split up common.h headers
2015-07-17 13:57:59 -07:00
Jie Luo
7648852550 Merge pull request #601 from anandolee/master
ignore UTF-8 BOM
2015-07-17 13:23:29 -07:00
Jisi Liu
4dde2a87a9 Merge branch 'master' of github.com:google/protobuf into splitheader
Change-Id: I5f6cbc2430200e3751ad754cc7ae604338db6f91
2015-07-17 11:36:29 -07:00
Jisi Liu
7b216119ee Update make file for extra headers.
Change-Id: Ifbc415755266ba3d0ffa5661fcd7c7d2e3b32a22
2015-07-17 11:34:33 -07:00
Jon Skeet
0f442a7533 Merge pull request #611 from jskeet/csharp-wrappers
C# wrapper types
2015-07-17 07:29:50 +01:00
Jon Skeet
34878cb14e Fixes from PR review. 2015-07-17 06:41:46 +01:00
Jan Tattermusch
fa544f4835 Merge pull request #586 from jtattermusch/csharp_names_export
Export c# naming routines publicly
2015-07-16 17:33:56 -07:00
Jisi Liu
4e694f7b23 Split up common.h headers
Change-Id: I223783111d743aa5193bf70fa1b9b54c7b4389c3
2015-07-16 16:49:38 -07:00
Josh Haberman
181c7f2636 Added Ruby to conformance tests.
This involved fixing a few important bugs in the
Ruby implementation -- mostly cases of mixing
upb field types and descriptor types (upb field
types do not distinguish between int/sint/fixed/sfixed
like descriptor types do).

Also added protobuf-specific exceptions so parse
errors can be caught specifically.

Change-Id: Ib49d3db976900b2c6f3455c8b88af52cfb86e036
2015-07-16 12:25:55 -07:00
Jie Luo
b2d2cf8b48 ignore UTF-8 BOM if it is in the begining of a proto file 2015-07-16 11:59:21 -07:00
Jon Skeet
8a0312b201 First pass at wrapper types.
- We do still generate the message types, as otherwise reflection breaks, even though it doesn't actually use those types.
- JSON handling hasn't been implemented yet
2015-07-16 17:03:06 +01:00
Jon Skeet
b2ac868493 First part of implementing wrapper types. Not ready yet! 2015-07-16 09:36:30 +01:00
Jan Tattermusch
11002e70c6 Merge remote-tracking branch 'upstream/master' into csharp-experimental 2015-07-15 20:33:59 -07:00
Jon Skeet
db52c9dd58 Address requested change from code review. 2015-07-15 22:04:45 +01:00
Jon Skeet
541b442b99 Don't create nested types (or field accessors) for map types.
I'm sure I've implemented this before, but somehow it's been lost in a maze of twisty little branches, all alike.
2015-07-15 22:04:45 +01:00
Rob Earhart
2f4fb642a3 Install missing headers
Install google/protobuf/stubs/status.h, and google/protobuf/stubs/stringpiece.h -- these are required in order to include google/protobuf/util/type_resolver.h.

Install google/protobuf/stubs/bytestream.h -- this is required in order to include google/protobuf/util/json_util.h.
2015-07-14 17:17:52 -07:00
Jon Skeet
739d13d5d1 Generate the well-known types in C#
This involves:
- Specifying a namespace in each proto (including ones we'd previously missed)
- Updating the generation script
- Changing codegen to implement IReflectedMessage.Fields explicitly (a good thing anyway)
- Changing reflection tests to take account of the explicit interface implementation

Non-generated code in this commit; generated code to follow
2015-07-14 14:26:31 +01:00
Jon Skeet
9c888fa3a2 Changing reflection namespace (part 3)
Change the C# namespace in descriptor.proto to Google.Protobuf.Reflection.
This then means changing where the generated code lives, which means updating the project file...

It also involves regenerating the C++ - which has updated the well-known types as well,
for no terribly obvious reason...
2015-07-14 11:13:52 +01:00
Jon Skeet
9f37de960f Changing reflection namespace (part 1)
- Move types into Google.Protobuf.Reflection
- Change codegen to reflect that in generated types

Generated code changes coming in part 2
2015-07-14 10:24:52 +01:00
Jon Skeet
8482b6c462 Convert package name to PascalCase for C# namespace
Fixes issue 312.
2015-07-14 09:52:35 +01:00
Jan Tattermusch
cacbedf04e export c# naming routines publicly 2015-07-10 13:40:34 -07:00
Jon Skeet
ef3464dff6 Oneof reflection support. (Generated code changes in next commit.) 2015-07-10 14:04:53 +01:00
Jon Skeet
5b9288e47d Use the new JsonFormatter to implement ToString on generated messages. 2015-07-10 11:42:56 +01:00
Bo Yang
9f563bd0d8 Internal local modifications. 2015-07-09 12:39:52 -07:00
Jon Skeet
493e3db985 Codegen changes to support descriptor runtime changes
- Add a partial method called by all constructors
- Generate internal classes for descriptor.proto (only)
- Forbid proto2 descriptors except for descriptor.proto
2015-07-09 08:26:04 +01:00
Jon Skeet
78ea98f56f Implement reflection properly for fields.
- FieldAccessorTable is now non-generic
- We don't have a static field per message type in the umbrella class. (Message descriptors are accessed via the file descriptor.)
- Removed the "descriptor assigner" complication from the descriptor fixup; without extensions, we don't need it
- MapField implements IDictionary (more tests would be good...)
- RepeatedField implements IList (more tests would be good)
- Use expression trees to build accessors. (Will need to test this on various platforms... probably need a fallback strategy just using reflection directly.)
- Added FieldDescriptor.IsMap
- Added tests for reflection with generated messages

Changes to generated code coming in next commit.
2015-07-09 08:24:49 +01:00
Paul Yang
0a27430bd4 Merge pull request #500 from TeBoring/temp
Implement parsing for proto3 primitive repeated fields.
2015-07-01 14:35:19 -07:00
Feng Xiao
ec7bbc76be Merge pull request #551 from ostrovsky/master
MinGW64+MSYS2 compilation issues
2015-07-01 10:36:30 -07:00
Karol Ostrovsky
ee35402244 MinGW64+MSYS2 compilation issues and portable isnan using MathLimits 2015-07-01 10:09:41 +02:00
Paul Yang
eb162dad5f Merge pull request #458 from xfxyjwf/memory_leak
Delete default UnknownFieldSet when shuting down.
2015-06-30 16:45:22 -07:00
Jon Skeet
38d8d3948a Remove unused code in C# codegen 2015-06-30 18:43:57 +01:00
Jon Skeet
f2a27cc2c7 First pass (not yet compiling) at removing all the array handling code from Coded*Stream.
Prod code works, but some tests are broken. Obviously those need fixing, then more tests,
and review benchmarks.
2015-06-30 13:20:30 +01:00
Matt Giuca
43dcbbfec7 Fix "sometimes-uninitialized" warning on Windows Clang. 2015-06-30 17:23:26 +10:00
Jon Skeet
8d83f8d13e Fix for doubly-nested types - issue #307.
No specific test case - if the generated code compiles, the issue is fixed :)
2015-06-29 09:27:54 +01:00
Jon Skeet
fb77cc9d9f More cleanup, based around searches for "Google.ProtocolBuffers"
- Remove some old proto2-based C#-only messages
- Remove the "build" directory which only contained out-of-date files
- Remove the csharp_namespace option from proto2 messages
- Change "Google.ProtocolBuffers" to "Google.Protobuf" in other messages
2015-06-26 20:13:07 +01:00
Jon Skeet
c12833104f Tweaks and more tests for maps
- Change the default message hash code to 1 to be consistent with other code
- Change the empty list/map hash code to 0 as "empty map" is equivalent to "no map"
- Removed map fields from unittest_proto3.proto
- Created map_unittest_proto3.proto which is like map_unittest.proto but proto3-only
- Fixed factory methods in FieldCodec highlighted by using all field types :)
- Added tests for map serialization:
  - Extra fields within entries
  - Entries with value then key
  - Non-contiguous entries for the same map
  - Multiple entries for the same key

Changes to generated code coming in next commit
2015-06-26 10:32:23 +01:00
Jon Skeet
df44ae4413 More map tests, and various production code improvements.
Generated code in next commit.
2015-06-25 12:08:18 +01:00
Jon Skeet
0d684d3420 First pass at map support.
More tests required. Generated code in next commit.
2015-06-25 09:39:28 +01:00
Jon Skeet
d487c322de Regenerated descriptor C++ code 2015-06-25 08:22:56 +01:00
Jisi Liu
658e72d8fb fix compiler warnings.
- control reaches end of non-void function.
- remove a deprecated IsMatch.

Change-Id: Ifdeb15879bbcf591c48dc7fda1cd8994bdf87bb3
2015-06-24 14:56:58 -07:00
Jon Skeet
322ec53161 Revert the change to wire_format.h.
It seems too much code relies on the broken behaviour. See issue #493.
Instead, we reimplement MakeTag just for C#, temporarily.
2015-06-24 17:56:22 +01:00