History log of /external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
137226a921d0f50c9e8a9f3ae43a3459b48d18a1 08-May-2015 Jeff Davidson <jpd@google.com> Add a flag to use offset/length with byte arrays.

This is an advanced option that most users won't want/need. However,
it can greatly optimize flows where we want to reuse byte[] buffers
from other locations without having to first copy the contents into
a new array of the exact correct size.

Bug: 20636336
Change-Id: Ia8d0af82e952858f9571f84110da621da776619c
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
b0575e93e4c39dec69365b850088a1eb7f82c5b3 04-Jun-2016 Tamas Berghammer <tberghammer@google.com> Update from protobuf v2.6.1 to protobuf 3.0.0-beta-3

This change just copies the upstream code into the repository without
fixing the Android.mk or fixing the possible cmpile errors. All of those
will be fixed with foloowup CLs.

Bug: b/28974522
Change-Id: I79fb3966dbef85915965692fa6ab14dc611ed9ea
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
ab7fb7fd396ab2a90a9fde19b9786359bf03443b 31-Jul-2015 Daniel Weis <dweis@google.com> Revert "Update the nano Protocol Buffer compiler to generate code in a ".nano" suffixed package."

This reverts commit 6be128fb6b66872025dae6c6acf16339509cdece.

Change-Id: I2bfb4ffb4082f330c42ec9c64c70aa3e2870dfe7
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
6be128fb6b66872025dae6c6acf16339509cdece 20-Jul-2015 Daniel Weis <dweis@google.com> Update the nano Protocol Buffer compiler to generate code in a ".nano" suffixed package.

This change follows up on the foundation laid by
https://android-review.googlesource.com/#/c/154532/; it leverages this descriptor option to
conditionally generate code in a ".nano" suffixed package. The conditional behavior is present to
enable teams to migrate incrementally to the new behavior and to serve as an intermediary step
towards the elimination of any non-nano suffixed packages.

If this change breaks your build, please review the announcement email sent out to android-eng@:
https://groups.google.com/a/google.com/forum/#!msg/android-eng/Ga49081_y3k/YWxD42JtXzAJ

Change-Id: Ia34468bc41e2f884d61356791b00f245852aaf68
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
4f87f0d25b75e045f55cc09c8a9085c1cd7cb238 08-May-2015 Jeff Davidson <jpd@google.com> Add a flag to use offset/length with byte arrays.

This is an advanced option that most users won't want/need. However,
it can greatly optimize flows where we want to reuse byte[] buffers
from other locations without having to first copy the contents into
a new array of the exact correct size.

Bug: 20636336
Change-Id: Ia8d0af82e952858f9571f84110da621da776619c
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
c8518963254eb51bd8ec52750c2cc487fa857c72 22-Feb-2015 Brian Duff <bduff@google.com> Expose generate_clear as an option.

I wasn't able to get the clear() method to inline into the
constructor when optimizations are on in proguard. As a result,
every message has an extra superfluous kept method assuming the
app never uses clear() directly.

There are a couple of instances where setting this option false is
necessary in order to get code dexing successfully without hitting
the method limit, e.g. https://goto.google.com/tltzq

In this example, I tried turning on the method/inlining/unique and
method/inlining/short optimizations before resorting to adding the
generate_clear option, but the method count did not decrease. The
clear() methods were contributing over a thousand extra methods.

Change-Id: If6a9651d6a59cdf70b1040d8248779710ac73105
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
30d873bd66f50a6021de5d44d7ee5b8a809b0524 11-Feb-2015 Jeff Davidson <jpd@google.com> 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
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
bcf45045f229edab8c2589c1f561e7b7495a763b 01-Oct-2014 Brian Duff <bduff@google.com> Add clone() method support for nano.

Upstreamed from Another Place (cr/57247854).

