- Improved formatting of generated code.
- Improved logging by putting all debug logging behind the
stagDebugflag. - Improve integration of library by switching to new nullability annotations library.
- Wrote unit tests for
KnownTypeAdapters. - Fixed bug where code generation was non deterministic by switching to linked versions of
HashSetandHashMap. - Added support for turning on/off serialization of
nullwithstag.serializeNullscompiler option. Default is off, which is a behavior change from version 2.5.1.
- Fixed bug where types with wildcards caused compilation to fail.
- Fixed bug where fields with default types would not be correctly serialized if assigned to null.
- Improved thread safety of factory usage.
- Improved performance of loading the
Stag.Factory. - Improved error logging when getters/setters can't be found.
- Splitting up examples into integration test modules.
- Wrote functional tests for most use cases.
- Fixed bug where wrapper type adapters would not be called when
Stag.Factorywas registered.
- Fixed bug where generated type adapters would write out an empty JSON object for a
nullvalue. - Type adapters now write
nullto JSON instead of{}fornullfield values. - Rewrote compiler tests in Kotlin and improved their readability.
isXYZ()andsetXYZ()are now accepted as getter and setter names for boolean fields namedisXYZormIsXYZ.
- Fixed a bug where stag was unable to find setters/getters for parameterized private fields.
- Found solution for model list file being included in build (refer to README).
- Stag is now being deployed to Maven Central.
- Stag now throws an exception if you try to reuse a
Stag.Factoryinstance between multiple gson instances.
- Added support for private member variables in Java (leveraging getters/setters).
- Added support for models written in Kotlin.
- Added compiler support for all Java language versions.
- Improved performance of generic type adapter instantiation.
- Fixed bug where the type adapter for a parameterized type containing a parameterized type (e.g.
Map<T, List<T>>) wasn't being generated.
- Fixed a bug where
Objectfields caused type adapter generation to fail.
- Fixed bug where enums could not have private and/or final fields.
- WARNING: Removed deprecated
@GsonAdapterKeyannotation. - Added support for the
@JsonAdapterGson annotation. - Fixed bad behavior where unannotated classes could be picked up by Stag if they were nested within annotated classes. All classes that need to use Stag should now explicitly specify the option.
- Added unit tests for a variety of use cases.
- Interfaces are now ignored by stag instead of throwing an error if they are annotated.
- Fixed bug where type adapters for self referential classes (see
sample/ExternalModelExample2) would cause stack overflows when instantiated. - Fixed bug where duplicate type adapters would be generated if a class in one module extended a class in another module.
- Fixed bug where the type adapter for
chararrays was broken. - Correctly suppress raw types in generated code so as to not interfere with compilation settings on projects.
- Added unit tests for all model classes to validate the creation of type adapters and their ability to be instantiated.
- Added unit tests to validate type adapters in
KnownTypeAdapters.
- Fixed backwards compatibility bug where Stag wasn't generating TypeAdapters for classes containing only
@GsonAdapterKey. (Please note that it's still advised to move away from@GsonAdapterKeyas soon as possible). - Fixed bug where inner classes of classes annotated with
@UseStagwere always usingFieldOption.ALLinstead of inheriting the enclosing class's field option. - Fixed bug where Stag was not generating TypeAdapters for inner classes annotated with
@UseStagnested within classes that aren't annotated. - Added annotation processor option to enable debug output by Stag when compiling.
- Added
@UseStagclass level annotation- Use at the class level to mark a class to be processed by Stag
- The goal of
@UseStagis that it should be the only change you need to make to switch from your old non-Stag ready model to a better performing one. One annotation per model class, instead of the old Stag (different annotation for every field). @UseStagtakesFieldOptionenum which specifies what fields Stag should pick upFieldOption.ALL: marks all fields in a class for adapter generation. This is the default setting used by Stag if you don't specify any field option. This is the option you should choose in most scenarios. Unless marked with a@SerializedNameannotation, the variable name will be used as the JSON key. There is no longer a reason to mark fields with@GsonAdapterKeyto have them be picked up by Stag.FieldOption.NONE: marks the class for adapter generation, but none of the class's immediate fields will be picked up by Stag. Only fields in the inheritance hierarchy will be picked up. SeeVideoList.javafor an example of a class that has no immediate fields that need parsing, but has inherited fields.FieldOption.SERIALIZED_NAME: This option only chooses fields marked with the@SerializedNameor@GsonAdapterKeyto be used by Stag. This will behave the same way as the previous versions of stag behaved.
- Added support for
@SerializedNamein favor of@GsonAdapterKey - Deprecated
@GsonAdapterKey. Note: this annotation will be removed in v2.1.0, so you are advised to use this release to move over completely to@UseStag.@GsonAdapterKeywill currently take precedence over@SerializedNameon fields annotated with both for backwards compatibility reasons. - Created
KnownTypeAdaptersand moved it tostag-librarymodule so that it doesn't have to be generated at compile time. As a result, thestag-librarymodule now has a hard dependency ongson:2.8.0. Previously, only thestag-library-compilermodule depended on Gson, so it wouldn't interfere with the version you use locally. However, nowgson:2.8.0is required, unless you exclude it from the dependency. - Performance was improved, as much reflection as possible was removed.
- Native support for enums, maps, and all primitive types supported by Gson.
- Fields marked with the
transientkeyword will be excluded from parsing - Parsing errors on primitive types are no longer swallowed but are bubbled up.
- Various bugfixes and edge cases handled
- Please refer to the sample app and sample model in order to see all sorts of proper usage of the library.
- Suppress unchecked assignment warnings in generated code, preventing build failure if unchecked warnings are set to error
- You can now specify the package name for generated Stag files (multiple module support)
- Reduced number of generated methods by getting rid of individual adapter factories
- Support for NonNull annotations on fields
@android.support.annotation.NonNull@org.jetbrains.annotations.NotNull@javax.annotation.Nonnull@javax.validation.constraints.NotNull@edu.umd.cs.findbugs.annotations.NonNull@lombok.NonNull@org.eclipse.jdt.annotation.NonNull
- Added adapter caching for improved performance
- No longer generate adapters for abstract classes
- Fixed some problems with nested classes
- Support
Collectioninterface - Better performance for
List,Map, andHashMaptypes - Support for Enums
- Support for native arrays
- Updated internal gson version to 2.8.0
- Added more examples to the sample app
- Added support for
floatprimitive type - Support for all Map and List types
- Fixed bug caused by an static inner model class being named the same as a model class in the same package
- Better documented sample app
- Fixed a bug with the
TypeAdapterGeneratorin which it incorrectly created duplicate TypeAdapter fields if there were non-parameterized and parameterized (e.g.StringandArrayList<String>) fields of the same type in a model class. - Added a try/catch around
ArrayListparsing inTypeAdapter.readmethods for consistency in throwing parsing errors.
- Stag can now be used across multiple modules in the same application
- Class member variables no longer need to be public visibility, but can now be package-local or protected
- Generated factories and adapters are now located within the same package as your model class and are named so as to not interfere with your model class namespace:
Model$TypeAdapterandModel$TypeAdapterFactory
- Improvement: Exceptions thrown in the parsing code are now bubbled up instead of a generic exception being thrown
- Technical: META-INF is now generated by Google auto service
- Initial release