Open
Description
demo每次调用合约需要新写一个类,尝试lambda表达式写法,org.apache.bcel.util
报找不到类错误
//调用 注册
//Transaction transaction1 = new Transaction.HVMBuilder(account.getAddress()).invoke(contractAddress, new InvokeStudentReg()).build();
//使用lambda表达式,避免新写一个类
BaseInvoke<String, IStudent> register = iStudent ->
iStudent.registerStudent(Arrays.asList(new Student("id1", "name1", 20), new Student("id2", "name2", 20)));
Transaction transaction1 = new Transaction.HVMBuilder(account.getAddress()).invoke(contractAddress, register).build();
transaction1.sign(account);
ReceiptResponse receiptResponse1 = contractService.invoke(transaction1).send().polling();
String decodeHVM1 = Decoder.decodeHVM(receiptResponse1.getRet(), String.class);
System.out.println("decode: " + decodeHVM1);
System.out.println(receiptResponse1.getRet());
报错:
java.lang.RuntimeException: java.lang.ClassNotFoundException: TestStudent$$Lambda$9/18179709 not found.
at cn.hyperchain.sdk.common.utils.Encoder.encodeInvokeBeanJava(Encoder.java:97)
at cn.hyperchain.sdk.transaction.Transaction$HVMBuilder.invoke(Transaction.java:173)
at TestStudent.invoke(TestStudent.java:62)
Metadata
Assignees
Labels
No labels