From 8fbb37d23d03bbc99567f93f6657b5b8fc348fff Mon Sep 17 00:00:00 2001 From: Anthony Restaino Date: Wed, 21 Feb 2018 15:16:12 -0500 Subject: [PATCH 01/84] Cleaning up formatting --- .../src/main/AndroidManifest.xml | 4 +- .../src/main/AndroidManifest.xml | 4 +- .../com/vimeo/sample/model/NestedClass.java | 3 +- .../com/vimeo/sample/model/ObjectExample.java | 1 - .../model/OuterClassWithInnerModel.java | 8 +-- .../model/json_adapter/TestDeserializer.java | 1 + .../sample/model1/ParameterizedData.java | 3 +- .../vimeo/sample/model/ObjectExampleTest.java | 3 +- .../json_adapter/JsonAdapterExampleTest.java | 3 +- .../sample_java_model/NativeJavaModel.java | 5 ++ .../WrapperTypeAdapterModelTest.java | 3 +- .../dummy/sample_kotlin/KotlinSamplesTest.kt | 5 +- .../com/vimeo/dummy/sample_kotlin/Utils.kt | 3 +- sample/build.gradle | 4 +- sample/src/main/AndroidManifest.xml | 11 +++-- sample/src/main/res/layout/activity_main.xml | 3 +- sample/src/main/res/layout/row_layout.xml | 4 +- sample/src/main/res/values/styles.xml | 2 +- .../generators/AdapterGenerator.java | 3 +- .../generators/StagFactoryGenerator.java | 1 + .../processor/generators/StagGenerator.java | 45 ++++++++--------- .../generators/TypeAdapterGenerator.java | 49 ++++++++++--------- .../stag/processor/utils/ElementUtils.java | 2 +- .../vimeo/stag/processor/utils/TypeUtils.java | 30 ++++++------ .../stag/processor/ElementUtilsUnitTest.kt | 2 +- .../processor/StagProcessorIntegrationTest.kt | 3 +- .../stag/processor/dummy/DummyGenericClass.kt | 4 +- stag-library/build.gradle | 8 +-- .../com/vimeo/stag/KnownTypeAdapters.java | 3 +- .../src/main/java/com/vimeo/stag/Types.java | 1 + .../com/vimeo/stag/KnownTypeAdaptersTest.java | 10 ++-- 31 files changed, 123 insertions(+), 108 deletions(-) diff --git a/integration-test-android/src/main/AndroidManifest.xml b/integration-test-android/src/main/AndroidManifest.xml index f22240a7..c2541512 100644 --- a/integration-test-android/src/main/AndroidManifest.xml +++ b/integration-test-android/src/main/AndroidManifest.xml @@ -1,3 +1 @@ - + diff --git a/integration-test-java-cross-module/src/main/AndroidManifest.xml b/integration-test-java-cross-module/src/main/AndroidManifest.xml index ae0c9521..f77162a6 100644 --- a/integration-test-java-cross-module/src/main/AndroidManifest.xml +++ b/integration-test-java-cross-module/src/main/AndroidManifest.xml @@ -1,3 +1 @@ - + diff --git a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/NestedClass.java b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/NestedClass.java index 16d1856f..6e4d7e43 100644 --- a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/NestedClass.java +++ b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/NestedClass.java @@ -14,6 +14,7 @@ public class NestedClass { * classes to explicitly specify the annotation in order to enable generation. */ public static class NestedExtension extends NestedClass { + String field; } @@ -42,4 +43,4 @@ public static class NestedWithoutAnnotation { } } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/ObjectExample.java b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/ObjectExample.java index 346d0d01..a2eced60 100644 --- a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/ObjectExample.java +++ b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/ObjectExample.java @@ -4,7 +4,6 @@ /** * Example where Object is one of the member variables - * */ @UseStag public class ObjectExample { diff --git a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/OuterClassWithInnerModel.java b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/OuterClassWithInnerModel.java index 25305d23..817a4602 100644 --- a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/OuterClassWithInnerModel.java +++ b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/OuterClassWithInnerModel.java @@ -8,10 +8,10 @@ */ public class OuterClassWithInnerModel { - @UseStag - public static class InnerModel { + @UseStag + public static class InnerModel { - public int version; + public int version; - } + } } diff --git a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/json_adapter/TestDeserializer.java b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/json_adapter/TestDeserializer.java index 3cf7a3fa..80501ad0 100644 --- a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/json_adapter/TestDeserializer.java +++ b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/json_adapter/TestDeserializer.java @@ -13,6 +13,7 @@ */ public class TestDeserializer implements JsonDeserializer { + @Override public BasicModel2 deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return context.deserialize(json, BasicModel2.class); diff --git a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model1/ParameterizedData.java b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model1/ParameterizedData.java index d711badb..7ec4c980 100644 --- a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model1/ParameterizedData.java +++ b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model1/ParameterizedData.java @@ -7,10 +7,11 @@ /** * Since this class is not annotated with @UseStag, this will use TypeToken for its adapter generation. * As it is of paramterized type, this will use TypeToken.getParameterized() instead of TypeToken.get() + * * @param */ public class ParameterizedData { @SerializedName("list") public List list; -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ObjectExampleTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ObjectExampleTest.java index 10df380f..614a0967 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ObjectExampleTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ObjectExampleTest.java @@ -8,9 +8,10 @@ * Created by anshul.garg on 12/04/17. */ public class ObjectExampleTest { + @Test public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(ObjectExample.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/json_adapter/JsonAdapterExampleTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/json_adapter/JsonAdapterExampleTest.java index 6f4c8cd1..73366009 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/json_adapter/JsonAdapterExampleTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/json_adapter/JsonAdapterExampleTest.java @@ -8,8 +8,9 @@ * Created by anshul.garg on 03/03/17. */ public class JsonAdapterExampleTest { + @Test public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(JsonAdapterExample.class); } -} \ No newline at end of file +} diff --git a/integration-test-java/src/main/java/com/vimeo/sample_java_model/NativeJavaModel.java b/integration-test-java/src/main/java/com/vimeo/sample_java_model/NativeJavaModel.java index 4208a5c2..40e90f78 100644 --- a/integration-test-java/src/main/java/com/vimeo/sample_java_model/NativeJavaModel.java +++ b/integration-test-java/src/main/java/com/vimeo/sample_java_model/NativeJavaModel.java @@ -17,6 +17,7 @@ public void setTopLevel(String mTopLevel) { @UseStag public static class Nested { + private String mNested; public String getNested() { @@ -29,6 +30,7 @@ public void setNested(String mNested) { } public static class NestedWithoutAnnotation { + private String mNestedWithoutAnnotation; public String getNestedWithoutAnnotation() { @@ -42,6 +44,7 @@ public void setNestedWithoutAnnotation(String mNestedWithoutAnnotation) { @UseStag public static class NestedExtension extends NativeJavaModel { + private String mNestedExtension; public String getNestedExtension() { @@ -54,6 +57,7 @@ public void setNestedExtension(String mNestedExtension) { } public static class NestedExtensionWithoutAnnotation extends NativeJavaModel { + private String mNestedExtensionWithoutAnnotation; public String getNestedExtensionWithoutAnnotation() { @@ -67,6 +71,7 @@ public void setNestedExtensionWithoutAnnotation(String mNestedExtensionWithoutAn @UseStag public static class NestedExtensionFromNoAnnotation extends NestedWithoutAnnotation { + private String mNestedExtensionFromNoAnnotation; public String getNestedExtensionFromNoAnnotation() { diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/WrapperTypeAdapterModelTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/WrapperTypeAdapterModelTest.java index a0de5975..61e7d938 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/WrapperTypeAdapterModelTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/WrapperTypeAdapterModelTest.java @@ -8,14 +8,13 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vimeo.sample_java_model.WrapperTypeAdapterModel.InnerType; +import com.vimeo.sample_java_model.stag.generated.Stag; import org.junit.Test; import java.io.IOException; import java.util.concurrent.atomic.AtomicInteger; -import com.vimeo.sample_java_model.stag.generated.Stag; - import static org.junit.Assert.assertEquals; /** diff --git a/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinSamplesTest.kt b/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinSamplesTest.kt index 0225d694..22049aa0 100644 --- a/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinSamplesTest.kt +++ b/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinSamplesTest.kt @@ -9,7 +9,8 @@ import org.junit.Test */ class KotlinSamplesTest { - @Test fun verifyTypeAdapterGenerated() { + @Test + fun verifyTypeAdapterGenerated() { Utils.verifyTypeAdapterGeneration(KotlinSamples::class) } @@ -17,4 +18,4 @@ class KotlinSamplesTest { fun verifyTypeAdapterCorrectness() { Utils.verifyTypeAdapterCorrectness(KotlinSamples::class) } -} \ No newline at end of file +} diff --git a/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/Utils.kt b/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/Utils.kt index d4c75cca..536b2f08 100644 --- a/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/Utils.kt +++ b/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/Utils.kt @@ -3,7 +3,6 @@ package com.vimeo.dummy.sample_kotlin import com.google.gson.Gson import com.google.gson.TypeAdapter import com.google.gson.reflect.TypeToken -import com.vimeo.sample_kotlin.stag.generated.Stag import junit.framework.Assert import junit.framework.Assert.assertEquals import uk.co.jemos.podam.api.PodamFactoryImpl @@ -72,4 +71,4 @@ class Utils { } } -} \ No newline at end of file +} diff --git a/sample/build.gradle b/sample/build.gradle index 1d2cfc18..498539fc 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -21,8 +21,8 @@ android { javaCompileOptions { annotationProcessorOptions { arguments = [ - stagGeneratedPackageName: 'com.vimeo.sample.stag.generated', - stagDebug : 'true', + stagGeneratedPackageName : 'com.vimeo.sample.stag.generated', + stagDebug : 'true', stagAssumeHungarianNotation: 'true' ] } diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 2235938a..b6e1bc6e 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -1,7 +1,8 @@ - + xmlns:android="http://schemas.android.com/apk/res/android"> @@ -15,11 +16,11 @@ tools:ignore="AllowBackup,GoogleAppIndexingWarning"> - + - + - \ No newline at end of file + diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml index 017b9a29..e8e1252e 100644 --- a/sample/src/main/res/layout/activity_main.xml +++ b/sample/src/main/res/layout/activity_main.xml @@ -1,5 +1,6 @@ - + android:layout_height="match_parent" /> - \ No newline at end of file + diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml index 6e014884..0935c8fb 100644 --- a/sample/src/main/res/values/styles.xml +++ b/sample/src/main/res/values/styles.xml @@ -2,7 +2,7 @@