Extremely happy to report that I was able to upgrade to groovy 5! I will submit my PR after processing existing ones. I had nasty bugs that forced me to debug the bytecode using javap. It turns out that @CompileStatic is more strict, and we had code that generated illegal bytecode and it was difficult to debug, but once identified the solution is easy. Take a look at the below to see how cryptic the error was
10:20:00.163 INFO main .moqui.i.c.ExecutionContextFactoryImpl Running on Java 21.0.2 VM 21.0.2+13-58 Runtime 21.0.2+13-58
Error loading or running Moqui.loadData with args [{load=, types=all}]: java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at MoquiStart.main(MoquiStart.java:153)
Caused by: java.util.ServiceConfigurationError: org.moqui.context.ExecutionContextFactory: Provider org.moqui.impl.context.ExecutionContextFactoryImpl could not be instantiated
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586)
at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:813)
at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:729)
at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1403)
at org.moqui.Moqui.loadData(Moqui.java:122)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
... 2 more
Caused by: java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
org/moqui/impl/context/ExecutionContextFactoryImpl$ComponentInfo.init(Ljava/lang/String;Lorg/moqui/util/MNode;)V @256: invokevirtual
Reason:
Type 'org/moqui/impl/context/ExecutionContextFactoryImpl$ComponentInfo' (current frame, stack[0]) is not assignable to 'groovy/lang/Closure'
Current Frame:
bci: @256
flags: { }
locals: { 'org/moqui/impl/context/ExecutionContextFactoryImpl$ComponentInfo', 'java/lang/String', 'org/moqui/util/MNode', top, 'org/moqui/resource/ResourceReference', 'java/lang/String', 'org/moqui/resource/ResourceReference', 'java/lang/String', 'java/io/File', 'java/lang/String' }
stack: { 'org/moqui/impl/context/ExecutionContextFactoryImpl$ComponentInfo' }
Bytecode:
0000000: 2b59 ba00 4300 0099 0006 a700 1457 2c59
0000010: 4ec6 000c 2d12 4cb6 0052 a700 0401 2a5f
0000020: b500 612a b400 6159 c700 0857 03a7 0008
0000030: ba00 4300 009a 0007 04a7 0004 0399 0010
0000040: bb00 6359 1265 b700 68c0 006a bf2a b400
0000050: 6112 6cb6 006f 9901 8b2a b400 61b8 0073
0000060: 3a04 1904 b600 799a 0007 04a7 0004 0399
0000070: 0033 bb00 6359 bb00 7b59 04bd 0004 5903
0000080: 2ab4 0061 5305 bd00 5e59 0312 7d53 5904
0000090: 127f 53b7 0082 ba00 8500 00b7 0068 c000
00000a0: 6abf 2ab4 0061 032a b400 61b6 0089 0764
00000b0: b600 8db8 0090 3a05 1905 b800 733a 0619
00000c0: 04b6 0093 9900 1719 06b6 0093 9a00 0704
00000d0: a700 0403 9900 0704 a700 0403 9900 fe19
00000e0: 04b6 0097 b600 9d08 b600 a03a 07bb 00a2
00000f0: 5919 07b7 00a3 3a08 1908 b600 a63a 092a
0000100: b600 acc0 0009 b600 b0ba 00b3 0000 bb00
0000110: 7b59 05bd 0004 5903 1904 b600 b653 5904
0000120: 1909 5306 bd00 5e59 0312 b853 5904 12ba
0000130: 5359 0512 bc53 b700 82ba 0085 0000 b900
0000140: c102 00bb 00c3 5919 04b6 00c7 b700 ca3a
0000150: 0a19 0ab6 00ce 3a0b 190b c600 0704 a700
0000160: 0403 9900 6319 0912 45b8 004b 190b b600
0000170: d3b8 004b b800 733a 0c19 0cb6 0097 b600
0000180: 9d08 b600 a03a 0d19 0bb6 00d6 9900 17bb
0000190: 00a2 5919 0db7 00a3 3a0e 190e b600 d957
00001a0: a700 16bb 00db 5919 0db7 00dc 3a0f 190a
00001b0: 190f b800 e257 190a b600 e519 0ab6 00ce
00001c0: 3a0b a7ff 96a7 0003 190a b600 e8a7 000d
00001d0: 3a10 190a b600 e819 10bf 1905 2a5f b500
00001e0: 612a b400 6112 45b6 006f 9900 192a b400
00001f0: 6103 2ab4 0061 b600 8904 64b6 008d 2a5f
0000200: b500 612a b400 6112 45b6 00ec 3611 1511
0000210: 03a2 0007 04a7 0004 0399 0026 2ab4 0040
0000220: b600 ef12 45b8 004b 2ab4 0061 b800 4b2a
0000230: 5fb5 0061 2ab4 0061 1245 b600 ec36 112a
0000240: b400 6115 1104 60b6 00a0 2a5f b500 f112
0000250: f32a 5fb5 00f5 2ab4 0061 b800 732a 5fb5
0000260: 00f7 2ab4 00f7 b600 799a 0007 04a7 0004
0000270: 0399 0033 bb00 6359 bb00 7b59 04bd 0004
0000280: 5903 2ab4 0061 5305 bd00 5e59 0312 7d53
0000290: 5904 127f 53b7 0082 ba00 8500 00b7 0068
00002a0: c000 6abf 2ab4 00f7 b600 939a 0007 04a7
00002b0: 0004 0399 0033 bb00 6359 bb00 7b59 04bd
00002c0: 0004 5903 2ab4 0061 5305 bd00 5e59 0312
00002d0: f953 5904 12bc 53b7 0082 ba00 8500 00b7
00002e0: 0068 c000 6abf 2ab4 00f7 b600 fa9a 0007
00002f0: 04a7 0004 0399 0033 bb00 6359 bb00 7b59
0000300: 04bd 0004 5903 2ab4 0061 5305 bd00 5e59
0000310: 0312 fc53 5904 12bc 53b7 0082 ba00 8500
0000320: 00b7 0068 c000 6abf 2ab4 00f7 12fe b601
0000330: 013a 1219 12b6 0093 9900 0b19 12b8 0105
0000340: a700 042c 3a13 1913 c600 0704 a700 0403
0000350: 9900 a719 1313 0106 b600 523a 1419 1459
0000360: c700 0857 03a7 0008 ba00 4300 0099 000a
0000370: 1914 2a5f b500 f119 1313 0107 b600 523a
0000380: 1519 1559 c700 0857 03a7 0008 ba00 4300
0000390: 0099 000d 1915 b801 0c2a 5fb5 00f5 1913
00003a0: 1301 0eb6 0111 9900 5119 1313 010e b601
00003b0: 1559 3a16 c600 0b19 16b6 011b a700 0401
00003c0: 013a 173a 1819 18c6 0030 1918 b901 2001
00003d0: 0099 0026 1918 b901 2301 00ba 0126 0000
00003e0: 3a17 2ab4 0038 1917 1301 06b6 0052 b901
00003f0: 2c02 0057 a7ff d62a b400 f713 012e b601
0000400: 013a 1919 19b6 0093 9900 6abb 0130 59b7
0000410: 0131 1919 b601 34b6 0138 ba00 3100 002a
0000420: 5fb5 0033 a700 463a 1a2a b600 acc0 0009
0000430: b600 b0ba 00b3 0000 bb00 7b59 04bd 0004
0000440: 5903 1919 b601 3b53 05bd 005e 5903 1301
0000450: 3d53 5904 12bc 53b7 0082 ba00 8500 0019
0000460: 1ab9 0141 0300 00a7 0003 a700 083a 1b19
0000470: 1bbf b1
Exception Handler Table:
bci [337, 456] => handler: 464
bci [1035, 1063] => handler: 1063
bci [1035, 1063] => handler: 1133
bci [1063, 1127] => handler: 1133
Stackmap Table:
same_locals_1_stack_item_frame(@13,Object[#94])
append_frame(@29,Object[#78])
full_frame(@30,{Object[#2],Object[#94],Object[#78]},{Object[#94]})
same_locals_1_stack_item_frame(@48,Object[#94])
same_locals_1_stack_item_frame(@53,Integer)
same_frame(@60)
same_locals_1_stack_item_frame(@61,Integer)
same_frame(@77)
append_frame(@110,Top,Object[#117])
same_locals_1_stack_item_frame(@111,Integer)
same_frame(@162)
append_frame(@211,Object[#94],Object[#117])
same_locals_1_stack_item_frame(@212,Integer)
same_frame(@219)
same_locals_1_stack_item_frame(@220,Integer)
full_frame(@344,{Object[#2],Object[#94],Object[#78],Top,Object[#117],Object[#94],Object[#117],Object[#94],Object[#162],Object[#94],Object[#195],Object[#208]},{})
same_frame(@353)
same_locals_1_stack_item_frame(@354,Integer)
append_frame(@419,Object[#117],Object[#94])
same_frame(@438)
chop_frame(@453,2)
same_frame(@456)
full_frame(@464,{Object[#2],Object[#94],Object[#78],Top,Object[#117],Object[#94],Object[#117],Object[#94],Object[#162],Object[#94],Object[#195]},{Object[#106]})
full_frame(@474,{Object[#2],Object[#94],Object[#78],Top,Object[#117],Object[#94],Object[#117]},{})
full_frame(@481,{Object[#2],Object[#94],Object[#78]},{})
same_frame(@515)
full_frame(@536,{Object[#2],Object[#94],Object[#78],Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Integer},{})
same_locals_1_stack_item_frame(@537,Integer)
same_frame(@575)
same_frame(@624)
same_locals_1_stack_item_frame(@625,Integer)
same_frame(@676)
same_frame(@690)
same_locals_1_stack_item_frame(@691,Integer)
same_frame(@742)
same_frame(@756)
same_locals_1_stack_item_frame(@757,Integer)
same_frame(@808)
append_frame(@835,Object[#117])
same_locals_1_stack_item_frame(@836,Object[#78])
append_frame(@847,Object[#78])
same_locals_1_stack_item_frame(@848,Integer)
full_frame(@872,{Object[#2],Object[#94],Object[#78],Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Integer,Object[#117],Object[#78],Object[#94]},{Object[#94]})
same_locals_1_stack_item_frame(@877,Integer)
same_frame(@887)
full_frame(@908,{Object[#2],Object[#94],Object[#78],Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Integer,Object[#117],Object[#78],Object[#94],Object[#94]},{Object[#94]})
same_locals_1_stack_item_frame(@913,Integer)
same_frame(@926)
append_frame(@959,Object[#279])
same_locals_1_stack_item_frame(@960,Object[#285])
append_frame(@970,Object[#78],Object[#285])
full_frame(@1015,{Object[#2],Object[#94],Object[#78],Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Integer,Object[#117],Object[#78]},{})
full_frame(@1063,{Object[#2],Object[#94],Object[#78],Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Integer,Object[#117],Object[#78],Top,Top,Top,Top,Top,Object[#117]},{Object[#323]})
same_frame_extended(@1130)
same_locals_1_stack_item_frame(@1133,Object[#106])
same_frame(@1138)
at org.moqui.impl.context.ExecutionContextFactoryImpl.addComponentDir(ExecutionContextFactoryImpl.groovy:1280)
at org.moqui.impl.context.ExecutionContextFactoryImpl.initComponents(ExecutionContextFactoryImpl.groovy:371)
at org.moqui.impl.context.ExecutionContextFactoryImpl.<init>(ExecutionContextFactoryImpl.groovy:211)
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:789)
... 6 more