Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #165 from vimeo/develop
Browse files Browse the repository at this point in the history
Version 2.5.1
  • Loading branch information
anthonycr committed Jan 17, 2018
2 parents 735dd21 + 476921f commit 42c168b
Show file tree
Hide file tree
Showing 25 changed files with 370 additions and 98 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,12 @@
Change Log
==========

Version 2.5.1 *(2018-01-17)*
----------------------------
- 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.

Version 2.5.0 *(2017-12-18)*
----------------------------
- Improved performance of loading the `Stag.Factory`.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -2,7 +2,7 @@

Stag improves Gson performance by automatically generating reflection-less TypeAdapters for your model objects.

[![Build Status](https://travis-ci.org/vimeo/stag-java.svg?branch=develop)](https://travis-ci.org/vimeo/stag-java) [![codecov](https://codecov.io/gh/vimeo/stag-java/branch/develop/graph/badge.svg)](https://codecov.io/gh/vimeo/stag-java) [![Download](https://api.bintray.com/packages/vimeo/maven/stag-library/images/download.svg)](https://bintray.com/vimeo/maven/stag-library/_latestVersion) [![Javadocs](https://www.javadoc.io/badge/com.vimeo.stag/stag-library.svg)](https://www.javadoc.io/doc/com.vimeo.stag/stag-library)
[![Build Status](https://travis-ci.org/vimeo/stag-java.svg?branch=develop)](https://travis-ci.org/vimeo/stag-java) [![codecov](https://codecov.io/gh/vimeo/stag-java/branch/develop/graph/badge.svg)](https://codecov.io/gh/vimeo/stag-java) [![Download](https://api.bintray.com/packages/vimeo/maven/stag-library/images/download.svg)](https://bintray.com/vimeo/maven/stag-library/_latestVersion)


## Why Build Stag?
Expand Down Expand Up @@ -36,7 +36,7 @@ buildscript {
apply plugin: 'net.ltgt.apt'
dependencies {
def stagVersion = '2.5.0'
def stagVersion = '2.5.1'
compile "com.vimeo.stag:stag-library:$stagVersion"
apt "com.vimeo.stag:stag-library-compiler:$stagVersion"
}
Expand All @@ -57,7 +57,7 @@ gradle.projectsEvaluated {

```groovy
dependencies {
def stagVersion = '2.5.0'
def stagVersion = '2.5.1'
compile "com.vimeo.stag:stag-library:$stagVersion"
annotationProcessor "com.vimeo.stag:stag-library-compiler:$stagVersion"
}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {

ext.kotlinVersion = '1.2.10'
ext.kotlinVersion = '1.2.20'
ext.jacocoVersion = '0.7.9' // See http://www.eclemma.org/jacoco/
ext.gsonVersion = '2.8.2'

Expand Down Expand Up @@ -43,5 +43,5 @@ allprojects {

subprojects {
group = 'com.vimeo.stag'
version = '2.5.0'
version = '2.5.1'
}
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.vimeo.sample.model;
package com.vimeo.sample_java_model;

import com.vimeo.stag.UseStag;

Expand All @@ -36,7 +36,7 @@
* @param <T> the type of the list.
*/
@UseStag
public abstract class AbstractDataList<T> extends SuperAbstractDataList<Paging, ArrayList<T>> {
public abstract class AbstractDataList<T> extends SuperAbstractDataList<BaseExternalModel, ArrayList<T>> {

public int page;
}
}
@@ -0,0 +1,10 @@
package com.vimeo.sample_java_model;

import com.vimeo.stag.UseStag;

/**
* Test the extension of a partially resolved generic class.
*/
@UseStag
public class ConcreteDataList extends AbstractDataList<BaseExternalModel> {
}
@@ -0,0 +1,15 @@
package com.vimeo.sample_java_model;

import com.vimeo.stag.UseStag;

/**
* A model with multiple generic types. Acting as a use case for {@link DynamicallyTypedWildcard}.
*/
@UseStag
public class DynamicallyTypedModel<T extends BaseExternalModel, V extends ExternalModelGeneric<T>> {

public T videoValue;

public V dataListValue;

}
@@ -0,0 +1,17 @@
package com.vimeo.sample_java_model;

import com.vimeo.stag.UseStag;

import java.util.List;

/**
* A test case which tests a generic type that has wildcards. The type used is {@link DynamicallyTypedModel}.
*/
@UseStag
public class DynamicallyTypedWildcard {

public List<DynamicallyTypedModel<?, ?>> models;

public String name;

}
@@ -0,0 +1,15 @@
package com.vimeo.sample_java_model;

import com.vimeo.stag.UseStag;

/**
* Model which references a generically typed object without generic bounds (i.e., as a raw
* type).
*/
@UseStag
public class RawGenericField {

@SuppressWarnings("rawtypes")
public ExternalModelGeneric rawTypedField;

}
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.vimeo.sample.model;
package com.vimeo.sample_java_model;

import com.vimeo.stag.UseStag;

Expand All @@ -41,4 +41,4 @@ public abstract class SuperAbstractDataList<T, K> {
public T paging;

public K data;
}
}
@@ -0,0 +1,11 @@
package com.vimeo.sample_java_model;

import com.vimeo.stag.UseStag;

@UseStag
public class WildcardModel {

public String name;

public ExternalModelGeneric<?> externalModelGeneric;
}
@@ -1,12 +1,9 @@
package com.vimeo.sample.model.root;

import com.vimeo.sample.Utils;
import com.vimeo.sample.model.AbstractDataList;
package com.vimeo.sample_java_model;

import org.junit.Test;

/**
* Created by restainoa on 2/2/17.
* Integration tests for {@link AbstractDataList}.
*/
public class AbstractDataListTest {

Expand Down
@@ -0,0 +1,14 @@
package com.vimeo.sample_java_model;

import org.junit.Test;

/**
* Integration tests for {@link ConcreteDataList}.
*/
public class ConcreteDataListTest {

@Test
public void verifyTypeAdapterWasGenerated() throws Exception {
Utils.verifyTypeAdapterGeneration(ConcreteDataList.class);
}
}
@@ -0,0 +1,14 @@
package com.vimeo.sample_java_model;

import org.junit.Test;

/**
* Integration tests for {@link DynamicallyTypedModel}.
*/
public class DynamicallyTypedModelTest {

@Test
public void verifyTypeAdapterWasGenerated() throws Exception {
Utils.verifyTypeAdapterGeneration(DynamicallyTypedModel.class);
}
}
@@ -0,0 +1,14 @@
package com.vimeo.sample_java_model;

import org.junit.Test;

/**
* Integration tests for {@link DynamicallyTypedWildcard}.
*/
public class DynamicallyTypedWildcardTest {

@Test
public void verifyTypeAdapterWasGenerated() throws Exception {
Utils.verifyTypeAdapterGeneration(DynamicallyTypedWildcard.class);
}
}
@@ -0,0 +1,14 @@
package com.vimeo.sample_java_model;

import org.junit.Test;

/**
* Integration tests for {@link RawGenericField}.
*/
public class RawGenericFieldTest {

@Test
public void verifyTypeAdapterWasGenerated() throws Exception {
Utils.verifyTypeAdapterGeneration(RawGenericField.class);
}
}
@@ -1,12 +1,9 @@
package com.vimeo.sample.model.root;

import com.vimeo.sample.Utils;
import com.vimeo.sample.model.SuperAbstractDataList;
package com.vimeo.sample_java_model;

import org.junit.Test;

/**
* Created by restainoa on 2/2/17.
* Integration tests for {@link SuperAbstractDataList}.
*/
public class SuperAbstractDataListTest {

Expand All @@ -15,4 +12,4 @@ public void typeAdapterWasNotGenerated() throws Exception {
Utils.verifyNoTypeAdapterGeneration(SuperAbstractDataList.class);
}

}
}
@@ -0,0 +1,14 @@
package com.vimeo.sample_java_model;

import com.vimeo.stag.UseStag;

import org.junit.Test;

@UseStag
public class WildcardModelTest {

@Test
public void typeAdapterWasGenerated_WildcardModel() throws Exception {
Utils.verifyTypeAdapterGeneration(WildcardModel.class);
}
}
20 changes: 11 additions & 9 deletions sample/src/main/java/com/vimeo/sample/model/VideoList.java
Expand Up @@ -25,16 +25,18 @@

import com.vimeo.stag.UseStag;

import java.util.ArrayList;

/**
* Since this class has no annotated fields,
* this class would not normally be picked
* up by stag. The class level annotation
* ensures that stag sees it, and this class
* tests the ability of stag to recurse through
* the abstraction hierarchy and to resolve
* parameterized fields.
* A list of videos.
*/
@UseStag
public class VideoList extends AbstractDataList<Video> {
public class VideoList {

public Paging paging;

public int page;

public ArrayList<Video> data;

}
}
Expand Up @@ -168,4 +168,4 @@ public void run() {
}
}
}
}
}

0 comments on commit 42c168b

Please sign in to comment.