diff --git a/build.gradle b/build.gradle index aa4e777..d17bb46 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ ext { junitVersion = '4.13.2' commonsLang3Version = '3.14.0' - javaSDKVersion3 = "3.7.0" + javaSDKVersion3 = "3.8.0" javaSDKVersion2 = "2.10.0" slf4jVersion = "1.7.36" } @@ -54,7 +54,7 @@ configurations.all { // integrationTest.mustRunAfter test allprojects { group = 'org.fisco-bcos.code-generator' - version = '1.6.0-SNAPSHOT' + version = '1.6.0' apply plugin: 'maven-publish' apply plugin: 'idea' apply plugin: 'eclipse' diff --git a/src/main/java/org/fisco/bcos/codegen/v3/wrapper/ContractWrapper.java b/src/main/java/org/fisco/bcos/codegen/v3/wrapper/ContractWrapper.java index 8a31ecb..5ef70f8 100644 --- a/src/main/java/org/fisco/bcos/codegen/v3/wrapper/ContractWrapper.java +++ b/src/main/java/org/fisco/bcos/codegen/v3/wrapper/ContractWrapper.java @@ -2124,6 +2124,7 @@ private CodeBlock buildTypedResponse( } else { builder.addStatement("$L.log = eventValues.getLog()", objectName); } + // indexed for (int i = 0; i < indexedParameters.size(); i++) { final NamedTypeName namedTypeName = indexedParameters.get(i); String nativeConversion; @@ -2153,6 +2154,7 @@ private CodeBlock buildTypedResponse( i); } + // non-indexed for (int i = 0; i < nonIndexedParameters.size(); i++) { final NamedTypeName namedTypeName = nonIndexedParameters.get(i); String result = "$L.$L = ($T) eventValues.getNonIndexedValues().get($L)"; diff --git a/src/test/java/org/fisco/bcos/codegen/v3/test/CodeGenV3Test.java b/src/test/java/org/fisco/bcos/codegen/v3/test/CodeGenV3Test.java index 07ebaea..e39736c 100644 --- a/src/test/java/org/fisco/bcos/codegen/v3/test/CodeGenV3Test.java +++ b/src/test/java/org/fisco/bcos/codegen/v3/test/CodeGenV3Test.java @@ -173,6 +173,13 @@ public void RechargeTestCodeGen() throws IOException { codeGenTest(ABI_FILE, CONTRACT_NAME); } + @Test + public void ListEventTestCodeGen() throws IOException { + final String ABI_FILE = "ListEventTest.abi"; + final String CONTRACT_NAME = "ListEventTest"; + codeGenTest(ABI_FILE, CONTRACT_NAME); + } + @Test public void docTestCodeGen() throws IOException { final String CONTRACT_NAME = "ERC721"; diff --git a/src/test/resources/ListEventTest.abi b/src/test/resources/ListEventTest.abi new file mode 100644 index 0000000..9ee3f29 --- /dev/null +++ b/src/test/resources/ListEventTest.abi @@ -0,0 +1 @@ +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"int256[]","name":"","type":"int256[]"},{"indexed":false,"internalType":"string[]","name":"","type":"string[]"},{"indexed":false,"internalType":"uint256[]","name":"","type":"uint256[]"}],"name":"listEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"numbers","type":"event"},{"inputs":[],"name":"get","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mockFunctionOutOfGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"n","type":"string"}],"name":"set","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"n","type":"string"}],"name":"testEvent","outputs":[],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file