在美元符号($)在日志消息含义 [英] Meaning of the Dollar symbol ($) in the log messages
问题描述
java.util.ConcurrentModificationException:空
$的java.util.HashMap HashIterator(HashMap.java:806) com.cimba.gsr.fragments.SessionsFragment(SessionsFragment.java:233) com.cimba.gsr.fragments.SessionsFragment $ 4(SessionsFragment.java:201)
在某个时候日志输出类名称后有消息在DOLLOR符号($)是什么意思呢?我认为它的方法名称或引起异常类变量名,但在这种情况下,它没有任何意义(SessionsFragment $ 4中不能是一个方法或变量的名称)。
是什么呢?
的 $
是一个分隔符,表示有一个嵌套类 HashIterator
的的HashMap
类里面,有一个匿名内部类(第四个,它看起来像)中的 SessionsFragment
类。
<一个href=\"http://www.javaworld.com/article/2077489/core-java/java-tip-124--trace-your-steps-in-java-1-4.html\"相对=nofollow>这个网站介绍中的 $
分隔符。
文件名:StackTrace.java行号:267
包名称:boo.hoo
完整的类名称:boo.hoo.StackTrace $ FirstNested $ SecondNested
简单的类名:$栈跟踪$ FirstNested SecondNested
Unmunged类名称:StackTrace.FirstNested.SecondNested
直接的类名:SecondNested
方法名称:&LT;&初始化GT;
本地方法?:假的
的toString():
boo.hoo.StackTrace $ FirstNested $ SecondNested&LT;&初始化GT;(StackTrace.java:267)
嵌套类是从更高层次的嵌套类,并从顶层类使用美元符号($)区别开来。因此,技术上,第二嵌套类的简单的名字是堆栈跟踪$ FirstNested $ SecondNested。
块引用>java.util.ConcurrentModificationException: null java.util.HashMap$HashIterator(HashMap.java:806) com.cimba.gsr.fragments.SessionsFragment(SessionsFragment.java:233) com.cimba.gsr.fragments.SessionsFragment$4(SessionsFragment.java:201)
Sometime in log output after a class name there is a Dollor symbol ($) in the message what does that mean? I thought it's the method name or the variable name in the class that caused the exception but in this case it doesn't make sense (SessionsFragment$4 it can't be the name of a method or variable). so what is it ?
解决方案The
$
is a separator that indicates that there is a nested classHashIterator
inside theHashMap
class, and that there is an anonymous inner class (the fourth one, it looks like) inside theSessionsFragment
class.This site explains the
$
separator.Filename: StackTrace.java Line number: 267 Package name: boo.hoo Full class name: boo.hoo.StackTrace$FirstNested$SecondNested Simple class name: StackTrace$FirstNested$SecondNested Unmunged class name: StackTrace.FirstNested.SecondNested Direct class name: SecondNested Method name: <init> Native method?: false toString(): boo.hoo.StackTrace$FirstNested$SecondNested.<init>(StackTrace.java:267)
The nested classes are distinguished from the higher-level nested classes and from the top-level class by using the dollar sign character ($). So, technically, the "simple" name of the second nested class is StackTrace$FirstNested$SecondNested.
这篇关于在美元符号($)在日志消息含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!