Interpreting the "Incompatible argument to function" exception message

Zoomzoom picture Zoomzoom · Jun 14, 2012 · Viewed 12.4k times · Source

A quick question regarding the java.lang.VerifyError exception. Suppose I get an error that looks like this:

Java call terminated by uncaught Java exception: java.lang.VerifyError:(class: com/.../MyClassName, method: <init> signature: (Ljava/io/Reader;)V) Incompatible argument to function

Could you help me with understanding what the "init" and what the "(Ljava/io/Reader;)V)" parts pertain to? They don't look like method names or signatures to me, but I'm not too familiar with java. Thanks!

Answer

templatetypedef picture templatetypedef · Jun 14, 2012

This error means that somewhere in your code, you tried to call a constructor (the <init> method) passing in the wrong set of arguments. The expected argument was a Reader object.

This probably meant that you previously compiled a class file, then changed the class definition in some way without recompiling the class file. Consequently, your code tries to call a function that no longer exists. Try recompiling the code and see if that fixes it.

Hope this helps!