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

Suppress deprecation warnings for radarSearchQuery #302

Merged
merged 1 commit into from
Jul 29, 2017
Merged

Suppress deprecation warnings for radarSearchQuery #302

merged 1 commit into from
Jul 29, 2017

Conversation

apjanke
Copy link
Contributor

@apjanke apjanke commented Jul 29, 2017

When I run ./gradlew test, there are deprecation warnings because PlacesApiTest calls PlacesApi.radarSearchQuery, which is deprecated.

When I enable verbose -Xlint:deprecated, I get this.

> Task :compileTestJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7
/Users/janke/local/repos/google-maps-services-java/src/test/java/com/google/maps/GeoApiContextTest.java:79: warning: [unchecked] unchecked method invocation: method get in class GeoApiContext is applied to given types
    builder.build().get(new ApiConfig(path), fakeResponse.getClass(), params).awaitIgnoreError();
                       ^
  required: ApiConfig,Class<? extends R>,Map<String,String>
  found: ApiConfig,Class<CAP#1>,Map<String,String>
  where R,T are type-variables:
    R extends ApiResponse<T> declared in method <T,R>get(ApiConfig,Class<? extends R>,Map<String,String>)
    T extends Object declared in method <T,R>get(ApiConfig,Class<? extends R>,Map<String,String>)
  where CAP#1 is a fresh type-variable:
    CAP#1 extends ApiResponse from capture of ? extends ApiResponse
/Users/janke/local/repos/google-maps-services-java/src/test/java/com/google/maps/PlacesApiTest.java:587: warning: [deprecation] radarSearchQuery(GeoApiContext,LatLng,int) in PlacesApi has been deprecated
      PlacesApi.radarSearchQuery(sc.context, location, 5000)
               ^
/Users/janke/local/repos/google-maps-services-java/src/test/java/com/google/maps/PlacesApiTest.java:613: warning: [deprecation] radarSearchQuery(GeoApiContext,LatLng,int) in PlacesApi has been deprecated
      PlacesApi.radarSearchQuery(sc.context, location, 5000).await();
               ^
/Users/janke/local/repos/google-maps-services-java/src/test/java/com/google/maps/PlacesApiTest.java:753: warning: [deprecation] radarSearchQuery(GeoApiContext,LatLng,int) in PlacesApi has been deprecated
          PlacesApi.radarSearchQuery(sc.context, SYDNEY, 10000).keyword("pub").await();
                   ^
/Users/janke/local/repos/google-maps-services-java/src/test/java/com/google/maps/PlacesApiTest.java:768: warning: [deprecation] radarSearchQuery(GeoApiContext,LatLng,int) in PlacesApi has been deprecated
          PlacesApi.radarSearchQuery(sc.context, SYDNEY, 10000).name("Sydney Town Hall").await();
                   ^
/Users/janke/local/repos/google-maps-services-java/src/test/java/com/google/maps/PlacesApiTest.java:786: warning: [deprecation] radarSearchQuery(GeoApiContext,LatLng,int) in PlacesApi has been deprecated
          PlacesApi.radarSearchQuery(sc.context, SYDNEY, 10000).type(PlaceType.BAR).await();

Because this is commented as still working until June 2018, I assume that it's intentional to keep the tests for it in place until the feature is actually turned off and it is removed from the google-maps-services-java API.

This PR suppresses those deprecation warnings, leaving the tests in place. This results in cleaner output for developers running the tests.

This PR also enables verbose output for deprecation warnings to make diagnosing them easier. I think this is a good idea because aside from the radarSearchQuery warnings, which are now handled in this PR, there are no deprecation warnings, so it won't end up spamming people who run the build. And IMHO this is the right approach to use for tracking down deprecated method calls and either fixing them up or putting warning suppressions on them.

@domesticmouse
Copy link
Contributor

Good idea, thanks!

@domesticmouse domesticmouse merged commit 9281719 into googlemaps:master Jul 29, 2017
@apjanke apjanke deleted the handle-deprecation-warnings branch August 3, 2017 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants