I need to create a method using JavaAssist CtMethod. This method need to accept a String and an array of objects as input parameters as below
String methodBody = "$1.look(\"" + (lname).replace("\"", "").trim() + "\"" + " ," + new Object[] { lp.get(0) }+ ")";
where lp
is List
but when i create the method I get exception:
javassist.CannotCompileException: [source error] syntax error near "String" ,[Ljava.lang"
Any idea why this exception is thrown from javaassist?
I actually want to pass the entire lp
object as parameter into the method, but in the above code,I was trying to see if JavaAssist will accept if I pass just one entry in the list like
new Object[] { lp.get(0) }
Any idea why this exception is thrown from javaassist?