The Spock test passes in Eclipse but blows up using Gradle with reason: Error exists in the bytecode Gradle: 2.0 Groovy: 2.3.6
import groovy.transform.Immutable
@Immutable
class ImmutablePath{
List<ImmutableLine> segments = []
}
import spock.lang.Specification
class ImmutablePathTest extends Specification {
ImmutablePath path
def setup() {
def lines = []
ImmutablePoint p1 = new ImmutablePoint(x:0,y:0)
ImmutablePoint p2 = new ImmutablePoint(x:3,y:0)
ImmutablePoint p3 = new ImmutablePoint(x:0,y:4)
lines << new ImmutableLine(start:p1, end:p2)
lines << new ImmutableLine(start:p2, end:p3)
lines << new ImmutableLine(start:p3, end:p1)
path = new ImmutablePath(segments:lines)
<----------------------
Gradle Blows Up Here
}
...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileTestGroovy'.
> Bad <init> method call from inside of a branch
Exception Details:
Location:
ImmutablePath.<init>(Ljava/util/List;)V @99: invokespecial
Reason:
Error exists in the bytecode
Bytecode:
0x0000000: b800 204d 04bd 0004 5903 05bd 0004 5903
0x0000010: 12f6 5359 042b 53b8 00da 12dc b800 4bc0
0x0000020: 00dc 12dc b800 4f53 5910 ff12 02b8 00e8
0x0000030: 2a5f ab00 0000 0055 0000 0003 93eb 101e
0x0000040: 0000 0022 0000 9b75 0000 0037 61fb 9e66
0x0000050: 0000 0040 5f5a 5903 3212 dcb8 004b c000
0x0000060: dc5f 57b7 00ea a700 2b5f 5a57 b700 eba7
0x0000070: 0022 5f5a 5903 3212 5eb8 004b c000 5e5f
0x0000080: 57b7 00ee a700 0dbb 00f0 5912 f2b7 00f5
0x0000090: bf57 b1
Stackmap Table:
full_frame(@84,{UninitializedThis,Object[#94],Object[#226]},{Object[#109],UninitializedThis})
full_frame(@105,{UninitializedThis,Object[#94],Object[#226]},{Object[#109],UninitializedThis})
full_frame(@114,{UninitializedThis,Object[#94],Object[#226]},{Object[#109],UninitializedThis})
full_frame(@135,{UninitializedThis,Object[#94],Object[#226]},{Object[#109],UninitializedThis})
full_frame(@145,{Object[#2],Object[#94],Object[#226]},{Object[#109]})