Собственно сама жесть:
https://raw.githubusercontent.com/groovy/groovy-core/master/src/main/org/code...
Комментарий к жести
/**
* This is a generated class used internally during the writing of bytecode within the CallSiteWriter logic.
* This is not a class exposed to users, as is the case with almost all classes in the org.codehaus.groovy packages.
* <p>
* The purpose is the reduction of the size of the bytecode. Consider creating a three element Object[] with null values:
* <pre>
* ANEWARRAY java/lang/Object
* DUP
* ICONST_0
* ACONST_NULL
* AASTORE
* DUP
* ICONST_1
* ACONST_NULL
* AASTORE
* DUP
* ICONST_2
* ACONST_NULL
* AASTORE
* </pre>
* with ArrayUtils you can have it like this:
* <pre>
* ACONST_NULL
* ACONST_NULL
* ACONST_NULL
* INVOKESTATIC ArrayUtils.createArray(Object,Object,Object)
* </pre>
* The number of needed instructions is thus reduced from 15 to 4. For every entry we save 3 bytecode instructions.
* This allows better readable bytecode and it allows the JIT to see less bytecode to optimize, helping under the
* inlining threshold here or there.
* <p>
* So even though the class is ugly, there are good reason to have this in Groovy, even if the class makes
* absolutely no sense in normal Java. But it is not used in normal Java, but from the bytecode.
*/
Ну и что тут JIT лучше наоптимизирует? Всё равно внутри ArrayUtils будет точно такой же типовой байткод, к которому теперь нужно идти через INVOKESTATIC и кучу ACONST. Создатели Groovy упоролись?
Перемещено JB из talks