Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't process function that returns boolean #8

Closed
4ntoine opened this issue Nov 4, 2017 · 5 comments
Closed

Can't process function that returns boolean #8

4ntoine opened this issue Nov 4, 2017 · 5 comments

Comments

@4ntoine
Copy link

4ntoine commented Nov 4, 2017

contract:

pragma solidity ^0.4.0;
contract SomeContract {
  ...
  mapping (string => bool) keys;
  ...
  function hasFeature(string featureKey) public constant returns (bool) {
      return keys[featureKey];
  }

while trying to generate wrapper getting the following exception:

[ERROR] Failed to execute goal org.web3j:web3j-maven-plugin:0.1.3:generate-sources (default-cli) on project ethereum: Execution default-cli of goal org.web3j:web3j-maven-plugin:0.1.3:generate-sources failed: invalid type parameter: boolean -> [Help 1]

I'm having installed solidity compiler 0.4.18 on mac and plugin found it:

[INFO] ------------------------------------------------------------------------
[INFO] Building ethereum 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- web3j-maven-plugin:0.1.3:generate-sources (default-cli) @ ethereum ---
[INFO] process 'SomeContract.sol'
[INFO] Solidity Compiler found
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.993 s
[INFO] Finished at: 2017-11-04T12:42:32+05:00
[INFO] Final Memory: 16M/306M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.web3j:web3j-maven-plugin:0.1.3:generate-sources (default-cli) on project ethereum: Execution default-cli of goal org.web3j:web3j-maven-plugin:0.1.3:generate-sources failed: invalid type parameter: boolean -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

The code can be compiled and function called in Remix. Also if i change return type to uint8 and change the function to return uint8 (1 or 0) everything is okay.

@conor10
Copy link

conor10 commented Nov 4, 2017

This is an issue with web3j - I'll push out a release with a fix shortly.

All that is requires is to change line 350 of SolidityFunctionWrapper to be:

return TypeName.get(Boolean.class);  // boolean cannot be a parameterized type

@4ntoine
Copy link
Author

4ntoine commented Nov 4, 2017

Thanks for the quick investigation, waiting for the fix..

@conor10
Copy link

conor10 commented Nov 6, 2017

New release pushed out.

@conor10 conor10 closed this as completed Nov 6, 2017
@conor10 conor10 reopened this Nov 6, 2017
@conor10
Copy link

conor10 commented Nov 6, 2017

@h2mch please can you close once the plugin has been updated to web3j 3.0.2.

@h2mch
Copy link
Contributor

h2mch commented Nov 6, 2017

update to version 3.0.2. new release 0.1.4 done

@h2mch h2mch closed this as completed Nov 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants