artiya4u / google-http-java-client

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

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

Open GoogleCodeExporter opened 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