Another java.lang.VerifyError: Bad access to protected data

This was another test case, trying to create a simple case for a failure in my Android project. The original failure was generate byte code trying to clone a string, causing at runtime:

    java.lang.CloneNotSupportedException: Class java.lang.String doesn't implement Cloneable
    at java.lang.Object.clone(Object.java:237)

But the simplest test case gives me a VerifyError when running as a Java command line app:

print("The magic happens here.")

class MyThing
{
    private var dict: Dictionary
    
    public init()
    {
        self.dict = Dictionary()
    }
    
    open func getAndUpdate( forKey key: Key, _ updateFunc: @escaping (Value?) -> (Value?) ) -> Value?
    {
        let current = dict[key]
        let newVal = updateFunc(current)
        dict[key] = newVal
        return newVal
    }
    
    
}

let mt = MyThing()

mt.getAndUpdate(forKey: "hello") { key in
    return "world"
}

Gives:
!> Fatal exception of type java.lang.VerifyError on thread 0001 ()
!> Message: java.lang.VerifyError: (class: consoleapplication224/MyThing, method: getAndUpdate__forKey__ signature: (Ljava/lang/Object;Lcom/remobjects/elements/system/Func2;)Ljava/lang/Object;) Bad access to protected data

consoleapplication224.zip (201.9 KB)

Thanks, logged as bugs://80913

bugs://80913 got closed with status fixed.