jainshravan123 / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

The signature of com.google.api.client.util.Data#nullOf is incorrect. #915

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The signature of om.google.api.client.util.Data#nullOf(Class) doesn't make 
sense. The existing signature is:

<T> T nullOf(Class<?> objClass);

If the return type's class should always be the same as objClass, the signature 
should be:

<T> T nullOf(Class<T> objClass);

If that isn't true, the signature should be:

Object nullOf(Class<T> objClass);

In the second case, callers can perform explicit casts as necessary. The 
current behaviour results in an implicit unchecked cast at the callsite.

The existing signature also interacts badly with the improved target-type 
inference in Java 8.

Original issue reported on code.google.com by cus...@google.com on 12 Nov 2014 at 11:52

GoogleCodeExporter commented 9 years ago
Have no checkin entities in data store viewer. Am new to this code.

Original comment by mcalcagn...@gmail.com on 19 Dec 2014 at 4:32

GoogleCodeExporter commented 9 years ago
Moved to: Issue google-http-java-client:273

Original comment by wonder...@google.com on 29 Dec 2014 at 4:55