Change-Id: I2aaf59544c0f5ae21a51891d8a5eeda1dc722c90
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
907e776a4015b6b55987f008429ba66babb920a1 01-Oct-2014 Brian Duff <bduff@google.com> Change reftypes_primitive_enums to reftypes_compat_mode.

Make the clear() method stripped in reftypes_compat_mode.

Change-Id: I0ec35537856f59a6ecf231bfd74df995c858e2b2
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
339478eea8a7889d1c086d216f72fa63c1b5307d 30-Sep-2014 Brian Duff <bduff@google.com> Adds a primitive enum mode for reftypes.

This is a compatibility shim.

Change-Id: Ia0b417d4621e391ede618d0b3b1c470c9896e0ff
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
721ea491a8e3e9ea5a130965dc5761fc335c3e61 23-Apr-2014 Jeff Davidson <jpd@google.com> Support generation of Parcelable nano messages.

This CL adds the "parcelable_messages" option. When enabled, all
generated message classes will conform to the Android Parcelable
contract. This is achieved by introducing a new parent class for
generated classes which implements the required functionality.

Since the store_unknown_fields option also makes use of a superclass,
ExtendableMessageNano, we have two versions of the new Parcelable
superclass: one extending MessageNano, and one extending
ExtendableMessageNano. These classes are otherwise identical.

As these classes depend on Android framework jars, they are not
included in the host .jar build of the nanoproto library.

Finally, add a test suite for running tests of Android-specific
functionality, as this cannot be done on a desktop JVM.

Change-Id: Icc2a257f03317e947f7078dbb9857c3286857497
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
a0a4f14521bd29a472d51fb7c4c5c45a82643453 21-Apr-2014 Jie Dai <jied@google.com> Adds --ignore_service nano proto compiler flag

Nano proto compiler normally throws an error if any service is
defined. If --ignore-services=true is set, no error is thrown and the
service is simply skipped.

Change-Id: Id82583555085cc55550d03a485d3f0189885240b
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
4109e91ce6035f84fa32b2e949501befbfb90159 14-Jan-2014 Max Cai <maxtroy@google.com> Allow whitespace in nano codegen options.

So we don't need to keep all option in a single line in the .mk files.

Change-Id: I786b879b334cac4cd13b32fabcb76efe53b4ac80
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
ccc48faf20dbf3b3cddcffe78d198876d543529b 16-Oct-2013 Brian Duff <bduff@google.com> Implement hashCode() and equals() behind a generator option.

The option is only called 'generate_equals' because:
- equals() is the main thing; hashCode() is there only to
complement equals();
- it's shorter;
- toString() should not be included in this option because
it's more for debugging and it's more likely to stop
ProGuard from working well.

Also shortened the "has bit" expression; was
((bitField & mask) == mask), now ((bitField & mask) != 0).
Both the Java code and the bytecode are slightly shorter.

Change-Id: Ic309a08a60883bf454eb6612679aa99611620e76
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
0b8579237336f221711a0aac42400eb31a58fed3 01-Oct-2013 Brian Duff <bduff@google.com> Add reftypes field generator option.

This option generates fields as reference types, and serializes
based on nullness.

Change-Id: Ic32e0eebff59d14016cc9a19e15a9bb08ae0bba5
Signed-off-by: Brian Duff <bduff@google.com>
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
26ce449901aa8c2f954fb4a5e8bbcc1253b3ca01 18-Sep-2013 Max Cai <maxtroy@google.com> Add two codegen parameters to nano.

enum_style = c | java: 'c' to put the enum member int constants
at the parent scope; 'java' to create uninstantiatable shell
classes at the parent scope and put the int constants inside.

optional_field_style = default | accessors: 'default' to create
one public mutable field per optional proto field; 'accessors'
to encapsulate the generated fields behind get, set, has and
clear accessors.

This CL only contains parsing code for these two parameters.

Change-Id: Iec0c3b0f30af8eb7db328e790664306bc90be089
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
624c448fbef20a1a2fad2289f622b468c25763d1 29-Jul-2013 Max Cai <maxtroy@google.com> Fix outer classname for javamicro/javanano.

