#2684 VerifyError

SlimerDude Wed 7 Feb

I came across a strange edge case today whereby I was getting a java.lang.VerifyError on code that should work. I've reduced it down to this code:

class Example {
    [Str:Obj]? map1
	
    Void main(Str[] args) {
        map2 := map1 ?: Str:Obj?[:]
        map3 := [,].reduce(Str:Obj?[:]) { it }
        map2.setAll(map3)
        echo("done")
    }
}

which gives:

java.lang.VerifyError: (class: fan/acme/Example, method: main signature: (Lfan/sys/List;)V) Incompatible argument to function
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
    at java.lang.Class.getDeclaredFields(Class.java:1916)
    at fan.sys.ClassType.finishSlots(ClassType.java:591)
    at fan.sys.ClassType.finish(ClassType.java:553)
    at fan.sys.Method$MethodFunc.isStatic(Method.java:489)
    at fan.sys.Method$MethodFunc.callList(Method.java:205)
    at fan.sys.Type.make(Type.java:246)
    at fan.sys.ClassType.make(ClassType.java:110)
    at fan.sys.Type.make(Type.java:236)
    at fanx.tools.Fan.callMain(Fan.java:185)
    at fanx.tools.Fan.executeType(Fan.java:147)
    at fanx.tools.Fan.execute(Fan.java:41)
    at fanx.tools.Fan.run(Fan.java:308)
    at fanx.tools.Fan.main(Fan.java:346)
sys::Err: Method not mapped to java.lang.reflect correctly cwApp::Example.make
  fan.sys.Method$MethodFunc.isStatic (Method.java:496)
  fan.sys.Method$MethodFunc.callList (Method.java:205)
  fan.sys.Type.make (Type.java:246)
  fan.sys.ClassType.make (ClassType.java:110)
  fan.sys.Type.make (Type.java:236)
  fanx.tools.Fan.callMain (Fan.java:185)
  fanx.tools.Fan.executeType (Fan.java:147)
  fanx.tools.Fan.execute (Fan.java:41)
  fanx.tools.Fan.run (Fan.java:308)
  fanx.tools.Fan.main (Fan.java:346)

Changing any part of the code in any way (like removing the elvis, or not using a field), and it runs just fine as expected.

brian Thu 8 Feb

Thanks for reporting that. Was tricky and took me a while to track it down, but in the end it was a compiler bug where I explicitly left myself a TODO comment. I pushed a fix.

Login or Signup to reply.