aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/javanano/javanano_generator.cc
Commit message (Collapse)AuthorAge
* Remove javanano.Gravatar Feng Xiao2018-03-26
|
* Deleted scoped_ptr.hGravatar Adam Cozzette2018-03-14
| | | | | We no longer need this, now that we have finished the switch to C++11 and are using std::unique_ptr.
* Removed using statements from common.hGravatar Adam Cozzette2018-01-26
| | | | | | These statements pulled a bunch of symbols from the std namespace into the global namespace. This commit removes all of them except for std::string, which is a bit trickier to remove.
* Fix javanano packageGravatar Jisi Liu2016-03-31
|
* Integrate google internal changes.Gravatar Jisi Liu2016-03-30
|
* Generate a package name suffix ".nano" for nano messagesGravatar Xiao Hang2015-07-29
| | | | Also introducing an option javanano_use_deprecated_package to allow users to disable the suffix
* Expose generate_clear as an option.Gravatar Brian Duff2015-04-28
| | | | | | | | | | | | | | | | | | 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
* Generate @IntDef annotations for nanoproto enums.Gravatar Jeff Davidson2015-04-28
| | | | | | | | | | @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
* Add clone() method support for nano.Gravatar Brian Duff2015-04-28
| | | | | | Upstreamed from Another Place (cr/57247854). Change-Id: I2aaf59544c0f5ae21a51891d8a5eeda1dc722c90
* Prepare nano proto code to be merged into protobuf repository.Gravatar Feng Xiao2014-11-19
|
* Change reftypes_primitive_enums to reftypes_compat_mode.Gravatar Brian Duff2014-10-01
| | | | | | Make the clear() method stripped in reftypes_compat_mode. Change-Id: I0ec35537856f59a6ecf231bfd74df995c858e2b2
* Adds a primitive enum mode for reftypes.Gravatar Brian Duff2014-09-30
| | | | | | This is a compatibility shim. Change-Id: Ia0b417d4621e391ede618d0b3b1c470c9896e0ff
* Support generation of Parcelable nano messages.Gravatar Jeff Davidson2014-04-25
| | | | | | | | | | | | | | | | | | | | 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
* Adds --ignore_service nano proto compiler flagGravatar Jie Dai2014-04-23
| | | | | | | | 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
* Allow whitespace in nano codegen options.Gravatar Max Cai2014-01-14
| | | | | | So we don't need to keep all option in a single line in the .mk files. Change-Id: I786b879b334cac4cd13b32fabcb76efe53b4ac80
* Implement hashCode() and equals() behind a generator option.Gravatar Brian Duff2013-10-25
| | | | | | | | | | | | | | | | 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
* Add reftypes field generator option.Gravatar Brian Duff2013-10-07
| | | | | | | | This option generates fields as reference types, and serializes based on nullness. Change-Id: Ic32e0eebff59d14016cc9a19e15a9bb08ae0bba5 Signed-off-by: Brian Duff <bduff@google.com>
* Add two codegen parameters to nano.Gravatar Max Cai2013-09-18
| | | | | | | | | | | | | | | 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
* Fix outer classname for javamicro/javanano.Gravatar Max Cai2013-08-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* Add an option to inspect "has" state upon parse.Gravatar Ulas Kirazci2013-07-29
| | | | | | If has is set, also always serialize. Change-Id: I2c8450f7ab9e837d722123dd1042991c0258ede3
* Per-file java_multiple_files flag.Gravatar Max Cai2013-07-25
| | | | | | | | | | | | | | | 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
* Nano support for extensions and unknown fields.Gravatar Brian Duff2013-06-24
| | | | | | | | | | | | | | | | | | | | 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
* Nano protobufs.Gravatar Ulas Kirazci2013-04-01
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