Skip to content

Commit a04ac30

Browse files
authored
Added @keep annotation to ease integration of geojson library (#1005)
1 parent 0934b06 commit a04ac30

25 files changed

Lines changed: 64 additions & 0 deletions

services-geojson/src/main/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.google.gson.typeadapters;
1818

19+
import android.support.annotation.Keep;
20+
1921
import java.io.IOException;
2022
import java.util.LinkedHashMap;
2123
import java.util.Map;
@@ -125,6 +127,7 @@
125127
* @param <T> base type for this factory
126128
* @since 4.6.0
127129
*/
130+
@Keep
128131
public final class RuntimeTypeAdapterFactory<T> implements TypeAdapterFactory {
129132
private final Class<?> baseType;
130133
private final String typeFieldName;

services-geojson/src/main/java/com/mapbox/geojson/BaseCoordinatesTypeAdapter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.mapbox.geojson;
22

3+
import android.support.annotation.Keep;
4+
35
import com.google.gson.TypeAdapter;
46
import com.google.gson.stream.JsonReader;
57
import com.google.gson.stream.JsonToken;
@@ -19,6 +21,7 @@
1921
* @param <T> Type of coordinates
2022
* @since 4.6.0
2123
*/
24+
@Keep
2225
abstract class BaseCoordinatesTypeAdapter<T> extends TypeAdapter<T> {
2326

2427

services-geojson/src/main/java/com/mapbox/geojson/BaseGeometryTypeAdapter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.mapbox.geojson;
22

3+
import android.support.annotation.Keep;
4+
35
import com.google.gson.Gson;
46
import com.google.gson.TypeAdapter;
57
import com.google.gson.stream.JsonReader;
@@ -18,6 +20,7 @@
1820
* @param <T> Type of coordinates
1921
* @since 4.6.0
2022
*/
23+
@Keep
2124
abstract class BaseGeometryTypeAdapter<G, T> extends TypeAdapter<G> {
2225

2326
private volatile TypeAdapter<String> stringAdapter;

services-geojson/src/main/java/com/mapbox/geojson/BoundingBox.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import static com.mapbox.geojson.constants.GeoJsonConstants.MIN_LONGITUDE;
55

66
import android.support.annotation.FloatRange;
7+
import android.support.annotation.Keep;
78
import android.support.annotation.NonNull;
89
import com.google.gson.Gson;
910
import com.google.gson.GsonBuilder;
@@ -28,6 +29,7 @@
2829
*
2930
* @since 3.0.0
3031
*/
32+
@Keep
3133
public class BoundingBox implements Serializable {
3234

3335
private final Point southwest;

services-geojson/src/main/java/com/mapbox/geojson/CoordinateContainer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.mapbox.geojson;
22

3+
import android.support.annotation.Keep;
4+
35
/**
46
* Each of the s geometries which make up GeoJson implement this interface and consume a varying
57
* dimension of {@link Point} list. Since this is varying, each geometry object fulfills the
@@ -8,6 +10,7 @@
810
* @param <T> a generic allowing varying dimensions for each GeoJson geometry
911
* @since 3.0.0
1012
*/
13+
@Keep
1114
public interface CoordinateContainer<T> extends Geometry {
1215

1316
/**

services-geojson/src/main/java/com/mapbox/geojson/Feature.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.mapbox.geojson;
22

3+
import android.support.annotation.Keep;
34
import android.support.annotation.NonNull;
45
import android.support.annotation.Nullable;
56
import com.google.gson.Gson;
@@ -46,6 +47,7 @@
4647
*
4748
* @since 1.0.0
4849
*/
50+
@Keep
4951
public final class Feature implements GeoJson {
5052

5153
private static final String TYPE = "Feature";

services-geojson/src/main/java/com/mapbox/geojson/FeatureCollection.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.mapbox.geojson;
22

3+
import android.support.annotation.Keep;
34
import android.support.annotation.NonNull;
45
import android.support.annotation.Nullable;
56
import com.google.gson.Gson;
@@ -37,6 +38,7 @@
3738
*
3839
* @since 1.0.0
3940
*/
41+
@Keep
4042
public final class FeatureCollection implements GeoJson {
4143

4244
private static final String TYPE = "FeatureCollection";

services-geojson/src/main/java/com/mapbox/geojson/GeoJson.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
package com.mapbox.geojson;
22

3+
import android.support.annotation.Keep;
4+
35
/**
46
* Generic implementation for all GeoJson objects defining common traits that each GeoJson object
57
* has. This logic is carried over to {@link Geometry} which is an interface which all seven GeoJson
68
* geometries implement.
79
*
810
* @since 1.0.0
911
*/
12+
@Keep
1013
public interface GeoJson {
1114

1215
/**
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
package com.mapbox.geojson;
22

3+
import android.support.annotation.Keep;
4+
35
/**
46
* Each of the six geometries and {@link GeometryCollection}
57
* which make up GeoJson implement this interface.
68
*
79
* @since 1.0.0
810
*/
11+
@Keep
912
public interface Geometry extends GeoJson {
1013

1114
}

services-geojson/src/main/java/com/mapbox/geojson/GeometryAdapterFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.mapbox.geojson;
22

3+
import android.support.annotation.Keep;
4+
35
import com.google.gson.TypeAdapterFactory;
46

57
import com.google.gson.typeadapters.RuntimeTypeAdapterFactory;
@@ -8,6 +10,7 @@
810
* A Geometry type adapter factory for convenience for serialization/deserialization.
911
* @since 4.6.0
1012
*/
13+
@Keep
1114
public abstract class GeometryAdapterFactory implements TypeAdapterFactory {
1215

1316
private static TypeAdapterFactory geometryTypeFactory;

0 commit comments

Comments
 (0)