* Use raw type for kclass references in dynamic invocation code gen
Added a compile-only regression test
Resolves#905
* Make it actually generic
* Mostly fix generation
Will need to wait for inlined instantiation to merge
* Fix rebase issues and use newInstance
* Differentiate local naming from properties with constructor defaults
* Remove constructor invocation and mask creation methods
We're inlining all this
* Add explanatory comment for why we use the default primitive value
* Inline mask generation and constructor invocation to generated adapters
* Remove unused argument
Co-Authored-By: Jake Wharton <jakew@google.com>
* Compute masks directly during code gen
* Opportunistic: remove extraneous double space from control flow
* Just mask and invert directly
* Add Util#invokeDefaultConstructor
* Add defaultPrimitiveValue
This will be used to initialize required properties for later invocation of the default constructor
* Move isTransient into PropertyGenerator
We will need this in order to know how to invoke constructors even if they have transient parameters
* Add notion of hasLocalIsPresentName to PropertyGenerator
* Switch to using invokeDefaultConstructor for any default property types
* Add code gen versions of default constructor test
* Fix mismatched names
* Use Arrays.copyOf
* Unwrap InvocationTargetException
* Use name allocator
* Rename createMask to createDefaultValuesParametersMask, use it directly
* Opportunistically clean up result variable holder
Only needs to be made if we have non-parameter instances, otherwise we can just return directly
* Fix mask name
* Remove unnecessary mod
* Switch to local lazily-initialized constructor reference
Not working because of some issue in kotlinpoet I don't understand
* Fix named usage
* Clean up debugging dots
* Add proguard/R8 rule for keeping defaults constructor in targets
* Make constructor lookup property private
* Add another defensive dot
* Rework invokeDefaultConstructor to accept vararg args
A little more idiomatic
* Update proguard rules
* Start MoshiKotlinExtensions
* Add Moshi.Builder.add() with reified typeOf
* Use non-shadowing name for addAdapter
* Implement KType.toType()
.javaType isn't implemented
* Don't re-wrap wrapped adapters
* Use new adapter functions in tests to smoke test
* Don't enable uses experimental in kotlin-reflect, only the test
* Use internal leniency API
* Use toType in addAdapter too
* Update error message in test
* Extract generatedJsonAdapterName to public API for other generators/consumers
* Fix kapt location in tests
* Add IDE-generated dependency-reduced-pom.xml to gitignore
This always bites me
* Add generator property to JsonClass and skip in processor
* Opportunistically fix formatting for generateAdapter doc
* Extract NullSafeJsonAdapter for delegate testing
* Add custom adapter tests
* Allow no-moshi constructors for generated adapters
* Fix rebase issue
* Use something other than nullSafe() for lenient check
This no longer propagates lenient
* Add missing copyrights
* Add top-level class note
* Add note about working against Moshi's generated signature
* Add missing bit to "requirements for"
* Note kotlin requirement relaxed in custom generators
* Style
* Support gradle incremental processing in code gen
This adds support for incremental compilation in gradle via incap helper and marking the code gen as `ISOLATING`.
Depends on a newer version of KotlinPoet that has https://github.com/square/kotlinpoet/pull/647Resolves#589
* Opportunistically update to auto-service 1.0-rc5
Supports incremental compilation and moves annotations to a separate artifact
* 1.2.0 final!
* Mark compiler embeddales as test only
Before, the KotlinJsonAdapter threw "java.lang.IndexOutOfBoundsException: Index: 0, Size: 0" on a duplicate key when the key matched a property that was not a constructor parameter.
Otherwise we crash with an exception attempting to create an adapter
for an enclosed type that has a type parameter.
I ran into this looking for a test case for issue 615.
https://github.com/square/moshi/issues/615
AnnotationSpec implements equals() in the way we need, but
AnnotationMirror doesn't. As a consequence this fixes a problem
where we were generating redundant adapters.
Closes: https://github.com/square/moshi/issues/563
* Fix companion object names not being resolved
This slipped through the cracks before the release
Fixes#546
* Add braces on the else clause for symmetry