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

feat(kernel): annotate implemented interfaces on "ObjRef"s #825

Merged
merged 26 commits into from
Oct 29, 2019

Conversation

RomainMuller
Copy link
Contributor

@RomainMuller RomainMuller commented Sep 26, 2019

Annotating the interfaces implemented by an object instance with the
outbound Object Reference, and allowing the kernel's "create" call to
receive a list of interfaces allows the kernel to use more run-time type
information and operate safer.

All object references sent from JS to other languages are now annotated
with the relevant list of interfaces, and runtimes can dynamically convert
instances to the needed type (based on the static type that is needed at
the transfer point between the runtime library and user code).

In addition, a bug was fixed that prevented the Java runtime from
successfully receiving a reference that was typed Object, which is the
case for anonymous objects returned from methods returning any.

Fixes #818


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

Annotating the interfaces implemented by an object instance with the
outbound Object Reference, and allowing the kernel's "create" call to
receive a list of interfaces allows the kernel to use more run-time type
information and operate safer.
@RomainMuller RomainMuller added effort/large Large work item – several weeks of effort module/kernel Issues affecting the `jsii-kernel` module labels Sep 26, 2019
@RomainMuller RomainMuller self-assigned this Sep 26, 2019
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

Copy link
Contributor

@rix0rrr rix0rrr left a comment

Choose a reason for hiding this comment

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

I get confused about what exactly we're fixing again :).

Do we not require annotating classes/interfaces from the jsii-side as well?

fqn: string;
/**
* The FQNs of interfaces the instance implements, if any. Declaring
Copy link
Contributor

Choose a reason for hiding this comment

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

Declaring interfaces that the class denoted by fqn implements is not necessary.

Maybe describe these as "additional" interfaces then? In addition to the interfaces implemented by the class.

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 that's how I have started to name them. I'll have to go on the comments & make sure it's homogeneously used.

packages/jsii-kernel/lib/kernel.ts Show resolved Hide resolved
packages/jsii-kernel/lib/objects.ts Outdated Show resolved Hide resolved
@RomainMuller
Copy link
Contributor Author

@rix0rrr - annotating from the active side is needed as well. This is still a draft PR as I'm working through the front-ends now... I wanted to have it out there at least so I don't lose anything if my hard disk crashes 😅

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@RomainMuller RomainMuller marked this pull request as ready for review October 15, 2019 14:00
@RomainMuller RomainMuller requested review from bmaizels, garnaat and a team as code owners October 15, 2019 14:00
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@RomainMuller RomainMuller requested a review from costleya October 16, 2019 08:24
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

Copy link
Contributor

@bmaizels bmaizels left a comment

Choose a reason for hiding this comment

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

The target java changes are pretty benign and not worth commenting on as it's only annotation and some minor constructor implementation changes mainly.

Wrt/ the JsiiEngine changes I didn't see any unit tests for the changed/new functionality. Is there coverage for that code already, if so I'm surprised we didn't even break any existing unit tests.

@RomainMuller
Copy link
Contributor Author

@bmaizels - yup, the code was already mostly covered, and the tests that broke were un-broken by the updated runtime code. I'll still have a second pass over that to make sure the particular edge case this aims to solve is... indeed covered.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@RomainMuller
Copy link
Contributor Author

There was indeed a bug hiding in there (both in Java & .NET) due to insufficient test coverage of the feature. This is now fixed (including test)

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@RomainMuller RomainMuller removed the pr/do-not-merge This PR should not be merged at this time. label Oct 29, 2019
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • 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 Oct 29, 2019

Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it!

@mergify mergify bot added the pr/ready-to-merge This PR is ready to be merged. label Oct 29, 2019
@mergify mergify bot merged commit a4e2095 into master Oct 29, 2019
@mergify mergify bot deleted the rmuller/fix-object-bug branch October 29, 2019 17:26
@mergify mergify bot removed the pr/ready-to-merge This PR is ready to be merged. label Oct 29, 2019
RomainMuller added a commit that referenced this pull request Nov 5, 2019
The change of behavior in `any` serialization introduced in #825 risks
breaking some emerging use-cases of the AWS CDK that are likely to be
prevalent in the installed user base. As a consequence, surgically
reverting this particular change in order to restore the behavior that
users might be dependent on.

This somehow uncovered an outstanding bug in the Python runtime that
was not triggering with the "reverted" behavior (it broke unit tests).
The runtime was fixed in order to address this bug.
RomainMuller added a commit that referenced this pull request Nov 5, 2019
The change of behavior in `any` serialization introduced in #825 risks
breaking some emerging use-cases of the AWS CDK that are likely to be
prevalent in the installed user base. As a consequence, surgically
reverting this particular change in order to restore the behavior that
users might be dependent on.

This somehow uncovered an outstanding bug in the Python runtime that
was not triggering with the "reverted" behavior (it broke unit tests).
The runtime was fixed in order to address this bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/large Large work item – several weeks of effort module/kernel Issues affecting the `jsii-kernel` module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow "create" to specify additional interfaces
5 participants