10000 The signature of com.google.api.client.util.Data#nullOf is incorrect. · Issue #273 · googleapis/google-http-java-client · GitHub
[go: up one dir, main page]

Skip to content
The signature of com.google.api.client.util.Data#nullOf is incorrect. #273
Closed
@wonderfly

Description

@wonderfly

From cus...@google.com on November 12, 2014 15:52:32

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

T nullOf(Class<?> objClass);

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

T nullOf(Class objClass);

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

Object nullOf(Class 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: http://code.google.com/p/google-http-java-client/issues/detail?id=273

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0