当我正在经历一个项目时,我发现了一些奇怪的变量名称。 Sonarqube给了我关于这些变量的Code Smell声明。
例如protected String value$editedby$java$lang$String;
和消息从Sonarqube:
Rename this field "value$editedby$java$lang$String" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
因此,它是采用在变量名$
有道?
相关:http://stackoverflow.com/questions/7484210/what-is-the-meaning-of-in-a-variable-name – Maroun
你可能想在代码审查网络而不是StackOverflow上提出这个问题。 。 – radoh
[http://stackoverflow.com/a/7484245/348975](http://stackoverflow.com/a/7484245/348975)解释了为什么不应该使用'$'。这在我看来主要是胡说 - 如果你不应该使用'$'为什么它是一个允许的字符。另一方面,没有强烈的理由使用'$',它是公认的BS - 所以我遵循。 – emory