Interpretation of the "Incompatible argument to function" exception message

A quick question regarding the java.lang.VerifyError exception. Suppose I got 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 understand what "init" is and what parts of "(Ljava / io / Reader;) V)"? They don't look like method names or signatures for me, but I'm not too familiar with java. Thanks!

+8
java exception verifyerror
source share
3 answers

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

This probably meant that you precompiled the class file and then somehow changed the class definition without recompiling the class file. Therefore, your code is trying to call a function that no longer exists. Try recompiling the code and see if it fixes it.

Hope this helps!

+7
source share

If you run the application on the application server, this may be a problem loading classes.

You compiled your code against the library, and when you try to run your code, it works with a different (older?) Version of the library.

An older library probably does not have this method or constructor.

+3
source share

Just to leave a mark for another reason.

Always on the application server (in my case, WildFly 10) you can load the same library in modules and in the EAR lib. If this library contains an interface that must be implemented by the module, this can cause a conflict, since the same class / interface loaded by two different class loaders is considered as two different types.

0
source share

All Articles