Skip to content

Correctly handle multiple interface inheritance #255

Closed

Description

@skinny85

When faced with an interface inheritance hierarchy like this:

interface CommonActionProps {
  runOrder: number;
  // ...
}

interface CommonActionConstructProps extends CommonActionProps {
  // ...
}

interface CommonPipelineSourceActionProps extends CommonActionProps {
  // ...
}

interface PipelineSourceActionProps extends CommonPipelineSourceActionProps,
    CommonActionConstructProps {
  // ...
}

which is valid TypeScript, JSII barfs when generating PipelineSourceActionProps with:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /tmp/jsii-pacmak-code9apQBY/src/main/java/software/amazon/awscdk/services/s3/PipelineSourceActionProps.java:[37,34] variable _runOrder is already defined in class software.amazon.awscdk.services.s3.PipelineSourceActionProps.Builder
[ERROR] /tmp/jsii-pacmak-code9apQBY/src/main/java/software/amazon/awscdk/services/s3/PipelineSourceActionProps.java:[101,24] method withRunOrder(java.lang.Number) is already defined in class software.amazon.awscdk.services.s3.PipelineSourceActionProps.Builder
[ERROR] /tmp/jsii-pacmak-code9apQBY/src/main/java/software/amazon/awscdk/services/s3/PipelineSourceActionProps.java:[122,42] variable $runOrder is already defined in class <anonymous software.amazon.awscdk.services.s3.PipelineSourceActionProps$Builder$1>
[ERROR] /tmp/jsii-pacmak-code9apQBY/src/main/java/software/amazon/awscdk/services/s3/PipelineSourceActionProps.java:[185,41] method getRunOrder() is already defined in class <anonymous software.amazon.awscdk.services.s3.PipelineSourceActionProps$Builder$1>
[ERROR] /tmp/jsii-pacmak-code9apQBY/src/main/java/software/amazon/awscdk/services/s3/PipelineSourceActionProps.java:[190,29] method setRunOrder(java.lang.Number) is already defined in class <anonymous software.amazon.awscdk.services.s3.PipelineSourceActionProps$Builder$1>
[INFO] 5 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.309 s
[INFO] Finished at: 2018-09-25T23:21:40+00:00
[INFO] Final Memory: 17M/291M
[INFO] ------------------------------------------------------------------------

It obviously tries to include the fields from the CommonActionProps interface twice, because it appears twice in the inheritance hierarchy for PipelineSourceActionProps.

The generators should detect when this happens, and only include the interface in the hierarchy once.

Found in #776.

Activity

  1. added
    bug
    on Nov 18, 2019
  2. added
    still-relevant?
    on Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugstill-relevant?

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions