DaveAKing / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Defaults does not handle the non-primitive class of a privitive #1417

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Example:

Boolean v1 = Defaults.defaultValue(boolean.class);
v1 != null;

Boolean v2 = Defaults.defaultValue(Boolean.class);
v2 == null;

Original issue reported on code.google.com by mr.nemet...@gmail.com on 17 May 2013 at 12:07

GoogleCodeExporter commented 9 years ago
This is intentional. As stated in the Javadoc, Defaults returns the default 
value for a type as defined by the JLS. It's the same value that a field of the 
given type would be initialized to if not initialized to something else. For 
all reference types, including primitive wrappers, this is null.

Original comment by cgdec...@gmail.com on 17 May 2013 at 1:39

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:12

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08