Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added @Keep annotation to ease integration of geojson library #1005

Merged
merged 1 commit into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.google.gson.typeadapters;

import android.support.annotation.Keep;

import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
Expand Down Expand Up @@ -125,6 +127,7 @@
* @param <T> base type for this factory
* @since 4.6.0
*/
@Keep
public final class RuntimeTypeAdapterFactory<T> implements TypeAdapterFactory {
private final Class<?> baseType;
private final String typeFieldName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;

import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
Expand All @@ -19,6 +21,7 @@
* @param <T> Type of coordinates
* @since 4.6.0
*/
@Keep
abstract class BaseCoordinatesTypeAdapter<T> extends TypeAdapter<T> {


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;

import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
Expand All @@ -18,6 +20,7 @@
* @param <T> Type of coordinates
* @since 4.6.0
*/
@Keep
abstract class BaseGeometryTypeAdapter<G, T> extends TypeAdapter<G> {

private volatile TypeAdapter<String> stringAdapter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static com.mapbox.geojson.constants.GeoJsonConstants.MIN_LONGITUDE;

import android.support.annotation.FloatRange;
import android.support.annotation.Keep;
import android.support.annotation.NonNull;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
Expand All @@ -28,6 +29,7 @@
*
* @since 3.0.0
*/
@Keep
public class BoundingBox implements Serializable {

private final Point southwest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;

/**
* Each of the s geometries which make up GeoJson implement this interface and consume a varying
* dimension of {@link Point} list. Since this is varying, each geometry object fulfills the
Expand All @@ -8,6 +10,7 @@
* @param <T> a generic allowing varying dimensions for each GeoJson geometry
* @since 3.0.0
*/
@Keep
public interface CoordinateContainer<T> extends Geometry {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.gson.Gson;
Expand Down Expand Up @@ -46,6 +47,7 @@
*
* @since 1.0.0
*/
@Keep
public final class Feature implements GeoJson {

private static final String TYPE = "Feature";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.gson.Gson;
Expand Down Expand Up @@ -37,6 +38,7 @@
*
* @since 1.0.0
*/
@Keep
public final class FeatureCollection implements GeoJson {

private static final String TYPE = "FeatureCollection";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;

/**
* Generic implementation for all GeoJson objects defining common traits that each GeoJson object
* has. This logic is carried over to {@link Geometry} which is an interface which all seven GeoJson
* geometries implement.
*
* @since 1.0.0
*/
@Keep
public interface GeoJson {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;

/**
* Each of the six geometries and {@link GeometryCollection}
* which make up GeoJson implement this interface.
*
* @since 1.0.0
*/
@Keep
public interface Geometry extends GeoJson {

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;

import com.google.gson.TypeAdapterFactory;

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

private static TypeAdapterFactory geometryTypeFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

Expand Down Expand Up @@ -59,6 +60,7 @@
*
* @since 1.0.0
*/
@Keep
public final class GeometryCollection implements Geometry, Serializable {

private static final String TYPE = "GeometryCollection";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.gson.Gson;
Expand Down Expand Up @@ -48,6 +49,7 @@
*
* @since 1.0.0
*/
@Keep
public final class LineString implements CoordinateContainer<List<Point>>, Serializable {

private static final String TYPE = "LineString";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;

import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

Expand All @@ -11,6 +13,7 @@
*
* @since 4.6.0
*/
@Keep
class ListOfDoublesCoordinatesTypeAdapter extends BaseCoordinatesTypeAdapter<List<Double>> {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;

import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
Expand All @@ -15,6 +17,7 @@
*
* @since 4.6.0
*/
@Keep
class ListOfListOfPointCoordinatesTypeAdapter
extends BaseCoordinatesTypeAdapter<List<List<Point>>> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;

import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
Expand All @@ -14,6 +16,7 @@
*
* @since 4.6.0
*/
@Keep
class ListOfPointCoordinatesTypeAdapter extends BaseCoordinatesTypeAdapter<List<Point>> {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;

import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
Expand All @@ -15,6 +17,7 @@
*
* @since 4.6.0
*/
@Keep
class ListofListofListOfPointCoordinatesTypeAdapter
extends BaseCoordinatesTypeAdapter<List<List<List<Point>>>> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.gson.Gson;
Expand Down Expand Up @@ -49,6 +50,7 @@
*
* @since 1.0.0
*/
@Keep
public final class MultiLineString
implements CoordinateContainer<List<List<Point>>>, Serializable {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.gson.Gson;
Expand Down Expand Up @@ -34,6 +35,7 @@
*
* @since 1.0.0
*/
@Keep
public final class MultiPoint implements CoordinateContainer<List<Point>>, Serializable {

private static final String TYPE = "MultiPoint";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.gson.Gson;
Expand Down Expand Up @@ -67,6 +68,7 @@
*
* @since 1.0.0
*/
@Keep
public final class MultiPolygon
implements CoordinateContainer<List<List<List<Point>>>>, Serializable {

Expand Down
2 changes: 2 additions & 0 deletions services-geojson/src/main/java/com/mapbox/geojson/Point.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static com.mapbox.geojson.constants.GeoJsonConstants.MIN_LONGITUDE;

import android.support.annotation.FloatRange;
import android.support.annotation.Keep;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.gson.Gson;
Expand Down Expand Up @@ -51,6 +52,7 @@
*
* @since 1.0.0
*/
@Keep
public final class Point implements CoordinateContainer<List<Double>>, Serializable {

private static final String TYPE = "Point";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;

import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

Expand All @@ -11,6 +13,7 @@
*
* @since 4.6.0
*/
@Keep
public class PointAsCoordinatesTypeAdapter extends BaseCoordinatesTypeAdapter<Point> {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mapbox.geojson;

import android.support.annotation.Keep;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.Size;
Expand Down Expand Up @@ -55,6 +56,7 @@
*
* @since 1.0.0
*/
@Keep
public final class Polygon implements CoordinateContainer<List<List<Point>>>, Serializable {

private static final String TYPE = "Polygon";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mapbox.geojson.gson;

import android.support.annotation.Keep;

import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
Expand All @@ -18,6 +20,7 @@
*
* @since 4.6.0
*/
@Keep
public class BoundingBoxTypeAdapter extends TypeAdapter<BoundingBox> {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mapbox.geojson.gson;

import android.support.annotation.Keep;

import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
Expand All @@ -21,6 +23,7 @@
*
* @since 3.0.0
*/
@Keep
public abstract class GeoJsonAdapterFactory implements TypeAdapterFactory {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mapbox.geojson.gson;

import android.support.annotation.Keep;
import android.support.annotation.NonNull;

import com.google.gson.GsonBuilder;
Expand All @@ -10,6 +11,7 @@
* This is a utility class that helps create a Geometry instance from a JSON string.
* @since 4.0.0
*/
@Keep
public class GeometryGeoJson {

/**
Expand Down