Fix support for classes w/ multiple constructors in code gen (#976)

* 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
This commit is contained in:
Zac Sweers
2019-10-30 00:39:08 -04:00
committed by GitHub
parent 6acebfaca6
commit 4f1c8a5eda
5 changed files with 82 additions and 10 deletions

View File

@@ -47,7 +47,7 @@ import static com.squareup.moshi.Types.supertypeOf;
public final class Util {
public static final Set<Annotation> NO_ANNOTATIONS = Collections.emptySet();
public static final Type[] EMPTY_TYPE_ARRAY = new Type[] {};
@Nullable private static final Class<?> DEFAULT_CONSTRUCTOR_MARKER;
@Nullable public static final Class<?> DEFAULT_CONSTRUCTOR_MARKER;
@Nullable private static final Class<? extends Annotation> METADATA;
static {