Skip to content

Conflict for Events with same name for generated abi #1781

Open
@ShawnWu0x

Description

@ShawnWu0x

Bug_title

In Solidity, the events may have same names, but with different parameters.
Such as Compound's controller contract

There are 2 ActionPaused events with different parameters.

/// @notice Emitted when an action is paused globally
    event ActionPaused(string action, bool pauseState);

    /// @notice Emitted when an action is paused on a market
    event ActionPaused(CToken cToken, string action, bool pauseState);

If we generate the Java file with web3jgen for it, there will be 2 global parameters with name ACTIONPAUSED_EVENT in the generated JAVA file.
This is not allowed in Java.

public static final Event ACTIONPAUSED_EVENT = new Event("ActionPaused", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}, new TypeReference<Bool>() {}));
    ;

    public static final Event ACTIONPAUSED_EVENT = new Event("ActionPaused", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Bool>() {}));
    ;

Steps To Reproduce

  1. Open Compound's etherscan link controller contract
  2. Copy abi and bin codes to 2 files.
  3. Run web3j generate solidity -a abc.abi -b abc.bin -o ./ -p abi
  • -a is abi file
  • -b is bin file
  • -o is the directory where generate the file
  • -p is the package of java file

Expected behavior

The generated java file should has no ERROR.

Actual behavior

The generated java file built failed with ERROR.

Environment

  • Web3j core 4.8.7
  • Java 1.8
  • MacOS

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA bug in behaviour or functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions