-
Notifications
You must be signed in to change notification settings - Fork 245
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
Conversation
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.
@@ -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#). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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]
There was a problem hiding this comment.
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.
### 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)
### 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)
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.