I am trying to generate some dynamic codes (using a Javassist), but the program will work at a certain point when using an array with a double array or a floating point. The code is as follows
Class c = Customers.class;
CreateType(c);
public static Object CreateType(Class genericType)
{
CtMethod writeCode = dyn.getDeclaredMethod("processCode");
generateCode(genericType, Code, "temp");
System.out.println(Code);
writeCode.insertAt(1, Code.toString());
Class c = dyn.toClass();
Dynamic h;
Constructor[] ctorlist = null;
ctorlist = c.getDeclaredConstructors();
h = (DynamicSurrogate) ctorlist[0].newInstance(genericType);
return h;
}
The generated code is as follows
testapp1.Customers temp=(testapp1.Customers)graph;
output.processDouble(temp.Dubs[1]);
But the problem occurs when getDeclaredConstructors is called c.getDeclaredConstructors () ... it throws the following error
An exception in the "main" thread java.lang.VerifyError: (class: testapp1 / Dyn, method: processDouble signature: (Lsomething / Output; Ljava / lang / Object;) V) Inconsistent args_size for opc_invokeinterface
, , , processDouble
,
testapp1.Customers temp=(testapp1.Customers)graph;
double[] d = temp.Dubs;
output.processDouble(d);
, Unhandled getDeclaredConstructor, , ,
, , - , , , , :)