-
Notifications
You must be signed in to change notification settings - Fork 4k
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(rds): document DatabaseInstance.fromDatabaseInstanceAttributes() #11979
Conversation
6f12b66
to
243076f
Compare
fixes: ``` Member fromDatabaseInstanceAttributes should be declared before all field definitions @typescript-eslint/member-ordering ```
From the build logs, looks like the error is about breaking backwards compatibility, which is strictly true. I'm curious if it matters in this case since
I could keep the method on |
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.
Looks great @ktheory , thanks for the contribution!
Let's appease the backwards-compatibility checker by leaving the existing method 🙂.
Pull request has been modified.
Preserve backwards compatibility. Deprecate and delegate to new method.
1498e5c
to
6ff67c5
Compare
@skinny85 just wanted to say kudos for making it easy and enjoyable to contribute to CDK. In particular, I appreciate the effort y'all put in to the thorough Contributing guidelines, the helpful labels and comments on Issues, and robust CI+dev tooling. |
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.
Thanks for the contribution @ktheory !
@skinny85 just wanted to say kudos for making it easy and enjoyable to contribute to CDK.
In particular, I appreciate the effort y'all put in to the thorough Contributing guidelines, the helpful labels and comments on Issues, and robust CI+dev tooling.
Thank you for the nice words, we're glad the contribution process is not too painful 😊.
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). |
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). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…() (#12091) Reverts #11979 This commit broke java compilation of the module: ```console #STDOUT> [ERROR] COMPILATION ERROR : #STDOUT> [INFO] ------------------------------------------------------------- #STDOUT> [ERROR] /tmp/npm-packP61iji/monocdk/src/main/java/software/amazon/awscdk/services/rds/DatabaseInstance.java:[38,5] method does not override or implement a method from a supertype ``` Basically the `fromDatabaseInstanceAttributes` function now exists both in `DatabaseInstanceBase` and `DatabaseInstance`, and for some reason the one in the child is annotated with an `@Override`, despite being a static function. (see more details below). Since this module is stable, I don't want to simply move the function, but I do want to bring our pipeline back to life quickly, so this seems like an ok compromise for now. ----------------- What happens is that the generated java code for some reason adds an `@Override` annotation to the function signature of the concrete class, as if its overriding the function in the base class, even though these are static methods. ```java @javax.annotation.Generated(value = "jsii-pacmak/1.15.0 (build 585166b)", date = "2020-12-15T17:40:10.678Z") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.rds.$Module.class, fqn = "@aws-cdk/aws-rds.DatabaseInstance") public class DatabaseInstance extends software.amazon.awscdk.services.rds.DatabaseInstanceBase implements software.amazon.awscdk.services.rds.IDatabaseInstance { protected DatabaseInstance(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } protected DatabaseInstance(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { super(initializationMode); } /** * @param scope This parameter is required. * @param id This parameter is required. * @param props This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public DatabaseInstance(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.rds.DatabaseInstanceProps props) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(props, "props is required") }); } /** * Import an existing database instance. * <p> * @param scope This parameter is required. * @param id This parameter is required. * @param attrs This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @OverRide public static @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.rds.IDatabaseInstance fromDatabaseInstanceAttributes(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.rds.DatabaseInstanceAttributes attrs) { return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.services.rds.DatabaseInstance.class, "fromDatabaseInstanceAttributes", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.rds.IDatabaseInstance.class), new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(attrs, "attrs is required") }); } ``` JSII assembly also shows: ```json "name": "fromDatabaseInstanceAttributes", "overrides": "@aws-cdk/aws-rds.DatabaseInstanceBase", "parameters": [ { "name": "scope", "type": { "fqn": "constructs.Construct" } }, { "name": "id", "type": { "primitive": "string" } }, { "name": "attrs", "type": { "fqn": "@aws-cdk/aws-rds.DatabaseInstanceAttributes" } } ], "returns": { "type": { "fqn": "@aws-cdk/aws-rds.IDatabaseInstance" } }, "static": true ``` This feels like a JSII bug, it shouldn't be marking this method as an override in the assembly, and regardless, it should not generate java code that has an `@Override` annotation on a static function, better to validate and throw beforehand. I guess this is related to Typescript quirks with inheritance of static members? cc @RomainMuller @skinny85
aws#11979) Ensure `DatabaseInstance.fromDatabaseInstanceAttributes` is included in docs by moving it from the abstract `DatabaseInstanceBase` to the concrete `DatabaseInstance` class. Thx @skinny85 for the suggestion in aws#11817. Fixes aws#11817 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
…() (aws#12091) Reverts aws#11979 This commit broke java compilation of the module: ```console #STDOUT> [ERROR] COMPILATION ERROR : #STDOUT> [INFO] ------------------------------------------------------------- #STDOUT> [ERROR] /tmp/npm-packP61iji/monocdk/src/main/java/software/amazon/awscdk/services/rds/DatabaseInstance.java:[38,5] method does not override or implement a method from a supertype ``` Basically the `fromDatabaseInstanceAttributes` function now exists both in `DatabaseInstanceBase` and `DatabaseInstance`, and for some reason the one in the child is annotated with an `@Override`, despite being a static function. (see more details below). Since this module is stable, I don't want to simply move the function, but I do want to bring our pipeline back to life quickly, so this seems like an ok compromise for now. ----------------- What happens is that the generated java code for some reason adds an `@Override` annotation to the function signature of the concrete class, as if its overriding the function in the base class, even though these are static methods. ```java @javax.annotation.Generated(value = "jsii-pacmak/1.15.0 (build 585166b)", date = "2020-12-15T17:40:10.678Z") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.rds.$Module.class, fqn = "@aws-cdk/aws-rds.DatabaseInstance") public class DatabaseInstance extends software.amazon.awscdk.services.rds.DatabaseInstanceBase implements software.amazon.awscdk.services.rds.IDatabaseInstance { protected DatabaseInstance(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } protected DatabaseInstance(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { super(initializationMode); } /** * @param scope This parameter is required. * @param id This parameter is required. * @param props This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public DatabaseInstance(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.rds.DatabaseInstanceProps props) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(props, "props is required") }); } /** * Import an existing database instance. * <p> * @param scope This parameter is required. * @param id This parameter is required. * @param attrs This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @OverRide public static @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.rds.IDatabaseInstance fromDatabaseInstanceAttributes(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.rds.DatabaseInstanceAttributes attrs) { return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.services.rds.DatabaseInstance.class, "fromDatabaseInstanceAttributes", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.rds.IDatabaseInstance.class), new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(attrs, "attrs is required") }); } ``` JSII assembly also shows: ```json "name": "fromDatabaseInstanceAttributes", "overrides": "@aws-cdk/aws-rds.DatabaseInstanceBase", "parameters": [ { "name": "scope", "type": { "fqn": "constructs.Construct" } }, { "name": "id", "type": { "primitive": "string" } }, { "name": "attrs", "type": { "fqn": "@aws-cdk/aws-rds.DatabaseInstanceAttributes" } } ], "returns": { "type": { "fqn": "@aws-cdk/aws-rds.IDatabaseInstance" } }, "static": true ``` This feels like a JSII bug, it shouldn't be marking this method as an override in the assembly, and regardless, it should not generate java code that has an `@Override` annotation on a static function, better to validate and throw beforehand. I guess this is related to Typescript quirks with inheritance of static members? cc @RomainMuller @skinny85
Ensure
DatabaseInstance.fromDatabaseInstanceAttributes
is included in docs by moving it from the abstractDatabaseInstanceBase
to the concreteDatabaseInstance
class.Thx @skinny85 for the suggestion in #11817.
Fixes #11817
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license