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

fix(jsii): detect double interface member declarations #360

Merged
merged 1 commit into from
Feb 14, 2019

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Feb 13, 2019

In C# it's prohibited to declare an interface member
that also exists in an inherited interface. Have jsii
detect this illegal pattern.

Strictly speaking, this only true if we don't overload,
but since we don't support overloading anyway we just
check on the member names, not the types.

Fixes #340.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

In C# it's prohibited to declare an interface member
that also exists in an inherited interface. Have jsii
detect this illegal pattern.

Strictly speaking, this only true if we don't overload,
but since we don't support overloading anyway we just
check on the member names, not the types.

Fixes #340.
@rix0rrr rix0rrr requested a review from a team as a code owner February 13, 2019 18:52
@@ -624,6 +624,27 @@ export class Assembler implements Emitter {
}
});

// Check that no interface declares a member that's already declared
// in a base type (not allowed in C#).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this is the error I get:

@aws-cdk/aws-iam: IRoleProxy.cs(113,21): error CS0111: Type 'IRoleProxy' already defines a member called 'AddToPolicy' with the same parameter types [/tmp/jsii-pacmak-codec20iQw/Amazon.CDK.AWS.IAM/Amazon.CDK.AWS.IAM.csproj]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I guess 'new' will do it. I don't get the point of it though, and our C# generator doesn't do the necessary analysis to add the modifier, so I think disallowing in jsii is the easiest way forward.

@rix0rrr rix0rrr merged commit b2b2c89 into master Feb 14, 2019
@rix0rrr rix0rrr deleted the huijbers/no-double-interface-members branch February 14, 2019 08:10
RomainMuller added a commit that referenced this pull request Feb 27, 2019
### Bug Fixes

* **jsii-pacmack:** default to target directory mode ([#363](#363)) ([967d917](967d917))
* **java-runtime:** Bump version of Jackson because of CVEs ([#362](#362)) ([140aa4d](140aa4d))
* **jsii:** detect double interface member declarations ([#360](#360)) ([b2b2c89](b2b2c89)), closes [#340](#340)
RomainMuller added a commit that referenced this pull request Feb 27, 2019
### Bug Fixes

* **jsii-pacmack:** default to target directory mode ([#363](#363)) ([967d917](967d917))
* **java-runtime:** Bump version of Jackson because of CVEs ([#362](#362)) ([140aa4d](140aa4d))
* **jsii:** detect double interface member declarations ([#360](#360)) ([b2b2c89](b2b2c89)), closes [#340](#340)
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

Successfully merging this pull request may close these issues.

3 participants