* Start gradle root
* Clean up test API ambiguities
These don't compile in gradle anymore and the team[] warns
* Exclude .gradle dirs in git
* Set up moshi module
* Set up moshi-adapters
* Add repositories to subprojects
* Set target/source compatibility
* Set up examples
* Fix location of reflect/test dir
* Set up moshi-kotlin
* Set up code gen
* Opportunistic update code gen deps
* Fix up with code gen
* Set up kotlin tests
* Update snapshots
* Update travis build
* Configure checkstyle
* Cache gradle
* Finish fixing up checkstyle
* Now disable checkstyle until we can fix them all :|
* Update contributing
* Fix tests in codegen
* Remove unnecessary annotation
* Remove maven stuff!
* Suppress warning
* Remove jcenter
* Consolidate dependencies
* Revert "Clean up test API ambiguities"
This reverts commit 3ead69b844b5d7f66134b721e95581f5df1cccd6.
* Fix incap dep
* Opportunistically fix some small kotlinpoet deprecations
* Automatically apply the stdlib to all kotlin projects
* Opportunistic move to opt-in and remove unnecessary annotations
The kotlin maven plugin didn't handle these well in the IDE, gradle does
* Fix Type doc warning
* Fix okio version
* Fix dokka support
* Fix copypasta
* Use new snapshot
* Kotlin 1.4.0
* Update to Kotlin 1.4.0
* Remove moshi-kotlin rules in favor of Kotlin's
* Ignore tests for now
* Update to OptIn
* Update test for kotlin 1.4 behavior
* Fix reflection names in generated proguard files
Proguard wants to speak reflection names
* Opportunistic clean up proguard tests
This ensures we fail the test if there are any unexpected ones
* Extract target constructor signature into TargetConstructor.kt
We'll need this to know what the runtime types are for proguard rules
* Add ProguardConfig
* Wire in proguard config
* Write proguard configs out with adapters
* Add full tests
* Now remove the rules!
* Ignore on inline classes for now
* Pass adapter constructor params correctly
* Improve the way Json.name is fetched for codegen
* Remove the comment for jsonName
* Add a test for json names with quotation marks
* Fix the broken tests
* Add LocalVariableName to common suppressions
NameAllocator will add underscores to names, which kotlin doesn't like for stylistic reasons
* Simplify structure a bit
Keeping track of template counts is error prone and would have failed only at runtime
* Update to Kotlin compile testing 1.2.4
This allows us to un-toe-hold a test from before
* Fix trailing newline
* Add class-based alternative
* Use updated test API
* Update to 1.2.5
* Update to Kotlin 1.3.60
* Suppress common warnings in generated classes
Followup from #1023 (Resolves#1023 too). Since we can't do targeted deprecation suppressions, we can just stick with blanket deprecations suppressions for now. This also suppresses a couple other common issues with all our generated adapters.
Have just eyeballed the results for now, can add a proper test as a followup once #1014 is in
* Add redundant projection and re-enable -Werror
* Add tests for deprecation suppression
With -Werror enabled now we can actually check this
* Only allow public or internal classes
* Ensure consistent ordering of supertypes
* Eagerly load supertype typespecs for reuse
* Add regression test for https://github.com/square/moshi/issues/1022
* Add MoshiCachedClassInspector, wire in
* Check visibility of enclosed types too
Resolves#1022
* Fix comments
* Fix: force object type for type arguments
* Add outDeclaration regression test for #1009
* Create mapTypesUtility for reusing recursive type mapping
* Strip typevar variance where appropriate
Resolves#1009
* Fix missing nullability/annotations when unwrapping typealiases
Fixes#990
* Add extra nullable properties test + more nullability in alias test
* Add more complex typeAliasNullability test
* Recursively check nullability and track annotations in typealiases
* Check against non-nullable known primitives when rendering class blocks
`Int?` will not equal `Int` in KotlinPoet, so this was always falling through to the default `::class.java` code.
Resolves#991
* Nix comment
* Flesh out test to include all primitives
* Add parameter-only param in multi-masks test
* Add type to target parameters for later reference
* Ensure parameters are ordered
* Reword AdapterGenerator fromJson logic to use sealed FromJsonComponent
This allows us to handle parameter-only types separately (needed for mask index calculation). Resolves#979
* Add more tests
* Add MultipleMasksTest test
* Use multiple masks for constructors with more than 32 parameters
Resolves#977
* Add non-default arg to test
* Emit hex literals
* Simpler int math
* Don't allocate a mask if there's no properties
* Fix broken test
This test suite doesn't run on CI builds but fails locally since the method was moved
* Add multiple constructors test case
* Implement TypeName.asTypeBlock()
* Make DEFAULT_CONSTRUCTOR_MARKER public
* Look up constructor via getDeclaredConstructor with exact param types
Resolves#975
* Remove dead code
* Unwrap typealiases
This was a change in 1.4.2 left over from moshi's prior metadata logic. We need the unwrapped type for class references
* Add toe-hold for testing shared adapter behavior
* Add regression test for abstractSuperProperties
* Kotlinpoet 1.4.2
* KotlinPoet 1.4.1 & Kotlin 1.3.50
KotlinPoet uses 1.3.50, so this just matches that now
* Remove now-unnecessary custom shade
This uses the same common package prefix in kotlinpoet now
* Add backwardReferencingTypeVars() regression test
Coverage for #955
* Generate optimized toString()
This optimizes `toString()` functions to emit separate strings for the enclosing prefix and the adapter name
Example:
```kotlin
override fun toString(): String = buildString {
append("GeneratedJsonAdapter(").append("SmokeTestType").append(")") }
```
* Optimize with capacity and char
* Add regression test for field json annotations
* Make json name null if absent rather than default to name
This fixes incorrect behavior where the parameter json name would always win out over the property value
* Report json name in code gen if different from property name
Resolves#800
* Unify required property name error message
* Report json name in kotlinjsonadapter, match code gen
* Upper case JSON
Co-Authored-By: Jake Wharton <jakew@google.com>
* Upper case JSON
Co-Authored-By: Jake Wharton <jakew@google.com>
* Don't keep constants
* Inline json name - property name comparison to util methods
* Remove unnecessary constructor keyword
* Consolidate non-null/missing property tests to parameterized suite
* Add custom json name tests for nonNull property checks
* Rename test to make maven happy
Maven won't run the test unless it ends with `Test` or `TestCase`
* Add kotlinpoet version to properties
* Swap in kotlinpoet-metadata for kotlin-metadata in dependencies
* Don't use KotlinMetadataUtils and KotlinAbstractProcessor anymore
* Upcast to TypeElement
* Temporarily add direct kotlinx-metadata dependency
Something is wrong with packaging in my local kotlinpoet, will remove before
* Remove tags API from TargetParameter
No longer needed
* Add PropertySpec directly to TargetProperty, remove holder funs
Simplifies some things!
* Move generated annotation gen into type callback
Removes JsonClassCodegenProcessor completely from codegen API
* Remove unstable autocommon dependency
Won't be using this anymore after this change
* Manually put quotes jsonName in AdapterGenerator
Otherwise we could incur double escaping from kotlinpoet since we directly reuse possible-escaped parsed `@Json` name values
* Opt in to use `@UseExperimental` annotation for preview
* Rework and simplify metadata to just use kotlinpoet-metadata
This is hard to do in broken down 1:1 steps, but the net result is a much smaller implementation footprint, better error messages, and a simpler API interaction with the code gen API. There is some raw parsing of kotlinpoet types required (mostly around annotations), but otherwise it's pretty smooth sailing and a good test of the upcoming kotlinpoet-metadata support
* Declare KotlinPoetMetadataPreview directly
* Try to point to snapshots for CI build
* Update to classinspector API
* Remove TypeResolver API
No longer needed
* Kotlinpoet 1.4.0 final
* Fix missing import from rebase
* Remove old kotlin-metadata version
* Add kotlin-compile-testing dependency
* Add Okio dependency to tests to match kotlin-compile-testing
Without this, Okio.sink() fails to resolve at runtime
* Try converting privateConstructor() to kotlin-compile-testing
* Space
* Update to 1.2.2
* Use new kotlin source file API
* Use temporaryFolder as workingDir
* Extract prepareCompilation helper method
This allows for modifying the compilation with extra bits as needed
* Migrate tests entirely to new API
* Remove incorrect error message
This passed before, but was picked up in https://github.com/square/moshi/pull/903 before and observed to be incorrect.
* Remove custom kotlin compiler implementations
* Add an OK exit code test
This wasn't possible before!
* Remove jitpack dependency now that it's on mavencentral
* Move versions to parent pom
* Fix new test from rebase
* 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