Disable StringBuilder optimization in javac

When using normal string concatenation in Java, javac will optimize this when it can be used StringBuilder

(or StringBuffer before Java 5) instead .

In my case, it would be incredibly useful to disable all this and just use string concatenation instead of the standard "add" bot to String

. Is this optimization completely baked in javac or is there a way to disable it altogether?

+3


source to share


2 answers


I'm not a javac expert, but it seems to be hardcoded to javac in the Gen.java file from line 1793.



+3


source


Take alook in this eclipse related link , but if you are using eclipse you may find some configuration related to optimizing options like unused local variables and co, hope you find something useful.



Alternatively, this assembler can help you. You want to describe ASCII Java classes written in simple assembler syntax using the Java Virtual Machine set instruction. It converts them into Java class binaries suitable for loading by the Java runtime system.

+1


source







All Articles