Sometimes use canonical names and simple names instead of binary names for classes. #1515
+291
−89
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sometimes use canonical names and simple names instead of binary names for classes.
Terminology refresher:
com.google.Foo$BarException
(though I seem to recall learning from the prospective reviewer of this CL that there's a second kind of "binary name," probably using/
instead of.
?)com.google.Foo.BarException
BarException
Specifically, we use simple names only for a set of well-known classes (as opposed to using them everywhere), and then we try canonical names, falling back to binary names when we have no other option (e.g., anonymous and local classes).
Advantages:
IterableSubject
failure messages, for example).[Ljava.lang.Long;
(in contrast tojava.lang.Long[]
or justLong[]
).Long
: Is itjava.lang.Long
orkotlin.Long
?Integer
/Int
andCharacter
/Char
, but we can at least avoid mentioning "Java" and "Kotlin" for users who might not think of themselves as using one of those things.Map.Entry
" inSubjectUtils
.This CL requires that I change
SubjectUtils.java
to actually use its ownlongName
method in one place. I had missed this in cl/773872316.