Commit Graph

61 Commits

Author SHA1 Message Date
Jisi Liu
5dea2017db Update version numbers for other languages 2016-05-10 15:43:39 -07:00
Feng Xiao
7d075a44c1 Update version number and fix javadoc errors. 2016-01-06 15:47:41 -08:00
Feng Xiao
ffe9215140 Update version number.
Protoc, C++ runtime and Java runtime are updated to v3.0.0-beta-1, other
languages are updated to v3.0.0-alpha-4.
2015-08-26 15:11:43 -07:00
Xiao Hang
ebcd51ce0f Merge branch 'master' of https://github.com/zsurocking/protobuf 2015-08-04 14:30:39 -07:00
Xiao Hang
801e92007f Generate a package name suffix ".nano" for nano messages
Also introducing an option javanano_use_deprecated_package to allow users to disable the suffix
2015-07-29 15:10:56 -07:00
Feng Xiao
3f9be70d06 Merge pull request #361 from brianduff/sync_aosp
Speed up little endian int/long writes.
2015-06-06 00:44:39 -07:00
Bo Yang
252daef02b Add distributionManagement explicitly to prevent maven from using
default configuration. In default configuration, maven needs webdav for
deployment, which cannot be found in central repository.
2015-05-29 16:32:04 -07:00
Bo Yang
e107e2d68e Update version number to 3.0.0-alpha-4 2015-05-29 11:00:57 -07:00
teboring
9839c0c2c9 Update version number to 3.0.0-alpha-3 2015-05-23 09:20:23 -07:00
Jeff Davidson
695715ad93 Speed up little endian int/long writes.
Bug: 20636336
Change-Id: I303d712967f9885f7c3082d00f961f8ab93a6aed
2015-05-11 16:14:00 -07:00
Andre Eisenbach
15bff99de6 Handle 0-length byte buffers in micro and nano protobufs
Change-Id: I845ee1ab1005d25c8d77a8c2ed801c0f7b7c847b
2015-05-04 17:58:26 -07:00
Charles Munger
6732dd7e58 Throw OutOfSpaceException instead of IllegalArgumentException.
When a MessageNano containing a String is serialized into a buffer that
is too small to contain it, and the buffer's boundary happens to be
where the string field's length delimiting varint is serialized,
and the string's length and 3*length have the same length when
encoded as a varint, an IllegalArgumentException is thrown rather than
an OutOfSpaceException.

Github issue: https://github.com/google/protobuf/issues/292

Change-Id: If478d68cf15bfd0662252d008e42b2bf1ff1c75e
2015-04-28 13:10:49 -07:00
Brian Duff
a69b461e1e Inline unknownFieldData{Equals,HashCode} to generated code.
It turns out dex (apparently) was inlining these protected final
methods from ExtendableMessageNano into every message class. Removing
these methods from the base class and inlining their code reduces
the method count by 2 methods / message when the store_unknown_fields
option is on.

Change-Id: I0aa09f2016d39939c4c8b8219601793b8fab301f
2015-04-28 13:02:33 -07:00
Jeff Davidson
ec19be2f3c Generate @IntDef annotations for nanoproto enums.
@IntDef is a support library annotation which allows build tools to
determine the valid set of values for a given integer field when that
field is intended to be restricted like an enum. This avoids the
overhead of enums while still allowing for compile-time type checking
in most circumstances.

Change-Id: Iee02e0b49a8e069f6456572f538e0a0d301fdfd5
2015-04-28 13:01:12 -07:00
Shai Barack
41f0294cd6 Add reset() and position() to CodedOutputByteBufferNano.
Change-Id: Ie2a9e36276ac35e10b3f8d379b5742d50a0374e9
2015-04-28 12:47:42 -07:00
Kweku Adams
2712c42136 DO NOT MERGE Overloading createMessageTyped to accept a tag as an integer.
When building, some instances expect createMessageTyped to have the signature
(int, Class, long), while others expect (int, Class, int). Simply having
the former signature meant that builds expecting the latter would fail.

This is a cherrypick of change b2a9d4321578139677c146ce37eba5e27e8f5c79
from master.

Change-Id: Ib02dbf66173510f4edea32c7b43e82c1a7a38aa2
2015-04-28 12:46:35 -07:00
Brian Duff
714dba3ab8 Exclude cachedSize when printing fields.
Change-Id: I85563b74237d38c1e447b7286f5f6e62d57e3d63
2015-04-28 12:44:08 -07:00
Brian Duff
d099a88685 Add clone() method support for nano.
Upstreamed from Another Place (cr/57247854).

Change-Id: I2aaf59544c0f5ae21a51891d8a5eeda1dc722c90
2015-04-28 12:42:55 -07:00
Brian Duff
fb96026b8d When no clear() is generated, still initialize fields.
https://android-review.googlesource.com/#/c/67890/ removed field
initialization from the ctor, making it just call clear() instead.

When I added the generate_clear option back (as part of the reftypes
compat mode) in https://android-review.googlesource.com/#/c/109530/,
I forgot to ensure that what clear() used to do was inlined in the
constructor.

This change fixes NPEs that are happening for users of
reftypes_compat_mode who rely on unset repeated fields being empty
arrays rather than null.

Change-Id: Idb58746c60f4a4054b7ebb5c3b0e76b16ff88184
2015-04-28 12:28:05 -07:00
Brian Duff
9ffaa50d55 Fix comments.
Forgot to update these in https://android-review.googlesource.com/#/c/109809/

