Closed GoogleCodeExporter closed 9 years ago
This is by design, since inner classes use a dollar sign to separate the outer
class name from the inner. I'd strongly recommend not using a dollar sign in
your class names, but if you do you can always use the overload of
toStringHelper that takes a String.
Original comment by cgdec...@gmail.com
on 3 Sep 2012 at 3:54
Note that Class.getSimpleName() returns correctly simple name in this case
instead of private static String simpleName(Class<?> clazz) of Guava's Objects
class.
It is very exceptional case when the character of dollar is used in class name,
but The Java Language Specification ALLOWS to do it in "mechanically generated
source code or, rarely, to access pre-existing names on legacy systems." (see
http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8)
Thus, it's good idea that the method's design formally came to compliance of
the Specification (if it is possible), isn't it?
Original comment by berra...@gmail.com
on 3 Sep 2012 at 4:37
The problem, as usual, is GWT, where getSimpleName() isn't available. One
possibility is to use Class.getSimpleName() under "normal Java" and our own
simpleName(Class) under GWT, but this doesn't seem worth the trouble.
Original comment by cpov...@google.com
on 3 Sep 2012 at 5:08
I would feel worse than this if toStringHelper weren't just aimed at helping
debugging by making it easier to write quick-and-dirty toString()
implementations. It's a convenience, but I'm not sure I can imagine
toStringHelper being a genuine necessity?
Original comment by wasserman.louis
on 3 Sep 2012 at 9:07
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:13
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:08
Original issue reported on code.google.com by
berra...@gmail.com
on 2 Sep 2012 at 2:10