compile-static

Should I use Groovy's @CompileStatic if I'm also using Java 7

元气小坏坏 提交于 2020-01-01 07:56:11
问题 I've read through the "What's new in Groovy 2.0" and I'm a bit confused about when to use @CompileStatic. The article mentions that the @CompileStatic annotation was added for developers who weren't able to take advantage of the invoke dynamic part of Java7. So developers looking for performance improvements would not see much changes in Groovy 2.0, if they aren’t able to run on JDK 7. Luckily, the Groovy development team thought those developers could get interesting performance boost, among

Groovy 2.1.0 weird behaviour of switch-case-break statement with @CompileStatic

空扰寡人 提交于 2019-12-12 11:39:43
问题 I'm novice groovy programmer, and I faced weird behaviour of switch-case-break statement with static compilation ( @CompileStatic annotation). It seems that break s are ignored. Is it a bug or I've missed something while reading documentation. Environment: - groovy sdk 2.1.0 - Oracle JDK build 1.7.0_13-b20 on Mac OS X Lion 10.7.5 Test case: import groovy.transform.CompileStatic @CompileStatic class Test { def test() { ['A', 'B', 'C'].each { String val -> switch (val) { case 'A' : println("$

Should I use Groovy's @CompileStatic if I'm also using Java 7

我们两清 提交于 2019-12-04 01:34:07
I've read through the "What's new in Groovy 2.0" and I'm a bit confused about when to use @CompileStatic. The article mentions that the @CompileStatic annotation was added for developers who weren't able to take advantage of the invoke dynamic part of Java7. So developers looking for performance improvements would not see much changes in Groovy 2.0, if they aren’t able to run on JDK 7. Luckily, the Groovy development team thought those developers could get interesting performance boost, among other advantages, by allowing type checked code to be compiled statically. My question is, if I'm