Skip to content

调用合约lambda表达式写法报错 #88

Open
@glowwormX

Description

@glowwormX

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions