kingpin [
http://community.jboss.org/people/kingpin] created the discussion
"Verify Error: Inconsistent args_size for opc_invokeinterface"
To view the discussion, visit:
http://community.jboss.org/message/579700#579700
--------------------------------------------------------------
I have been trying to generate some dynamic codes (Using Javassist) but program fails at a
certain point when involving a double array or float array. The code is as follows
Class c = Customers.class; // called in main & Customer class just has a double[]
Dubs = new double[10]
CreateType(c); // Main
public static Object CreateType(Class genericType)
{
// some preReq declarations
CtMethod writeCode = dyn.getDeclaredMethod("processCode");
generateCode(genericType, Code, "temp"); // Code is a StringBuilder
class
System.out.println(Code);
writeCode.insertAt(1, Code.toString()); // Compilation is successful
Class c = dyn.toClass();
Dynamic h;
Constructor[] ctorlist = null;
ctorlist = c.getDeclaredConstructors(); // Problem is here
h = (DynamicSurrogate) ctorlist[0].newInstance(genericType);
return h;
}
Generated code is as follows
testapp1.Customers temp=(testapp1.Customers)graph;
output.processDouble(temp.Dubs[1]);
But problem arises when getDeclaredConstructors is called c.getDeclaredConstructors() ...
it throws the following error
Exception in thread "main" java.lang.VerifyError: (class: testapp1/Dyn, method:
processDouble signature: (Lsomething/Output;Ljava/lang/Object;)V) Inconsistent args_size
for opc_invokeinterface
A workaround exists but does not make any sense, i.e. everything works fine if i simply
create a copy of the double array and pass it on to processDouble in dynamic codei.e. if
the dynamic code is
testapp1.Customers temp=(testapp1.Customers)graph;
double[] d = temp.Dubs;
output.processDouble(d);
n short , exception Unhandled is thrown by getDeclaredConstructor but it actually has
nothing to do with a constructor because it doesnt matter if i create one or not
Hopefully my problem and code is clear enough, if any confusion please do tell, Thankyou
in advance :)
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/579700#579700]
Start a new discussion in Javassist at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]