airframe icon indicating copy to clipboard operation
airframe copied to clipboard

airspec: Bind test cases to lazy val to avoid too large method error in <init>

Open xerial opened this issue 2 years ago • 1 comments

If the byte code of all test cases exceeds the 64k method-size limit of JVM, 'Method too large' compilation error can happen, especially in Scala 3.

To avoid this, each test case should use a different method body:

// test code
test { .... } 

// current macro code expanded inside <init> < 64k JVM limit
addF0( ..test body) 

// better: Define each test case using a separate method < 64k JVM Limit
lazy val __t000: AirSpecTestDef = testDefF0(... test body) 
addF0(__t000)

xerial avatar Aug 28 '23 07:08 xerial

I need to create a reproduction spec first. I've forgotten how I encountered this issue 😅

xerial avatar Jan 10 '24 18:01 xerial