Skip to content

jsii: interfaces incorrectly marked as datatypes #264

Closed

Description

@rix0rrr

In the following case, the

interface IBaseInterface {
  readonly value: string;
  doSomething(): void;
}

interface IDerivedInterface extends IBaseInterface {
  readonly otherValue: string;
}

The interface IDerivedInterface is incorrectly marked as {datatype: true}, because the interface consists only of properties. Correct behavior would have been to take the parent interfaces into account as well while making this assessment.

This leads the Java code generator to emit a Builder that contains duplicate fields (and setters) and ignoring the methods in the upstream classes (encountered while making an IRole interface):

@aws-cdk/aws-iam: [ERROR] /tmp/jsii-pacmak-codeUbHgJB/src/main/java/software/amazon/awscdk/services/iam/IRole.java:[26,69] variable _principal is already defined in class software.amazon.awscdk.services.iam.IRole.Builder
@aws-cdk/aws-iam: [ERROR] /tmp/jsii-pacmak-codeUbHgJB/src/main/java/software/amazon/awscdk/services/iam/IRole.java:[52,24] method withPrincipal(software.amazon.awscdk.services.iam.PolicyPrincipal) is already defined in class software.amazon.awscdk.services.iam.IRole.Builder
@aws-cdk/aws-iam: [ERROR] /tmp/jsii-pacmak-codeUbHgJB/src/main/java/software/amazon/awscdk/services/iam/IRole.java:[76,83] variable $principal is already defined in class <anonymous software.amazon.awscdk.services.iam.IRole$Builder$1>
@aws-cdk/aws-iam: [ERROR] /tmp/jsii-pacmak-codeUbHgJB/src/main/java/software/amazon/awscdk/services/iam/IRole.java:[90,76] method getPrincipal() is already defined in class <anonymous software.amazon.awscdk.services.iam.IRole$Builder$1>
@aws-cdk/aws-iam: [ERROR] /tmp/jsii-pacmak-codeUbHgJB/src/main/java/software/amazon/awscdk/services/iam/IRole.java:[73,32] <anonymous software.amazon.awscdk.services.iam.IRole$Builder$1> is not abstract and does not override abstract method attachManagedPolicy(java.lang.String) in software.amazon.awscdk.services.iam.IPrincipal

Activity

  1. eladb commented on Oct 16, 2018

    @eladb
    Contributor

    Makes sense!

  2. added a commit that references this issue on Oct 16, 2018
    fc2e81e
  3. added 3 commits that reference this issue on Oct 16, 2018
    1c56902
    3e0d625
    100f5ad
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions