问题描述
在Java中使用普通的字符串连接时,javac会对此进行优化,使其可以改为使用StringBuilder
(或Java 5之前的StringBuffer)
对于我来说,将所有这些都关闭将是非常有用的,只是让字符串串联使用String
上的沼泽标准"append"方法即可.这种优化是否已完全融入" javac,还是有办法完全禁用它?
我不是Javac专家,但似乎在 Gen.java 文件,来自第1793行. /p>
When using normal string concatenation in Java, javac will optimise this where it can to use StringBuilder
instead (or StringBuffer before Java 5.)
In my case, it'd be incredibly helpful to switch all this off, and just have string concatenation use the bog standard "append" method on String
instead. Is this optimisation fully "baked in" to javac, or is there a way to disable it at all?
I'm not a javac expert but it seems to be hardcoded in javac in the Gen.java file from line 1793.
这篇关于在Javac中禁用StringBuilder优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!