Change-Id: I53f838e2f134f53964161d9620d5ead00c4a3939
2015-04-28 12:14:54 -07:00
Charles Munger
54511f701f Optimize measurement and serialization of nano protos.
Measuring the serialized size of nano protos is now a zero-alloc operation, and serializing a proto now allocates no memory (other than the output buffer) instead of O(total length of strings).

Change-Id: Id5e2ac3bdc4ac56c0bf13d725472da3a00c9baec
Signed-off-by: Charles Munger <clm@google.com>
2015-04-28 12:10:28 -07:00
Brian Duff
ec2f244554 Fix bug with large extension field numbers.
Previously, extensions with field numbers greater than 268435455 would
result in a compile time error in generated code that looks something
like this:

Foo.java:3178: error: integer number too large: 3346754610
                3346754610);

This is because we were trying to represent the tag number (an
unsigned int) using a java int constant, but java int constants are
signed, and can't exceed Integer.MAX_VALUE.

Fixed by declaring it as a long instead, and casting it down to an
int in the implementation. This is safe, because the tag value always
fits in 32 bis.

Change-Id: If2017bacb4e20af667eaeaf9b65ddc2c30a7709f
2015-04-28 11:42:01 -07:00
Tamir Duberstein
654bd3171f Clean up imports 2015-04-02 15:13:15 -07:00
Tamir Duberstein
210de285d7 DRY: Use Charset statics to eliminate exceptions 2015-04-02 15:06:00 -07:00
jesse
0481bf32c4 converted javanano README to markdown. Corrected Makefile 2015-03-17 12:14:55 -07:00
Chris Fallin
88eda4d776 Merge pull request #231 from google/alpha-2-fix
Add maven release profile for JavaNano.
2015-03-05 17:40:33 -08:00
Jisi Liu
efd4009487 Add maven release profile for JavaNano.
Change-Id: I885b561c85325db05595f0d86338dcd7c06cf058
2015-03-05 14:43:34 -08:00
Jisi Liu
40f2df3c16 Bump the version number to 3.0.0-alpha-3-pre
Change-Id: I33479e529b060e4fed532a827a386d3baecc835e
2015-03-02 19:31:31 -08:00
Jisi Liu
7d8564f220 Update version number to 3.0.0-alpha-2
Change-Id: Icecb25db34ae5e6d5142a2d75ca7216ba018abb2
2015-02-21 13:55:43 -08:00
Jisi Liu
32f5d0178c Add changelog for 3.0.0-alpha2 release.
Change-Id: I4cbb3374e351c31611de472c7d5d78e4ce2b0f3b
2015-02-20 17:15:42 -08:00
Jisi Liu
0a7fc8f888 Add test for debug string for oneof
Change-Id: I6a51a35c69ac24a60dd96ef69d556b1e68bc37d6
2015-02-19 17:27:59 -08:00
Jisi Liu
a6fc5da0fc Fix review comments.
Change-Id: Iafd4a3aa9d55e31478bf070311eeadfe95ece4d7
2015-02-19 17:16:26 -08:00
Jisi Liu
72776c30af Add tests for oneofs. 2015-02-19 16:43:08 -08:00
Jisi Liu
968150327d partial oneof tests. 2015-02-19 16:43:08 -08:00
Jisi Liu
b9e9469b4d Add tests for oneof equals and hash. 2015-02-19 16:43:08 -08:00
Jisi Liu
3ab660cd4a Uncomment string/bytes fields in oneof nano. 2015-02-19 16:43:08 -08:00
Jisi Liu
c72d3d51ff Oneof message level elements (consts, case getter/clear) and messsage type field oneof support. 2015-02-19 16:43:07 -08:00
Jisi Liu
33222b5a02 Initial check in for primitive oneof fields. 2015-02-19 16:43:07 -08:00
Jisi Liu
f0e08fd4e4 Support maps in NanoPrinter. 2015-02-19 14:41:14 -08:00
Jisi Liu
fbfdbe8ad8 Use EMPTY_BYTES in WireFormatNano 2015-02-19 11:29:24 -08:00
Jisi Liu
c265fbe3ca Mark factory setter API as private for alpha release. 2015-02-17 14:03:37 -08:00
Jisi Liu
d1bbd856af Merge the javanano map test into the main test target. 2015-02-09 14:15:26 -08:00
Jisi Liu
12d8a514c8 Get the map factory per mergeFrom() call for JavaNano. 2015-02-07 12:51:36 -08:00
Jisi Liu
d9a6f27bc3 implement hashCode() for JavaNano maps. 2015-02-06 15:55:04 -08:00
Jisi Liu
1536e93349 Implement Equals for nano. 2015-02-06 15:30:48 -08:00
Jisi Liu
b0f194885e Rename empty bytes in JavaNano. 2015-02-05 17:38:07 -08:00
Jisi Liu
cd99c12df2 Rename readData() to readPrimitiveField() in JavaNano. 2015-02-05 17:14:02 -08:00
Jisi Liu
7f3693184a Add tests merging empty entries in JavaNano map 2015-02-05 15:23:37 -08:00
Jisi Liu
bd3573cb09 Fix the behavior when merging conflicting keys, the new value always
override the existing one even for message types.
2015-02-05 14:52:17 -08:00
Jisi Liu
ca35a80303 Test keys and values cannot be null. 2015-02-05 14:26:52 -08:00