- File class name is defined as the java_outer_classname option value
or the file name ToCamelCase; never the single message's ClassName.
- File-scope enums are translated to constants in the file class,
regardless of java_multiple_files.
- If java_multiple_files=true, and file's class name equals a message's
class name, no error. This is done by detecting that the outer class
is not needed and skipping the outer class codegen and clash checks.
Note: there is a disparity between java[lite] and the previous
java{micr|nan}o: when generating code for a single-message proto, the
outer class is omitted by java{micr|nan}o if the file does not have
java_outer_classname. This change makes java{micr|nan}o align with
java[lite] codegen and create the outer class, but will print some
info to warn of potential change of code.
- Also fixed the "is_own_file" detection and made all parseX() methods
static. Previously, all messages in a java_multiple_files=true file
are (incorrectly) considered to be in their own files, including
nested messages, causing them to become inner classes (instance-
bound) and forcing the parseX() methods to lose the static modifier.
- This change supersedes c/60164 and c/60086, which causes javanano to
put enum values into enum shell classes if java_multiple_files=true.
We now always use the parent class to host the enum values. A future
change will add a command line option to provide more flexibility.
- Elaborated in java/README.txt.

Change-Id: I684932f90e0a028ef37c662b221def5ffa202439
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
35d9fd84ff1d9ecdb91156b757cc9fdcc3f25249 01-Apr-2013 Ulas Kirazci <ulas@google.com> Add an option to inspect "has" state upon parse.

If has is set, also always serialize.

Change-Id: I2c8450f7ab9e837d722123dd1042991c0258ede3
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
8170787391efcb6cc6a8babc1cce35d5b1aff420 24-Jul-2013 Max Cai <maxtroy@google.com> Per-file java_multiple_files flag.

Imported source files may have different values for the 'java_multiple_files'
option to the main source file's. Whether the fully qualified Java name of an
entity should include the outer class name depends on the flag value in the
file defining the referenced entity, not the main file. This CL loads the
flag values from the main and all transitively imported files into the params,
and generates the fully qualified Java names accordingly.

If the generator option 'java_multiple_files' is set, its value overrides any
in-file values in all source/imported files. This is because this generator
option is typically used on either none or all source files.

Change-Id: Id6a4a42426d68961dc669487d38f35530deb7d8e
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
0e055f079f53b07de3705838a7b4742ce56839f8 19-Jun-2013 Brian Duff <bduff@google.com> Nano support for extensions and unknown fields.

You can use the processor option store_unknown_fields to switch
this support on:

aprotoc --javanano_out=store_unknown_fields=true:/tmp/out

A separate option for extensions isn't required. Support
for unknown fields must be turned on to allow storing and
retrieving extensions, because they are just stored as
unknown fields. If unknown fields are switched on, extension
related code will be generated when a proto message includes
an extension range, or an extension is encountered.

By default, store_unknown_fields is false. No additional
code is generated, and the generator will error out if protos
contain extension ranges or extensions.

Change-Id: I1e034c9e8f3305612953f72438189a7da6ed2167
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc
64d8d8f89050c5ada85341f967af391f4716a7cb 15-Mar-2013 Ulas Kirazci <ulas@google.com> Nano protobufs.

Like micro protobufs except:

- No setter/getter/hazzer functions.
- Has state is not available. Outputs all fields != their default.
- CodedInputStream can only take byte[] (not InputStream).
- Repeated fields are in arrays, not ArrayList or Vector.
- Unset messages/groups are null, not "defaultInstance()".
- Required fields are always serialized.

To use:

- Link libprotobuf-java-2.3.0-nano runtime.
- Use LOCAL_PROTOC_OPTIMIZE_TYPE := nano

Change-Id: I7429015b3c5f7f38b7be01eb2d4927f7a9999c80
/external/protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc