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

chore(kms): overridden validate method must be protected #9616

Merged
merged 1 commit into from
Aug 12, 2020

Conversation

NetaNir
Copy link
Contributor

@NetaNir NetaNir commented Aug 12, 2020

This PR #9269, implemented validate() on the KMS key construct. Since this methods override Construct validate it must have the same visibility modifier - protected. Changing visibility modifier on override methods breaks jsii-pacmak, specifically C# packaging.:

amazon/CDK/AWS/KMS/Key.cs(97,34): error CS0507: 'Key.Validate()': cannot change access modifiers when overriding 'protected' inherited member 'Construct_.Validate()' [/tmp/npm-packtcwuee/Amazon.CDK.AWS.KMS/Amazon.CDK.AWS.KMS.csproj]

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

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Aug 12, 2020
@NetaNir NetaNir requested a review from a team August 12, 2020 01:33
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: bb60851
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Aug 12, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit bbf23a8 into master Aug 12, 2020
@mergify mergify bot deleted the neta/fix-validate branch August 12, 2020 01:53
RomainMuller added a commit to aws/jsii that referenced this pull request Aug 12, 2020
Since C# does not allow changing the visibility of a member when
overriding it, added a check to ensure nobody attempts to make a
protected member public when overriding it.

This is a somewhat common pitfall for users (as seen for example in
aws/aws-cdk#9616), and the check will allow faster detection and
correction (i.e: at compilation time instead of during `jsii-pacmak`).
RomainMuller added a commit to aws/jsii that referenced this pull request Aug 12, 2020
Since C# does not allow changing the visibility of a member when
overriding it, added a check to ensure nobody attempts to make a
protected member public when overriding it.

This is a somewhat common pitfall for users (as seen for example in
aws/aws-cdk#9616), and the check will allow faster detection and
correction (i.e: at compilation time instead of during `jsii-pacmak`).
@Chriscbr
Copy link
Contributor

Sorry for causing this error (and thanks for catching it)! I think at some point in my PR I was using the method as public to work around a temporary issue, and thought it was okay since I saw another public validate method, but taking a second look, now I realize it wasn't even a construct, hence why it wasn't causing an error 😅:

public validate(): string[] {

@NetaNir
Copy link
Contributor Author

NetaNir commented Aug 14, 2020

No worries, we should have caught it in build time, and now we do: aws/jsii@cfc99c2 thanks @RomainMuller <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants