forked from google/guava
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add overloads to Preconditions checkState,checkArgument and checkNotN…
…ull to avoid boxing and varargs for the most common parameter combinations. This adds primitive overloads for all combinations of Object,char,int and long up to 2 parameters and Object only overloads up to 4 parameters. This covers 92-98% of formatting calls based on an analysis of googles codebase. This change is fully binary compatible but only mostly source compatible. It is possible that this cl will call some Preconditions calls to become ambiguous with respect to overload resolution. For example this call void foo(Boolean condition, short s) { checkState(condition, "%s", s); } will fail to compile with this change. There are two simple changes to the invocation that will resolve the ambiguity. 'condition' can be explicitly unboxed, or 's' can be explicitly boxed. We believe that such situations will be incredibly rare. See the JLS 15.12.2 for full information on overload resolution: https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12.2 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=115881707
- Loading branch information
1 parent
b76c418
commit 892e323
Showing
2 changed files
with
1,056 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.