Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.7.5, 1.8-beta-2
-
None
-
None
Description
@Immutable class Foo { private static final String BAR = 'baz' }
For the above code, the initialization statements for the static field should be added only to <clinit> and not to <init>.
The instructions below are taken from <init> and they show the initialization statements are getting added to instance initializers also, which is wrong.
108 ifeq 136 (+28) 111 ldc #84 <baz> 113 aconst_null 114 invokestatic #54 <org/codehaus/groovy/runtime/ScriptBytecodeAdapter.compareEqual> 117 ifeq 123 (+6) 120 goto 133 (+13) 123 ldc #84 <baz> 125 dup 126 checkcast #86 <java/lang/String> 129 putstatic #88 <Foo.BAR> 132 pop 133 goto 154 (+21) 136 aload_2 137 ldc #89 <4> 139 aaload 140 aload_1 141 invokeinterface #69 <org/codehaus/groovy/runtime/callsite/CallSite.callGetProperty> count 2 146 dup 147 checkcast #86 <java/lang/String> 150 putstatic #88 <Foo.BAR>