From efae4474f68e48cec9e18796f347a725b89cdf00 Mon Sep 17 00:00:00 2001 From: Romain Marcadier-Muller Date: Wed, 5 Jun 2019 16:16:47 +0200 Subject: [PATCH] feat: Register module-level stability (#515) Adds the necessary code to detect and forward module-level stability indications to the assembly, so it can be used by downstream languages. This effectively removes the `markdown` attribute from the `Assembly` in favor of using the `docs` attribute. Also, renders a `package-info.json` file for packages that have documentation (a `README.md` file, deprecation notice, or stability indication). Implements awslabs/cdk-ops#367 --- packages/jsii-calc-lib/package.json | 4 +- packages/jsii-calc-lib/test/assembly.jsii | 6 +- packages/jsii-calc/lib/compliance.ts | 1 - packages/jsii-calc/lib/index.ts | 1 + packages/jsii-calc/lib/stability.ts | 104 ++++ packages/jsii-calc/package.json | 1 + packages/jsii-calc/test/assembly.jsii | 564 +++++++++++++++++- .../AssemblyExtensions.cs | 12 +- .../Class/ClassGenerator.cs | 55 +- .../DocComment/DocCommentGeneratorBase.cs | 1 - .../DocComment/MethodDocCommentGenerator.cs | 4 +- .../Enum/EnumGenerator.cs | 55 +- .../Interface/InterfaceGenerator.cs | 25 +- .../MethodGeneratorBase.cs | 20 +- .../PropertyGeneratorBase.cs | 20 +- .../TypeProxyGeneratorBase.cs | 21 +- .../Amazon.JSII.JsonModel/Spec/Stability.cs | 3 +- .../java/software/amazon/jsii/Stability.java | 45 ++ packages/jsii-pacmak/lib/markdown.ts | 8 +- packages/jsii-pacmak/lib/targets/java.ts | 75 ++- packages/jsii-pacmak/lib/targets/python.ts | 6 +- .../test/expected.jsii-calc-base/java/pom.xml | 3 + .../.jsii | 6 +- ...ts.CalculatorPackageId.LibPackageId.csproj | 2 +- .../LibNamespace/Number.cs | 2 + .../test/expected.jsii-calc-lib/java/pom.xml | 3 + .../tests/calculator/lib/package-info.java | 7 + .../.jsii | 564 +++++++++++++++++- ...azon.JSII.Tests.CalculatorPackageId.csproj | 2 +- .../JSII/Tests/CalculatorNamespace/Add.cs | 3 + .../CalculatorNamespace/BinaryOperation.cs | 3 + .../Tests/CalculatorNamespace/Calculator.cs | 2 + .../CalculatorNamespace/ClassWithDocs.cs | 1 - .../CalculatorNamespace/DeprecatedClass.cs | 51 ++ .../CalculatorNamespace/DeprecatedEnum.cs | 19 + .../CalculatorNamespace/DeprecatedStruct.cs | 18 + .../DeprecatedStructProxy.cs | 22 + .../CalculatorNamespace/ExperimentalClass.cs | 44 ++ .../CalculatorNamespace/ExperimentalEnum.cs | 16 + .../CalculatorNamespace/ExperimentalStruct.cs | 17 + .../ExperimentalStructProxy.cs | 20 + .../IDeprecatedInterfaceProxy.cs | 31 + .../CalculatorNamespace/IDeprecatedStruct.cs | 18 + .../IExperimentalInterfaceProxy.cs | 28 + .../IExperimentalStruct.cs | 16 + .../IIDeprecatedInterface.cs | 24 + .../IIExperimentalInterface.cs | 21 + .../CalculatorNamespace/IIStableInterface.cs | 21 + .../IStableInterfaceProxy.cs | 28 + .../CalculatorNamespace/IStableStruct.cs | 16 + .../Tests/CalculatorNamespace/Multiply.cs | 3 + .../JSII/Tests/CalculatorNamespace/Old.cs | 3 +- .../JSII/Tests/CalculatorNamespace/Power.cs | 3 + .../Tests/CalculatorNamespace/StableClass.cs | 44 ++ .../Tests/CalculatorNamespace/StableEnum.cs | 16 + .../Tests/CalculatorNamespace/StableStruct.cs | 17 + .../CalculatorNamespace/StableStructProxy.cs | 20 + .../CalculatorNamespace/VariadicMethod.cs | 1 + .../test/expected.jsii-calc/java/pom.xml | 3 + .../amazon/jsii/tests/calculator/$Module.java | 12 + .../jsii/tests/calculator/ClassWithDocs.java | 2 +- .../tests/calculator/DeprecatedClass.java | 69 +++ .../jsii/tests/calculator/DeprecatedEnum.java | 23 + .../tests/calculator/DeprecatedStruct.java | 92 +++ .../tests/calculator/DocumentedClass.java | 2 + .../tests/calculator/ExperimentalClass.java | 62 ++ .../tests/calculator/ExperimentalEnum.java | 20 + .../tests/calculator/ExperimentalStruct.java | 84 +++ .../calculator/IDeprecatedInterface.java | 66 ++ .../calculator/IExperimentalInterface.java | 60 ++ .../tests/calculator/IStableInterface.java | 53 ++ .../amazon/jsii/tests/calculator/Old.java | 2 + .../jsii/tests/calculator/StableClass.java | 55 ++ .../jsii/tests/calculator/StableEnum.java | 17 + .../jsii/tests/calculator/StableStruct.java | 81 +++ .../jsii/tests/calculator/package-info.java | 12 + .../python/src/jsii_calc/__init__.py | 469 ++++++++++++++- .../expected.jsii-calc/sphinx/jsii-calc.rst | 453 ++++++++++++++ .../jsii-reflect/test/classes.expected.txt | 3 + .../test/jsii-tree.test.all.expected.txt | 96 +++ .../jsii-tree.test.inheritance.expected.txt | 12 + .../test/jsii-tree.test.members.expected.txt | 48 ++ .../test/jsii-tree.test.types.expected.txt | 12 + packages/jsii-spec/lib/spec.ts | 32 +- packages/jsii/lib/assembler.ts | 17 +- packages/jsii/lib/docs.ts | 13 +- packages/jsii/lib/project-info.ts | 19 + 87 files changed, 3946 insertions(+), 89 deletions(-) create mode 100644 packages/jsii-calc/lib/stability.ts create mode 100644 packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Stability.java create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/package-info.java create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedClass.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedEnum.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedStruct.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedStructProxy.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalClass.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalEnum.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalStruct.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalStructProxy.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IDeprecatedInterfaceProxy.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IDeprecatedStruct.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IExperimentalInterfaceProxy.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IExperimentalStruct.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIDeprecatedInterface.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIExperimentalInterface.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIStableInterface.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IStableInterfaceProxy.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IStableStruct.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableClass.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableEnum.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableStruct.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableStructProxy.cs create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DeprecatedClass.java create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DeprecatedEnum.java create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DeprecatedStruct.java create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ExperimentalClass.java create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ExperimentalEnum.java create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ExperimentalStruct.java create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IDeprecatedInterface.java create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IExperimentalInterface.java create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IStableInterface.java create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StableClass.java create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StableEnum.java create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StableStruct.java create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/package-info.java diff --git a/packages/jsii-calc-lib/package.json b/packages/jsii-calc-lib/package.json index 7123f9bc9d..a4079c9736 100644 --- a/packages/jsii-calc-lib/package.json +++ b/packages/jsii-calc-lib/package.json @@ -2,6 +2,8 @@ "name": "@scope/jsii-calc-lib", "version": "0.11.0", "description": "A simple calcuator library built on JSII.", + "stability": "deprecated", + "deprecated": "Really just deprecated for shows...", "main": "lib/index.js", "types": "lib/index.d.ts", "private": true, @@ -51,4 +53,4 @@ "type": "git", "url": "https://github.com/awslabs/jsii.git" } -} \ No newline at end of file +} diff --git a/packages/jsii-calc-lib/test/assembly.jsii b/packages/jsii-calc-lib/test/assembly.jsii index 1616631195..0b3cc71378 100644 --- a/packages/jsii-calc-lib/test/assembly.jsii +++ b/packages/jsii-calc-lib/test/assembly.jsii @@ -84,6 +84,10 @@ } }, "description": "A simple calcuator library built on JSII.", + "docs": { + "deprecated": "Really just deprecated for shows...", + "stability": "deprecated" + }, "homepage": "https://github.com/awslabs/jsii.git", "jsiiVersion": "0.11.0", "license": "Apache-2.0", @@ -496,5 +500,5 @@ } }, "version": "0.11.0", - "fingerprint": "EtAUzTnV+hmz9yrXilnsS0MhQuQ/qmpmbwxvdLu561k=" + "fingerprint": "x/BbPdAJTYB6QY83ucqo0CNLa2NoLebqPMbMY7BsyR4=" } diff --git a/packages/jsii-calc/lib/compliance.ts b/packages/jsii-calc/lib/compliance.ts index b10e3f16cd..7442a7b274 100644 --- a/packages/jsii-calc/lib/compliance.ts +++ b/packages/jsii-calc/lib/compliance.ts @@ -1631,7 +1631,6 @@ export interface OptionalStruct { * * @see https://aws.amazon.com/ * @customAttribute hasAValue - * @deprecated Use something else please * @stable */ export class ClassWithDocs { diff --git a/packages/jsii-calc/lib/index.ts b/packages/jsii-calc/lib/index.ts index ff61744495..0b507f6734 100644 --- a/packages/jsii-calc/lib/index.ts +++ b/packages/jsii-calc/lib/index.ts @@ -2,3 +2,4 @@ export * from './calculator'; export * from './compliance'; export * from './documented'; export * from './erasures'; +export * from './stability'; diff --git a/packages/jsii-calc/lib/stability.ts b/packages/jsii-calc/lib/stability.ts new file mode 100644 index 0000000000..7fb132b0df --- /dev/null +++ b/packages/jsii-calc/lib/stability.ts @@ -0,0 +1,104 @@ +// The following tests validate emission of stability markers + +/** @experimental */ +export interface ExperimentalStruct { + /** @experimental */ + readonly readonlyProperty: string; +} +/** @experimental */ +export interface IExperimentalInterface { + /** @experimental */ + mutableProperty?: number; + /** @experimental */ + method(): void; +} +/** @experimental */ +export class ExperimentalClass { + /** @experimental */ + public readonly readonlyProperty: string; + /** @experimental */ + public mutableProperty?: number; + /** @experimental */ + constructor(readonlyString: string, mutableNumber?: number) { + this.readonlyProperty = readonlyString; + this.mutableProperty = mutableNumber; + } + + /** @experimental */ + public method(): void { return; } +} +/** @experimental */ +export enum ExperimentalEnum { + /** @experimental */ + OptionA, + /** @experimental */ + OptionB +} + +/** @stable */ +export interface StableStruct { + /** @stable */ + readonly readonlyProperty: string; +} +/** @stable */ +export interface IStableInterface { + /** @stable */ + mutableProperty?: number; + /** @stable */ + method(): void; +} +/** @stable */ +export class StableClass { + /** @stable */ + public readonly readonlyProperty: string = 'wazoo'; + /** @stable */ + public mutableProperty?: number; + /** @stable */ + constructor(readonlyString: string, mutableNumber?: number) { + this.readonlyProperty = readonlyString; + this.mutableProperty = mutableNumber; + } + /** @stable */ + public method(): void { return; } +} +/** @stable */ +export enum StableEnum { + /** @stable */ + OptionA, + /** @stable */ + OptionB +} + +/** @deprecated it just wraps a string */ +export interface DeprecatedStruct { + /** @deprecated well, yeah */ + readonly readonlyProperty: string; +} +/** @deprecated useless interface */ +export interface IDeprecatedInterface { + /** @deprecated could be better */ + mutableProperty?: number; + /** @deprecated services no purpose */ + method(): void; +} +/** @deprecated a pretty boring class */ +export class DeprecatedClass { + /** @deprecated this is not always "wazoo", be ready to be disappointed */ + public readonly readonlyProperty: string; + /** @deprecated shouldn't have been mutable */ + public mutableProperty?: number; + /** @deprecated this constructor is "just" okay */ + constructor(readonlyString: string, mutableNumber?: number) { + this.readonlyProperty = readonlyString; + this.mutableProperty = mutableNumber; + } + /** @deprecated it was a bad idea */ + public method(): void { return; } +} +/** @deprecated your deprecated selection of bad options */ +export enum DeprecatedEnum { + /** @deprecated option A is not great */ + OptionA, + /** @deprecated option B is kinda bad, too */ + OptionB +} diff --git a/packages/jsii-calc/package.json b/packages/jsii-calc/package.json index 7198cb954b..365d7cdd02 100644 --- a/packages/jsii-calc/package.json +++ b/packages/jsii-calc/package.json @@ -5,6 +5,7 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "private": true, + "stability": "experimental", "jsii": { "outdir": "dist", "targets": { diff --git a/packages/jsii-calc/test/assembly.jsii b/packages/jsii-calc/test/assembly.jsii index 7d7acac404..d89f670cd7 100644 --- a/packages/jsii-calc/test/assembly.jsii +++ b/packages/jsii-calc/test/assembly.jsii @@ -182,6 +182,9 @@ } }, "description": "A simple calcuator built on JSII.", + "docs": { + "stability": "experimental" + }, "homepage": "https://github.com/awslabs/jsii.git", "jsiiVersion": "0.11.0", "license": "Apache-2.0", @@ -1515,7 +1518,6 @@ "custom": { "customAttribute": "hasAValue" }, - "deprecated": "Use something else please", "example": "function anExample() {\n}", "remarks": "The docs are great. They're a bunch of tags.", "see": "https://aws.amazon.com/", @@ -1527,7 +1529,7 @@ "kind": "class", "locationInModule": { "filename": "lib/compliance.ts", - "line": 1637 + "line": 1636 }, "name": "ClassWithDocs" }, @@ -1887,6 +1889,149 @@ } ] }, + "jsii-calc.DeprecatedClass": { + "assembly": "jsii-calc", + "docs": { + "deprecated": "a pretty boring class", + "stability": "deprecated" + }, + "fqn": "jsii-calc.DeprecatedClass", + "initializer": { + "docs": { + "deprecated": "this constructor is \"just\" okay", + "stability": "deprecated" + }, + "parameters": [ + { + "name": "readonlyString", + "type": { + "primitive": "string" + } + }, + { + "name": "mutableNumber", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, + "kind": "class", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 85 + }, + "methods": [ + { + "docs": { + "deprecated": "it was a bad idea", + "stability": "deprecated" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 96 + }, + "name": "method" + } + ], + "name": "DeprecatedClass", + "properties": [ + { + "docs": { + "deprecated": "this is not always \"wazoo\", be ready to be disappointed", + "stability": "deprecated" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 87 + }, + "name": "readonlyProperty", + "type": { + "primitive": "string" + } + }, + { + "docs": { + "deprecated": "shouldn't have been mutable", + "stability": "deprecated" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 89 + }, + "name": "mutableProperty", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, + "jsii-calc.DeprecatedEnum": { + "assembly": "jsii-calc", + "docs": { + "deprecated": "your deprecated selection of bad options", + "stability": "deprecated" + }, + "fqn": "jsii-calc.DeprecatedEnum", + "kind": "enum", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 99 + }, + "members": [ + { + "docs": { + "deprecated": "option A is not great", + "stability": "deprecated" + }, + "name": "OptionA" + }, + { + "docs": { + "deprecated": "option B is kinda bad, too", + "stability": "deprecated" + }, + "name": "OptionB" + } + ], + "name": "DeprecatedEnum" + }, + "jsii-calc.DeprecatedStruct": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "deprecated": "it just wraps a string", + "stability": "deprecated" + }, + "fqn": "jsii-calc.DeprecatedStruct", + "kind": "interface", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 73 + }, + "name": "DeprecatedStruct", + "properties": [ + { + "abstract": true, + "docs": { + "deprecated": "well, yeah", + "stability": "deprecated" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 75 + }, + "name": "readonlyProperty", + "type": { + "primitive": "string" + } + } + ] + }, "jsii-calc.DerivedClassHasNoProperties.Base": { "assembly": "jsii-calc", "fqn": "jsii-calc.DerivedClassHasNoProperties.Base", @@ -2394,6 +2539,139 @@ } ] }, + "jsii-calc.ExperimentalClass": { + "assembly": "jsii-calc", + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.ExperimentalClass", + "initializer": { + "docs": { + "stability": "experimental" + }, + "parameters": [ + { + "name": "readonlyString", + "type": { + "primitive": "string" + } + }, + { + "name": "mutableNumber", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, + "kind": "class", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 16 + }, + "methods": [ + { + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 28 + }, + "name": "method" + } + ], + "name": "ExperimentalClass", + "properties": [ + { + "docs": { + "stability": "experimental" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 18 + }, + "name": "readonlyProperty", + "type": { + "primitive": "string" + } + }, + { + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 20 + }, + "name": "mutableProperty", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, + "jsii-calc.ExperimentalEnum": { + "assembly": "jsii-calc", + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.ExperimentalEnum", + "kind": "enum", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 31 + }, + "members": [ + { + "docs": { + "stability": "experimental" + }, + "name": "OptionA" + }, + { + "docs": { + "stability": "experimental" + }, + "name": "OptionB" + } + ], + "name": "ExperimentalEnum" + }, + "jsii-calc.ExperimentalStruct": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.ExperimentalStruct", + "kind": "interface", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 4 + }, + "name": "ExperimentalStruct", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "experimental" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 6 + }, + "name": "readonlyProperty", + "type": { + "primitive": "string" + } + } + ] + }, "jsii-calc.ExportedBaseClass": { "assembly": "jsii-calc", "fqn": "jsii-calc.ExportedBaseClass", @@ -2648,6 +2926,95 @@ } ] }, + "jsii-calc.IDeprecatedInterface": { + "assembly": "jsii-calc", + "docs": { + "deprecated": "useless interface", + "stability": "deprecated" + }, + "fqn": "jsii-calc.IDeprecatedInterface", + "kind": "interface", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 78 + }, + "methods": [ + { + "abstract": true, + "docs": { + "deprecated": "services no purpose", + "stability": "deprecated" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 82 + }, + "name": "method" + } + ], + "name": "IDeprecatedInterface", + "properties": [ + { + "abstract": true, + "docs": { + "deprecated": "could be better", + "stability": "deprecated" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 80 + }, + "name": "mutableProperty", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, + "jsii-calc.IExperimentalInterface": { + "assembly": "jsii-calc", + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.IExperimentalInterface", + "kind": "interface", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 9 + }, + "methods": [ + { + "abstract": true, + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 13 + }, + "name": "method" + } + ], + "name": "IExperimentalInterface", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 11 + }, + "name": "mutableProperty", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, "jsii-calc.IExtendsPrivateInterface": { "assembly": "jsii-calc", "fqn": "jsii-calc.IExtendsPrivateInterface", @@ -3277,6 +3644,49 @@ } ] }, + "jsii-calc.IStableInterface": { + "assembly": "jsii-calc", + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.IStableInterface", + "kind": "interface", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 44 + }, + "methods": [ + { + "abstract": true, + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 48 + }, + "name": "method" + } + ], + "name": "IStableInterface", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 46 + }, + "name": "mutableProperty", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, "jsii-calc.ImplementInternalInterface": { "assembly": "jsii-calc", "fqn": "jsii-calc.ImplementInternalInterface", @@ -4828,6 +5238,7 @@ "assembly": "jsii-calc", "docs": { "deprecated": "Use the new class", + "stability": "deprecated", "summary": "Old class." }, "fqn": "jsii-calc.Old", @@ -5663,6 +6074,139 @@ ], "name": "SingleInstanceTwoTypes" }, + "jsii-calc.StableClass": { + "assembly": "jsii-calc", + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.StableClass", + "initializer": { + "docs": { + "stability": "stable" + }, + "parameters": [ + { + "name": "readonlyString", + "type": { + "primitive": "string" + } + }, + { + "name": "mutableNumber", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, + "kind": "class", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 51 + }, + "methods": [ + { + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 62 + }, + "name": "method" + } + ], + "name": "StableClass", + "properties": [ + { + "docs": { + "stability": "stable" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 53 + }, + "name": "readonlyProperty", + "type": { + "primitive": "string" + } + }, + { + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 55 + }, + "name": "mutableProperty", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, + "jsii-calc.StableEnum": { + "assembly": "jsii-calc", + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.StableEnum", + "kind": "enum", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 65 + }, + "members": [ + { + "docs": { + "stability": "stable" + }, + "name": "OptionA" + }, + { + "docs": { + "stability": "stable" + }, + "name": "OptionB" + } + ], + "name": "StableEnum" + }, + "jsii-calc.StableStruct": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.StableStruct", + "kind": "interface", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 39 + }, + "name": "StableStruct", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "stable" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 41 + }, + "name": "readonlyProperty", + "type": { + "primitive": "string" + } + } + ] + }, "jsii-calc.StaticContext": { "assembly": "jsii-calc", "docs": { @@ -5673,13 +6217,13 @@ "kind": "class", "locationInModule": { "filename": "lib/compliance.ts", - "line": 1645 + "line": 1644 }, "methods": [ { "locationInModule": { "filename": "lib/compliance.ts", - "line": 1648 + "line": 1647 }, "name": "canAccessStaticContext", "returns": { @@ -5695,7 +6239,7 @@ { "locationInModule": { "filename": "lib/compliance.ts", - "line": 1656 + "line": 1655 }, "name": "staticVariable", "static": true, @@ -6629,13 +7173,13 @@ "kind": "class", "locationInModule": { "filename": "lib/compliance.ts", - "line": 1674 + "line": 1673 }, "methods": [ { "locationInModule": { "filename": "lib/compliance.ts", - "line": 1679 + "line": 1678 }, "name": "callMe" }, @@ -6643,7 +7187,7 @@ "abstract": true, "locationInModule": { "filename": "lib/compliance.ts", - "line": 1683 + "line": 1682 }, "name": "overrideMe", "protected": true @@ -6655,7 +7199,7 @@ "immutable": true, "locationInModule": { "filename": "lib/compliance.ts", - "line": 1676 + "line": 1675 }, "name": "methodWasCalled", "type": { @@ -6810,5 +7354,5 @@ } }, "version": "0.11.0", - "fingerprint": "i8GdLx7YlhttP5/pB0dKItig1wFkp/DwDdUtbYsIdfc=" + "fingerprint": "aNWCih3NfgXU4mll5c+zKXj3ekSyaT9S+67MAugCfNo=" } diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/AssemblyExtensions.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/AssemblyExtensions.cs index ab780a6ca6..eaac8b5cc5 100644 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/AssemblyExtensions.cs +++ b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/AssemblyExtensions.cs @@ -61,7 +61,7 @@ public static IEnumerable GetMsBuildProperties(this Assembly assembly) yield return new XElement("IncludeSource", true); yield return new XElement("PackageVersion", assembly.Version); yield return new XElement("PackageId", assembly.Targets.DotNet.PackageId); - yield return new XElement("Description", assembly.Description); + yield return new XElement("Description", GetDescription()); yield return new XElement("ProjectUrl", assembly.Homepage); yield return new XElement("LicenseUrl", $"https://spdx.org/licenses/{assembly.License}.html"); yield return new XElement("Authors", $"{assembly.Author.Name}"); @@ -91,6 +91,16 @@ public static IEnumerable GetMsBuildProperties(this Assembly assembly) { yield return new XElement("IconUrl", assembly.Targets.DotNet.IconUrl); } + + string GetDescription() + { + Stability? stability = assembly.Docs?.Stability; + if (!stability.HasValue) + { + return assembly.Description; + } + return $"{assembly.Description} (Stability: {stability})"; + } } } } diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/ClassGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/ClassGenerator.cs index 2385bab2fd..0304f2a9cb 100644 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/ClassGenerator.cs +++ b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/ClassGenerator.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using Amazon.JSII.Generator.DocComment; using Amazon.JSII.JsonModel.Spec; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; @@ -40,14 +41,31 @@ SyntaxList CreateAttributes() argumentList += $", parametersJson: {parametersJsonLiteral}"; } - return SF.List(new[] { - SF.AttributeList(SF.SeparatedList(new[] { + return SF.List(GetAttributeLists()); + + IEnumerable GetAttributeLists() + { + yield return SF.AttributeList(SF.SeparatedList(new[] { SF.Attribute( SF.ParseName("JsiiClass"), SF.ParseAttributeArgumentList($"({argumentList})") ) - })) - }); + })); + + if (Type.Docs?.Deprecated != null) + { + yield return SF.AttributeList(SF.SeparatedList(new[] { + SF.Attribute( + SF.ParseName("System.Obsolete"), + SF.AttributeArgumentList( + SF.SingletonSeparatedList( + SF.AttributeArgument(SF.LiteralExpression(SyntaxKind.StringLiteralExpression, SF.Literal(Type.Docs.Deprecated))) + ) + ) + ) + })); + } + } } SyntaxTokenList CreateModifiers() @@ -102,12 +120,14 @@ IEnumerable CreateMembers() IEnumerable CreateConstructors() { SyntaxToken typeName = Symbols.GetNameSyntaxToken(Type); + var attributes = GetAttributeLists(); if (Type.Initializer != null) { + var docComment = new MethodDocCommentGenerator(Type.Initializer, Symbols).CreateDocComment(); yield return SF.ConstructorDeclaration ( - SF.List(), + attributes, SF.TokenList(SF.Token( Type.IsAbstract || Type.Initializer.IsProtected ? SyntaxKind.ProtectedKeyword @@ -136,12 +156,12 @@ IEnumerable CreateConstructors() ), SF.Block(), null - ); + ).WithLeadingTrivia(docComment); } yield return SF.ConstructorDeclaration ( - SF.List(), + attributes, SF.TokenList(SF.Token(SyntaxKind.ProtectedKeyword)), typeName, SF.ParseParameterList("(ByRefValue reference)"), @@ -157,7 +177,7 @@ IEnumerable CreateConstructors() // This constructor allows child classes to supply their own parameter lists. It is always protected. yield return SF.ConstructorDeclaration ( - SF.List(), + attributes, SF.TokenList(SF.Token(SyntaxKind.ProtectedKeyword)), typeName, SF.ParseParameterList("(DeputyProps props)"), @@ -192,6 +212,25 @@ ArgumentSyntax GetBaseArgument() ) ); } + + SyntaxList GetAttributeLists() + { + var deprecated = Type.Initializer?.Docs?.Deprecated; + if (deprecated == null) + { + return SF.List(); + } + return SF.List(new[] { SF.AttributeList(SF.SingletonSeparatedList( + SF.Attribute( + SF.ParseName("System.Obsolete"), + SF.AttributeArgumentList( + SF.SingletonSeparatedList( + SF.AttributeArgument(SF.LiteralExpression(SyntaxKind.StringLiteralExpression, SF.Literal(deprecated))) + ) + ) + ) + )) }); + } } IEnumerable CreateProperties() diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/DocCommentGeneratorBase.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/DocCommentGeneratorBase.cs index 532b24a4dd..398a768fc2 100644 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/DocCommentGeneratorBase.cs +++ b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/DocCommentGeneratorBase.cs @@ -53,7 +53,6 @@ protected IEnumerable GetRemarksNodes() List remarks = new List(); if (!String.IsNullOrEmpty(Documentable.Docs.Remarks)) { remarks.Add(Documentable.Docs.Remarks); } if (!String.IsNullOrEmpty(Documentable.Docs.Default)) { remarks.Add($"default: {Documentable.Docs.Default}"); } - if (!String.IsNullOrEmpty(Documentable.Docs.Deprecated)) { remarks.Add($"deprecated: {Documentable.Docs.Deprecated}"); } if (Documentable.Docs.Stability.HasValue) { remarks.Add($"stability: {Documentable.Docs.Stability}"); } if (!String.IsNullOrEmpty(Documentable.Docs.Example)) { remarks.Add($"example:\n\n{Documentable.Docs.Example}\n"); } if (!String.IsNullOrEmpty(Documentable.Docs.See)) { remarks.Add($"{Documentable.Docs.See} "); } // Extra space here to keep links clickable diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/MethodDocCommentGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/MethodDocCommentGenerator.cs index 78b645a68c..62b728aa3a 100644 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/MethodDocCommentGenerator.cs +++ b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/MethodDocCommentGenerator.cs @@ -8,11 +8,11 @@ namespace Amazon.JSII.Generator.DocComment { - public class MethodDocCommentGenerator : DocCommentGeneratorBase + public class MethodDocCommentGenerator : DocCommentGeneratorBase { readonly ISymbolMap _symbols; - public MethodDocCommentGenerator(Method documentable, ISymbolMap symbols) : base(documentable) + public MethodDocCommentGenerator(Callable documentable, ISymbolMap symbols) : base(documentable) { _symbols = symbols ?? throw new ArgumentNullException(nameof(symbols)); } diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Enum/EnumGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Enum/EnumGenerator.cs index 0b1dc457f0..bbde6173a7 100644 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Enum/EnumGenerator.cs +++ b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Enum/EnumGenerator.cs @@ -3,6 +3,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; +using System.Collections.Generic; using System.Linq; using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; @@ -32,14 +33,31 @@ SyntaxList CreateAttributes() TypeOfExpressionSyntax typeOfExpression = SF.TypeOfExpression(Symbols.GetNameSyntax(Type)); SyntaxToken fullyQualifiedNameLiteral = SF.Literal(Type.FullyQualifiedName); - return SF.List(new[] { - SF.AttributeList(SF.SeparatedList(new[] { + return SF.List(GetAttributeLists()); + + IEnumerable GetAttributeLists() + { + yield return SF.AttributeList(SF.SeparatedList(new[] { SF.Attribute( SF.ParseName("JsiiEnum"), SF.ParseAttributeArgumentList($"(nativeType: {typeOfExpression}, fullyQualifiedName: {fullyQualifiedNameLiteral})") ) - })) - }); + })); + + if (Type.Docs?.Deprecated != null) + { + yield return SF.AttributeList(SF.SeparatedList(new[] { + SF.Attribute( + SF.ParseName("System.Obsolete"), + SF.AttributeArgumentList( + SF.SingletonSeparatedList( + SF.AttributeArgument(SF.LiteralExpression(SyntaxKind.StringLiteralExpression, SF.Literal(Type.Docs.Deprecated))) + ) + ) + ) + })); + } + } } SeparatedSyntaxList CreateValues() @@ -50,14 +68,7 @@ EnumMemberDeclarationSyntax GetMemberDeclaration(EnumMember member) { EnumMemberDeclarationSyntax declaration = SF.EnumMemberDeclaration ( - SF.List(new[] { - SF.AttributeList(SF.SeparatedList(new[] { - SF.Attribute( - SF.ParseName("JsiiEnumMember"), - SF.ParseAttributeArgumentList($"(name: \"{member.Name}\")") - ) - })) - }), + SF.List(GetAttributeLists()), Symbols.GetNameSyntaxToken(Type, member), null ); @@ -71,6 +82,26 @@ EnumMemberDeclarationSyntax GetMemberDeclaration(EnumMember member) } return declaration; + + IEnumerable GetAttributeLists() + { + yield return SF.AttributeList(SF.SingletonSeparatedList( + SF.Attribute( + SF.ParseName("JsiiEnumMember"), + SF.ParseAttributeArgumentList($"(name: \"{member.Name}\")") + ) + )); + + if (member.Docs?.Stability == Stability.Deprecated) + { + yield return SF.AttributeList(SF.SingletonSeparatedList( + SF.Attribute( + SF.ParseName("System.Obsolete"), + SF.ParseAttributeArgumentList($"({SF.Literal(member.Docs?.Deprecated ?? "")})") + ) + )); + } + } } } } diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceGenerator.cs index 1cd3fecb29..0417f772ca 100644 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceGenerator.cs +++ b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceGenerator.cs @@ -34,14 +34,31 @@ SyntaxList CreateAttributes() TypeOfExpressionSyntax typeOfExpression = SF.TypeOfExpression(Symbols.GetNameSyntax(Type)); SyntaxToken fullyQualifiedNameLiteral = SF.Literal(Type.FullyQualifiedName); - return SF.List(new[] { - SF.AttributeList(SF.SeparatedList(new[] { + return SF.List(GetAttributeLists()); + + IEnumerable GetAttributeLists() + { + yield return SF.AttributeList(SF.SeparatedList(new[] { SF.Attribute( SF.ParseName("JsiiInterface"), SF.ParseAttributeArgumentList($"(nativeType: {typeOfExpression}, fullyQualifiedName: {fullyQualifiedNameLiteral})") ) - })) - }); + })); + + if (Type.Docs?.Deprecated != null) + { + yield return SF.AttributeList(SF.SeparatedList(new[] { + SF.Attribute( + SF.ParseName("System.Obsolete"), + SF.AttributeArgumentList( + SF.SingletonSeparatedList( + SF.AttributeArgument(SF.LiteralExpression(SyntaxKind.StringLiteralExpression, SF.Literal(Type.Docs.Deprecated))) + ) + ) + ) + })); + } + } } BaseListSyntax CreateBaseList() diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/MethodGeneratorBase.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/MethodGeneratorBase.cs index 11542d27a4..bb3d369d90 100644 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/MethodGeneratorBase.cs +++ b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/MethodGeneratorBase.cs @@ -167,9 +167,9 @@ IEnumerable GetArguments() SyntaxList GetAttributeLists() { - return SF.List(new[] { SF.AttributeList(SF.SeparatedList(GetAttributes())) }); + return SF.List(GetAttributeLists()); - IEnumerable GetAttributes() + IEnumerable GetAttributeLists() { SyntaxToken nameLiteral = SF.Literal(Method.Name); SyntaxToken trueLiteral = SF.Token(SyntaxKind.TrueKeyword); @@ -197,10 +197,22 @@ IEnumerable GetAttributes() argumentList += $", isOverride: {trueLiteral}"; } - yield return SF.Attribute( + yield return SF.AttributeList(SF.SingletonSeparatedList(SF.Attribute( SF.ParseName("JsiiMethod"), SF.ParseAttributeArgumentList($"({argumentList})") - ); + ))); + + if (Method.Docs?.Deprecated != null) + { + yield return SF.AttributeList(SF.SingletonSeparatedList(SF.Attribute( + SF.ParseName("System.Obsolete"), + SF.AttributeArgumentList( + SF.SingletonSeparatedList( + SF.AttributeArgument(SF.LiteralExpression(SyntaxKind.StringLiteralExpression, SF.Literal(Method.Docs.Deprecated))) + ) + ) + ))); + } } } diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/PropertyGeneratorBase.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/PropertyGeneratorBase.cs index 3ca2e33ab1..17b08475fe 100644 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/PropertyGeneratorBase.cs +++ b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/PropertyGeneratorBase.cs @@ -157,9 +157,9 @@ SyntaxTokenList GetModifierList() SyntaxList GetAttributeLists() { - return SF.List(new[] { SF.AttributeList(SF.SeparatedList(GetAttributes())) }); + return SF.List(GetAttributesLists()); - IEnumerable GetAttributes() + IEnumerable GetAttributesLists() { SyntaxToken nameLiteral = SF.Literal(Property.Name); SyntaxToken typeJsonLiteral = SF.Literal(JsonConvert.SerializeObject(Property.Type, SerializerSettings)); @@ -175,10 +175,22 @@ IEnumerable GetAttributes() argumentList += $", isOverride: {trueLiteral}"; } - yield return SF.Attribute( + yield return SF.AttributeList(SF.SingletonSeparatedList(SF.Attribute( SF.ParseName("JsiiProperty"), SF.ParseAttributeArgumentList($"({argumentList})") - ); + ))); + + if (Property.Docs?.Deprecated != null) + { + yield return SF.AttributeList(SF.SingletonSeparatedList(SF.Attribute( + SF.ParseName("System.Obsolete"), + SF.AttributeArgumentList( + SF.SingletonSeparatedList( + SF.AttributeArgument(SF.LiteralExpression(SyntaxKind.StringLiteralExpression, SF.Literal(Property.Docs.Deprecated))) + ) + ) + ))); + } } } diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeProxyGeneratorBase.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeProxyGeneratorBase.cs index e184e1a369..5733dba5a7 100644 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeProxyGeneratorBase.cs +++ b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeProxyGeneratorBase.cs @@ -35,16 +35,27 @@ SyntaxList CreateAttributes() var typeOfExpression = SF.TypeOfExpression(Symbols.GetNameSyntax(Type)); var fullyQualifiedNameLiteral = SF.Literal(Type.FullyQualifiedName); - return SF.List(new[] + return SF.List(GetAttributeLists()); + + IEnumerable GetAttributeLists() { - SF.AttributeList(SF.SeparatedList(new[] - { + yield return SF.AttributeList(SF.SingletonSeparatedList( SF.Attribute( SF.ParseName("JsiiTypeProxy"), SF.ParseAttributeArgumentList($"(nativeType: {typeOfExpression}, fullyQualifiedName: {fullyQualifiedNameLiteral})") ) - })) - }); + )); + + if (Type.Docs?.Stability == Stability.Deprecated) + { + yield return SF.AttributeList(SF.SingletonSeparatedList( + SF.Attribute( + SF.ParseName("System.Obsolete"), + SF.ParseAttributeArgumentList($"({SF.Literal(Type.Docs?.Deprecated ?? "")})") + ) + )); + } + } } BaseListSyntax CreateBaseList() diff --git a/packages/jsii-dotnet-jsonmodel/src/Amazon.JSII.JsonModel/Spec/Stability.cs b/packages/jsii-dotnet-jsonmodel/src/Amazon.JSII.JsonModel/Spec/Stability.cs index 788dfb09c9..e6edb4e2c6 100644 --- a/packages/jsii-dotnet-jsonmodel/src/Amazon.JSII.JsonModel/Spec/Stability.cs +++ b/packages/jsii-dotnet-jsonmodel/src/Amazon.JSII.JsonModel/Spec/Stability.cs @@ -7,6 +7,7 @@ namespace Amazon.JSII.JsonModel.Spec public enum Stability { Stable, - Experimental + Experimental, + Deprecated } } diff --git a/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Stability.java b/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Stability.java new file mode 100644 index 0000000000..22f5f623d9 --- /dev/null +++ b/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Stability.java @@ -0,0 +1,45 @@ +package software.amazon.jsii; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Documents the stability of an API. + */ +@Documented +@Retention(RetentionPolicy.SOURCE) +@Target({ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.METHOD, ElementType.PACKAGE, ElementType.TYPE}) +public @interface Stability { + /** + * @return The stability level of the annotated API. + */ + Level value(); + + /** + * Stability level of an API, similar to the Node.js stability index. + * + * @see https://nodejs.org/api/documentation.html#documentation_stability_index + */ + public enum Level { + /** + * The API is not subject to Semantic Versioning rules. Non-backward compatible changes or removal may occur in any + * future release. Use of the API is not recommended in production environments. + */ + Experimental, + + /** + * The API is subject to Sematic Versining rules. It may not change in non-backward compatible ways in a subsequent + * patch or feature version. + */ + Stable, + + /** + * The API may emit warnings. Backward compatibility is not guaranteed. APIs annotated with the {@code Deprecated} + * level should also be annotated with the standard {@link Deprecated} annotation. + */ + Deprecated + } +} diff --git a/packages/jsii-pacmak/lib/markdown.ts b/packages/jsii-pacmak/lib/markdown.ts index 5ef9017bae..b74866139c 100644 --- a/packages/jsii-pacmak/lib/markdown.ts +++ b/packages/jsii-pacmak/lib/markdown.ts @@ -114,6 +114,12 @@ export function md2rst(text: string) { return doc.toString(); } +export function md2html(text: string): string { + const parser = new commonmark.Parser({ smart: false }); + const renderer = new commonmark.HtmlRenderer({ smart: false, safe: true }); + return renderer.render(parser.parse(text)); +} + /** * Build a document incrementally */ @@ -236,4 +242,4 @@ function pump(ast: commonmark.Node, handlers: Handlers) { │ └── text └── text - */ \ No newline at end of file + */ diff --git a/packages/jsii-pacmak/lib/targets/java.ts b/packages/jsii-pacmak/lib/targets/java.ts index f3a080b6d4..47db0ed5b1 100644 --- a/packages/jsii-pacmak/lib/targets/java.ts +++ b/packages/jsii-pacmak/lib/targets/java.ts @@ -5,6 +5,7 @@ import path = require('path'); import xmlbuilder = require('xmlbuilder'); import { Generator } from '../generator'; import logging = require('../logging'); +import { md2html } from '../markdown'; import { PackageInfo, Target, TargetOptions } from '../target'; import { shell } from '../util'; import { VERSION, VERSION_DESC } from '../version'; @@ -166,6 +167,8 @@ class JavaGenerator extends Generator { protected onBeginAssembly(assm: spec.Assembly, fingerprint: boolean) { this.emitFullGeneratorInfo = fingerprint; this.moduleClass = this.emitModuleFile(assm); + + this.emitPackageInfo(assm); } protected onEndAssembly(assm: spec.Assembly, fingerprint: boolean) { @@ -195,6 +198,7 @@ class JavaGenerator extends Generator { const absPrefix = abstract ? ' abstract' : ''; if (!nested) { this.emitGeneratedAnnotation(); } + this.emitStabilityAnnotations(cls); this.code.line(`@software.amazon.jsii.Jsii(module = ${this.moduleClass}.class, fqn = "${cls.fqn}")`); this.code.openBlock(`public${inner}${absPrefix} class ${cls.name}${extendsExpression}${implementsExpr}`); @@ -213,6 +217,7 @@ class JavaGenerator extends Generator { protected onInitializer(cls: spec.ClassType, method: spec.Method) { this.addJavaDocs(method); + this.emitStabilityAnnotations(method); this.code.openBlock(`${this.renderAccessLevel(method)} ${cls.name}(${this.renderMethodParameters(method)})`); this.code.line('super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii);'); this.code.line(`software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this${this.renderMethodCallArguments(method)});`); @@ -270,6 +275,7 @@ class JavaGenerator extends Generator { this.openFileIfNeeded(enm); this.addJavaDocs(enm); if (!this.isNested(enm)) { this.emitGeneratedAnnotation(); } + this.emitStabilityAnnotations(enm); this.code.line(`@software.amazon.jsii.Jsii(module = ${this.moduleClass}.class, fqn = "${enm.fqn}")`); this.code.openBlock(`public enum ${enm.name}`); } @@ -279,6 +285,7 @@ class JavaGenerator extends Generator { } protected onEnumMember(_: spec.EnumType, member: spec.EnumMember) { this.addJavaDocs(member); + this.emitStabilityAnnotations(member); this.code.line(`${member.name},`); } @@ -304,6 +311,7 @@ class JavaGenerator extends Generator { const nested = this.isNested(ifc); const inner = nested ? ' static' : ''; if (!nested) { this.emitGeneratedAnnotation(); } + this.emitStabilityAnnotations(ifc); this.code.openBlock(`public${inner} interface ${ifc.name} extends ${bases}`); } @@ -322,6 +330,7 @@ class JavaGenerator extends Generator { protected onInterfaceMethod(_ifc: spec.InterfaceType, method: spec.Method) { const returnType = method.returns ? this.toJavaType(method.returns.type) : 'void'; this.addJavaDocs(method); + this.emitStabilityAnnotations(method); this.code.line(`${returnType} ${method.name}(${this.renderMethodParameters(method)});`); } @@ -336,6 +345,7 @@ class JavaGenerator extends Generator { // for unions we only generate overloads for setters, not getters. this.addJavaDocs(prop); + this.emitStabilityAnnotations(prop); this.code.line(`${getterType} get${propName}();`); if (!prop.immutable) { @@ -346,6 +356,29 @@ class JavaGenerator extends Generator { } } + private emitPackageInfo(mod: spec.Assembly) { + if (!mod.docs) { return; } + + const packageName = this.getNativeName(mod, undefined); + const packageInfoFile = this.toJavaFilePath(mod.name + '.package-info'); + this.code.openFile(packageInfoFile); + this.code.line('/**'); + if (mod.readme) { + for (const line of md2html(mod.readme.markdown).split('\n')) { + this.code.line(` * ${line}`); + } + } + if (mod.docs.deprecated) { + this.code.line(' *'); + // Javac won't allow @deprecated on packages, while @Deprecated is aaaabsolutely fine. Duh. + this.code.line(` * Deprecated: ${mod.docs.deprecated}`); + } + this.code.line(' */'); + this.emitStabilityAnnotations(mod); + this.code.line(`package ${packageName};`); + this.code.closeFile(packageInfoFile); + } + private emitMavenPom(assm: spec.Assembly, fingerprint: boolean) { const self = this; @@ -441,6 +474,12 @@ class JavaGenerator extends Generator { configuration: { failOnError: false, show: 'protected', + sourceFileExcludes: { + // Excluding the $Module classes so they won't pollute the docsite. They otherwise + // are all collected at the top of the classlist, burrying useful information under + // a lot of dry scrolling. + exclude: ['**/$Module.java'] + }, // Adding these makes JavaDoc generation about a 3rd faster (which is far and away the most // expensive part of the build) additionalJOption: ['-J-XX:+TieredCompilation', '-J-XX:TieredStopAtLevel=1'] @@ -546,6 +585,7 @@ class JavaGenerator extends Generator { const access = this.renderAccessLevel(prop); this.addJavaDocs(prop); + this.emitStabilityAnnotations(prop); this.code.line(`${access} final static ${propType} ${propName};`); } @@ -563,6 +603,7 @@ class JavaGenerator extends Generator { this.code.line(); this.addJavaDocs(prop); if (overrides) { this.code.line('@Override'); } + this.emitStabilityAnnotations(prop); if (isNullable(prop)) { this.code.line(JSR305_NULLABLE); } this.code.openBlock(`${access} ${statc}${getterType} get${propName}()`); @@ -584,6 +625,7 @@ class JavaGenerator extends Generator { this.code.line(); this.addJavaDocs(prop); if (overrides) { this.code.line('@Override'); } + this.emitStabilityAnnotations(prop); const nullable = isNullable(prop) ? `${JSR305_NULLABLE} ` : ''; this.code.openBlock(`${access} ${statc}void set${propName}(${nullable}final ${type} value)`); let statement = ''; @@ -610,6 +652,7 @@ class JavaGenerator extends Generator { const signature = `${returnType} ${methodName}(${this.renderMethodParameters(method)})`; this.code.line(); this.addJavaDocs(method); + this.emitStabilityAnnotations(method); if (overrides) { this.code.line('@Override'); } if (isNullable(method.returns)) { this.code.line(JSR305_NULLABLE); } if (method.abstract) { @@ -695,6 +738,27 @@ class JavaGenerator extends Generator { this.code.closeBlock(); } + private emitStabilityAnnotations(entity: spec.Documentable) { + if (!entity.docs) { return; } + if (entity.docs.stability === spec.Stability.Deprecated || entity.docs.deprecated) { + this.code.line('@Deprecated'); + } + if (entity.docs.stability) { + this.code.line(`@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.${_level(entity.docs.stability)})`); + } + + function _level(stability: spec.Stability): string { + switch (stability) { + case spec.Stability.Deprecated: + return 'Deprecated'; + case spec.Stability.Experimental: + return 'Experimental'; + case spec.Stability.Stable: + return 'Stable'; + } + } + } + private emitInterfaceBuilder(ifc: spec.InterfaceType) { const interfaceName = ifc.name; const builderName = 'Builder'; @@ -703,6 +767,7 @@ class JavaGenerator extends Generator { this.code.line('/**'); this.code.line(` * @return a {@link Builder} of {@link ${interfaceName}}`); this.code.line(' */'); + this.emitStabilityAnnotations(ifc); this.code.openBlock(`static ${builderName} builder()`); this.code.line(`return new ${builderName}();`); this.code.closeBlock(); @@ -755,6 +820,7 @@ class JavaGenerator extends Generator { this.code.line('/**'); this.code.line(` * A builder for {@link ${interfaceName}}`); this.code.line(' */'); + this.emitStabilityAnnotations(ifc); this.code.openBlock(`final class ${builderName}`); for (const prop of props) { @@ -774,7 +840,11 @@ class JavaGenerator extends Generator { this.code.line(` * @param value the value to be set`); } this.code.line(` * @return {@code this}`); + if (prop.docs && prop.docs.deprecated) { + this.code.line(` * @deprecated ${prop.docs.deprecated}`); + } this.code.line(' */'); + this.emitStabilityAnnotations(prop.spec); this.code.openBlock(`public ${builderName} with${prop.propName}(${prop.nullable ? `${JSR305_NULLABLE} ` : ''}final ${type} value)`); this.code.line(`this._${prop.fieldName} = ${_validateIfNonOptional('value', prop)};`); this.code.line('return this;'); @@ -787,6 +857,7 @@ class JavaGenerator extends Generator { this.code.line(` * @return a new instance of {@link ${interfaceName}}`); this.code.line(' * @throws NullPointerException if any required attribute was not provided'); this.code.line(' */'); + this.emitStabilityAnnotations(ifc); this.code.openBlock(`public ${interfaceName} build()`); this.code.openBlock(`return new ${interfaceName}()`); for (const prop of props) { @@ -1161,11 +1232,11 @@ class JavaGenerator extends Generator { private getNativeName(assm: spec.Assembly, name: string | undefined): string; private getNativeName(assm: spec.PackageVersion, name: string | undefined, assmName: string): string; - private getNativeName(assm: spec.Assembly | spec.PackageVersion, + private getNativeName(assm: spec.Assembly | spec.PackageVersion, name: string | undefined, assmName: string = (assm as spec.Assembly).name): string { const javaPackage = assm.targets && assm.targets.java && assm.targets.java.package; - if (!javaPackage) { throw new Error(`The module ${assmName} does not have a java.package setting`); } + if (!javaPackage) { throw new Error(`The module ${assmName} does not have a java.package setting`); } return `${javaPackage}${name ? `.${name}` : ''}`; } diff --git a/packages/jsii-pacmak/lib/targets/python.ts b/packages/jsii-pacmak/lib/targets/python.ts index 40e411fa2b..a18f62b503 100644 --- a/packages/jsii-pacmak/lib/targets/python.ts +++ b/packages/jsii-pacmak/lib/targets/python.ts @@ -1098,7 +1098,7 @@ class Package { } code.openFile("README.md"); - code.line(this.metadata.readme !== undefined ? this.metadata.readme.markdown : ""); + code.line(this.metadata.readme && this.metadata.readme.markdown); code.closeFile("README.md"); // Strip " (build abcdef)" from the jsii version @@ -1779,7 +1779,7 @@ function emitDocString(code: CodeMaker, docs: spec.Docs | undefined, options: { if (docs.returns) { block('Returns:', docs.returns); } if (docs.deprecated) { block('Deprecated:', docs.deprecated); } if (docs.see) { block('See:', docs.see, false); } - if (docs.stability === spec.Stability.Experimental) { block('Stability:', docs.stability, false); } + if (docs.stability) { block('Stability:', docs.stability, false); } if (docs.subclassable) { block('Subclassable:', 'Yes'); } for (const [k, v] of Object.entries(docs.custom || {})) { @@ -1826,4 +1826,4 @@ function onelineDescription(docs: spec.Docs | undefined) { if (docs.remarks) { parts.push(md2rst(docs.remarks)); } if (docs.default) { parts.push(`Default: ${md2rst(docs.default)}`); } return parts.join(' ').replace(/\s+/g, ' '); -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/java/pom.xml b/packages/jsii-pacmak/test/expected.jsii-calc-base/java/pom.xml index 88fc0d326d..31681ab056 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/java/pom.xml +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/java/pom.xml @@ -103,6 +103,9 @@ false protected + + **/$Module.java + -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/.jsii index 1616631195..0b3cc71378 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/.jsii @@ -84,6 +84,10 @@ } }, "description": "A simple calcuator library built on JSII.", + "docs": { + "deprecated": "Really just deprecated for shows...", + "stability": "deprecated" + }, "homepage": "https://github.com/awslabs/jsii.git", "jsiiVersion": "0.11.0", "license": "Apache-2.0", @@ -496,5 +500,5 @@ } }, "version": "0.11.0", - "fingerprint": "EtAUzTnV+hmz9yrXilnsS0MhQuQ/qmpmbwxvdLu561k=" + "fingerprint": "x/BbPdAJTYB6QY83ucqo0CNLa2NoLebqPMbMY7BsyR4=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId.csproj b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId.csproj index fc3c918990..f973e0ad37 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId.csproj +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId.csproj @@ -6,7 +6,7 @@ true 0.11.0 Amazon.JSII.Tests.CalculatorPackageId.LibPackageId - A simple calcuator library built on JSII. + A simple calcuator library built on JSII. (Stability: Deprecated) https://github.com/awslabs/jsii.git https://spdx.org/licenses/Apache-2.0.html Amazon Web Services diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Number.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Number.cs index bc1268d445..017f1346d2 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Number.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Number.cs @@ -6,6 +6,8 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace [JsiiClass(nativeType: typeof(Number), fullyQualifiedName: "@scope/jsii-calc-lib.Number", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"number\"}}]")] public class Number : Value_, IIDoublable { + /// Creates a Number object. + /// The number. public Number(double value): base(new DeputyProps(new object[]{value})) { } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/pom.xml b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/pom.xml index fa52a618d8..0c52e04bf0 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/pom.xml +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/pom.xml @@ -103,6 +103,9 @@ false protected + + **/$Module.java + -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/package-info.java b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/package-info.java new file mode 100644 index 0000000000..83cb56c7f0 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/package-info.java @@ -0,0 +1,7 @@ +/** + * + * Deprecated: Really just deprecated for shows... + */ +@Deprecated +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) +package software.amazon.jsii.tests.calculator.lib; diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii index 7d7acac404..d89f670cd7 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii @@ -182,6 +182,9 @@ } }, "description": "A simple calcuator built on JSII.", + "docs": { + "stability": "experimental" + }, "homepage": "https://github.com/awslabs/jsii.git", "jsiiVersion": "0.11.0", "license": "Apache-2.0", @@ -1515,7 +1518,6 @@ "custom": { "customAttribute": "hasAValue" }, - "deprecated": "Use something else please", "example": "function anExample() {\n}", "remarks": "The docs are great. They're a bunch of tags.", "see": "https://aws.amazon.com/", @@ -1527,7 +1529,7 @@ "kind": "class", "locationInModule": { "filename": "lib/compliance.ts", - "line": 1637 + "line": 1636 }, "name": "ClassWithDocs" }, @@ -1887,6 +1889,149 @@ } ] }, + "jsii-calc.DeprecatedClass": { + "assembly": "jsii-calc", + "docs": { + "deprecated": "a pretty boring class", + "stability": "deprecated" + }, + "fqn": "jsii-calc.DeprecatedClass", + "initializer": { + "docs": { + "deprecated": "this constructor is \"just\" okay", + "stability": "deprecated" + }, + "parameters": [ + { + "name": "readonlyString", + "type": { + "primitive": "string" + } + }, + { + "name": "mutableNumber", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, + "kind": "class", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 85 + }, + "methods": [ + { + "docs": { + "deprecated": "it was a bad idea", + "stability": "deprecated" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 96 + }, + "name": "method" + } + ], + "name": "DeprecatedClass", + "properties": [ + { + "docs": { + "deprecated": "this is not always \"wazoo\", be ready to be disappointed", + "stability": "deprecated" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 87 + }, + "name": "readonlyProperty", + "type": { + "primitive": "string" + } + }, + { + "docs": { + "deprecated": "shouldn't have been mutable", + "stability": "deprecated" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 89 + }, + "name": "mutableProperty", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, + "jsii-calc.DeprecatedEnum": { + "assembly": "jsii-calc", + "docs": { + "deprecated": "your deprecated selection of bad options", + "stability": "deprecated" + }, + "fqn": "jsii-calc.DeprecatedEnum", + "kind": "enum", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 99 + }, + "members": [ + { + "docs": { + "deprecated": "option A is not great", + "stability": "deprecated" + }, + "name": "OptionA" + }, + { + "docs": { + "deprecated": "option B is kinda bad, too", + "stability": "deprecated" + }, + "name": "OptionB" + } + ], + "name": "DeprecatedEnum" + }, + "jsii-calc.DeprecatedStruct": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "deprecated": "it just wraps a string", + "stability": "deprecated" + }, + "fqn": "jsii-calc.DeprecatedStruct", + "kind": "interface", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 73 + }, + "name": "DeprecatedStruct", + "properties": [ + { + "abstract": true, + "docs": { + "deprecated": "well, yeah", + "stability": "deprecated" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 75 + }, + "name": "readonlyProperty", + "type": { + "primitive": "string" + } + } + ] + }, "jsii-calc.DerivedClassHasNoProperties.Base": { "assembly": "jsii-calc", "fqn": "jsii-calc.DerivedClassHasNoProperties.Base", @@ -2394,6 +2539,139 @@ } ] }, + "jsii-calc.ExperimentalClass": { + "assembly": "jsii-calc", + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.ExperimentalClass", + "initializer": { + "docs": { + "stability": "experimental" + }, + "parameters": [ + { + "name": "readonlyString", + "type": { + "primitive": "string" + } + }, + { + "name": "mutableNumber", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, + "kind": "class", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 16 + }, + "methods": [ + { + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 28 + }, + "name": "method" + } + ], + "name": "ExperimentalClass", + "properties": [ + { + "docs": { + "stability": "experimental" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 18 + }, + "name": "readonlyProperty", + "type": { + "primitive": "string" + } + }, + { + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 20 + }, + "name": "mutableProperty", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, + "jsii-calc.ExperimentalEnum": { + "assembly": "jsii-calc", + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.ExperimentalEnum", + "kind": "enum", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 31 + }, + "members": [ + { + "docs": { + "stability": "experimental" + }, + "name": "OptionA" + }, + { + "docs": { + "stability": "experimental" + }, + "name": "OptionB" + } + ], + "name": "ExperimentalEnum" + }, + "jsii-calc.ExperimentalStruct": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.ExperimentalStruct", + "kind": "interface", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 4 + }, + "name": "ExperimentalStruct", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "experimental" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 6 + }, + "name": "readonlyProperty", + "type": { + "primitive": "string" + } + } + ] + }, "jsii-calc.ExportedBaseClass": { "assembly": "jsii-calc", "fqn": "jsii-calc.ExportedBaseClass", @@ -2648,6 +2926,95 @@ } ] }, + "jsii-calc.IDeprecatedInterface": { + "assembly": "jsii-calc", + "docs": { + "deprecated": "useless interface", + "stability": "deprecated" + }, + "fqn": "jsii-calc.IDeprecatedInterface", + "kind": "interface", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 78 + }, + "methods": [ + { + "abstract": true, + "docs": { + "deprecated": "services no purpose", + "stability": "deprecated" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 82 + }, + "name": "method" + } + ], + "name": "IDeprecatedInterface", + "properties": [ + { + "abstract": true, + "docs": { + "deprecated": "could be better", + "stability": "deprecated" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 80 + }, + "name": "mutableProperty", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, + "jsii-calc.IExperimentalInterface": { + "assembly": "jsii-calc", + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.IExperimentalInterface", + "kind": "interface", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 9 + }, + "methods": [ + { + "abstract": true, + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 13 + }, + "name": "method" + } + ], + "name": "IExperimentalInterface", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 11 + }, + "name": "mutableProperty", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, "jsii-calc.IExtendsPrivateInterface": { "assembly": "jsii-calc", "fqn": "jsii-calc.IExtendsPrivateInterface", @@ -3277,6 +3644,49 @@ } ] }, + "jsii-calc.IStableInterface": { + "assembly": "jsii-calc", + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.IStableInterface", + "kind": "interface", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 44 + }, + "methods": [ + { + "abstract": true, + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 48 + }, + "name": "method" + } + ], + "name": "IStableInterface", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 46 + }, + "name": "mutableProperty", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, "jsii-calc.ImplementInternalInterface": { "assembly": "jsii-calc", "fqn": "jsii-calc.ImplementInternalInterface", @@ -4828,6 +5238,7 @@ "assembly": "jsii-calc", "docs": { "deprecated": "Use the new class", + "stability": "deprecated", "summary": "Old class." }, "fqn": "jsii-calc.Old", @@ -5663,6 +6074,139 @@ ], "name": "SingleInstanceTwoTypes" }, + "jsii-calc.StableClass": { + "assembly": "jsii-calc", + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.StableClass", + "initializer": { + "docs": { + "stability": "stable" + }, + "parameters": [ + { + "name": "readonlyString", + "type": { + "primitive": "string" + } + }, + { + "name": "mutableNumber", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, + "kind": "class", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 51 + }, + "methods": [ + { + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 62 + }, + "name": "method" + } + ], + "name": "StableClass", + "properties": [ + { + "docs": { + "stability": "stable" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 53 + }, + "name": "readonlyProperty", + "type": { + "primitive": "string" + } + }, + { + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 55 + }, + "name": "mutableProperty", + "optional": true, + "type": { + "primitive": "number" + } + } + ] + }, + "jsii-calc.StableEnum": { + "assembly": "jsii-calc", + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.StableEnum", + "kind": "enum", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 65 + }, + "members": [ + { + "docs": { + "stability": "stable" + }, + "name": "OptionA" + }, + { + "docs": { + "stability": "stable" + }, + "name": "OptionB" + } + ], + "name": "StableEnum" + }, + "jsii-calc.StableStruct": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.StableStruct", + "kind": "interface", + "locationInModule": { + "filename": "lib/stability.ts", + "line": 39 + }, + "name": "StableStruct", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "stable" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/stability.ts", + "line": 41 + }, + "name": "readonlyProperty", + "type": { + "primitive": "string" + } + } + ] + }, "jsii-calc.StaticContext": { "assembly": "jsii-calc", "docs": { @@ -5673,13 +6217,13 @@ "kind": "class", "locationInModule": { "filename": "lib/compliance.ts", - "line": 1645 + "line": 1644 }, "methods": [ { "locationInModule": { "filename": "lib/compliance.ts", - "line": 1648 + "line": 1647 }, "name": "canAccessStaticContext", "returns": { @@ -5695,7 +6239,7 @@ { "locationInModule": { "filename": "lib/compliance.ts", - "line": 1656 + "line": 1655 }, "name": "staticVariable", "static": true, @@ -6629,13 +7173,13 @@ "kind": "class", "locationInModule": { "filename": "lib/compliance.ts", - "line": 1674 + "line": 1673 }, "methods": [ { "locationInModule": { "filename": "lib/compliance.ts", - "line": 1679 + "line": 1678 }, "name": "callMe" }, @@ -6643,7 +7187,7 @@ "abstract": true, "locationInModule": { "filename": "lib/compliance.ts", - "line": 1683 + "line": 1682 }, "name": "overrideMe", "protected": true @@ -6655,7 +7199,7 @@ "immutable": true, "locationInModule": { "filename": "lib/compliance.ts", - "line": 1676 + "line": 1675 }, "name": "methodWasCalled", "type": { @@ -6810,5 +7354,5 @@ } }, "version": "0.11.0", - "fingerprint": "i8GdLx7YlhttP5/pB0dKItig1wFkp/DwDdUtbYsIdfc=" + "fingerprint": "aNWCih3NfgXU4mll5c+zKXj3ekSyaT9S+67MAugCfNo=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon.JSII.Tests.CalculatorPackageId.csproj b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon.JSII.Tests.CalculatorPackageId.csproj index 7f55804c53..d926ed32f5 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon.JSII.Tests.CalculatorPackageId.csproj +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon.JSII.Tests.CalculatorPackageId.csproj @@ -6,7 +6,7 @@ true 0.11.0 Amazon.JSII.Tests.CalculatorPackageId - A simple calcuator built on JSII. + A simple calcuator built on JSII. (Stability: Experimental) https://github.com/awslabs/jsii.git https://spdx.org/licenses/Apache-2.0.html Amazon Web Services diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Add.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Add.cs index 6384f12c27..52e1600818 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Add.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Add.cs @@ -7,6 +7,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Add), fullyQualifiedName: "jsii-calc.Add", parametersJson: "[{\"name\":\"lhs\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}},{\"name\":\"rhs\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}]")] public class Add : BinaryOperation { + /// Creates a BinaryOperation. + /// Left-hand side operand. + /// Right-hand side operand. public Add(Value_ lhs, Value_ rhs): base(new DeputyProps(new object[]{lhs, rhs})) { } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/BinaryOperation.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/BinaryOperation.cs index 8cba22822f..a683be181e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/BinaryOperation.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/BinaryOperation.cs @@ -7,6 +7,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(BinaryOperation), fullyQualifiedName: "jsii-calc.BinaryOperation", parametersJson: "[{\"name\":\"lhs\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}},{\"name\":\"rhs\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}]")] public abstract class BinaryOperation : Operation, IIFriendly { + /// Creates a BinaryOperation. + /// Left-hand side operand. + /// Right-hand side operand. protected BinaryOperation(Value_ lhs, Value_ rhs): base(new DeputyProps(new object[]{lhs, rhs})) { } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Calculator.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Calculator.cs index 471950846a..4b35fc8783 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Calculator.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Calculator.cs @@ -9,6 +9,8 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Calculator), fullyQualifiedName: "jsii-calc.Calculator", parametersJson: "[{\"name\":\"props\",\"type\":{\"fqn\":\"jsii-calc.CalculatorProps\"},\"optional\":true}]")] public class Calculator : CompositeOperation_ { + /// Creates a Calculator object. + /// Initialization properties. public Calculator(ICalculatorProps props): base(new DeputyProps(new object[]{props})) { } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithDocs.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithDocs.cs index cf642d45a0..4cb1a27104 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithDocs.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithDocs.cs @@ -5,7 +5,6 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// This class has docs. /// /// The docs are great. They're a bunch of tags. - /// deprecated: Use something else please /// stability: Stable /// example: /// <code> diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedClass.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedClass.cs new file mode 100644 index 0000000000..b4709f9158 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedClass.cs @@ -0,0 +1,51 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Deprecated + [JsiiClass(nativeType: typeof(DeprecatedClass), fullyQualifiedName: "jsii-calc.DeprecatedClass", parametersJson: "[{\"name\":\"readonlyString\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"mutableNumber\",\"type\":{\"primitive\":\"number\"},\"optional\":true}]")] + [System.Obsolete("a pretty boring class")] + public class DeprecatedClass : DeputyBase + { + /// stability: Deprecated + [System.Obsolete("this constructor is \"just\" okay")] + public DeprecatedClass(string readonlyString, double? mutableNumber): base(new DeputyProps(new object[]{readonlyString, mutableNumber})) + { + } + + [System.Obsolete("this constructor is \"just\" okay")] + protected DeprecatedClass(ByRefValue reference): base(reference) + { + } + + [System.Obsolete("this constructor is \"just\" okay")] + protected DeprecatedClass(DeputyProps props): base(props) + { + } + + /// stability: Deprecated + [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] + [System.Obsolete("this is not always \"wazoo\", be ready to be disappointed")] + public virtual string ReadonlyProperty + { + get => GetInstanceProperty(); + } + + /// stability: Deprecated + [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] + [System.Obsolete("shouldn't have been mutable")] + public virtual double? MutableProperty + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + + /// stability: Deprecated + [JsiiMethod(name: "method")] + [System.Obsolete("it was a bad idea")] + public virtual void Method() + { + InvokeInstanceVoidMethod(new object[]{}); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedEnum.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedEnum.cs new file mode 100644 index 0000000000..f2a4472519 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedEnum.cs @@ -0,0 +1,19 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Deprecated + [JsiiEnum(nativeType: typeof(DeprecatedEnum), fullyQualifiedName: "jsii-calc.DeprecatedEnum")] + [System.Obsolete("your deprecated selection of bad options")] + public enum DeprecatedEnum + { + /// stability: Deprecated + [JsiiEnumMember(name: "OptionA")] + [System.Obsolete("option A is not great")] + OptionA, + /// stability: Deprecated + [JsiiEnumMember(name: "OptionB")] + [System.Obsolete("option B is kinda bad, too")] + OptionB + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedStruct.cs new file mode 100644 index 0000000000..50f74cb69a --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedStruct.cs @@ -0,0 +1,18 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Deprecated + [JsiiByValue] + public class DeprecatedStruct : IDeprecatedStruct + { + /// stability: Deprecated + [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}", isOverride: true)] + [System.Obsolete("well, yeah")] + public string ReadonlyProperty + { + get; + set; + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedStructProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedStructProxy.cs new file mode 100644 index 0000000000..e741342829 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedStructProxy.cs @@ -0,0 +1,22 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Deprecated + [JsiiTypeProxy(nativeType: typeof(IDeprecatedStruct), fullyQualifiedName: "jsii-calc.DeprecatedStruct")] + [System.Obsolete("it just wraps a string")] + internal sealed class DeprecatedStructProxy : DeputyBase, IDeprecatedStruct + { + private DeprecatedStructProxy(ByRefValue reference): base(reference) + { + } + + /// stability: Deprecated + [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] + [System.Obsolete("well, yeah")] + public string ReadonlyProperty + { + get => GetInstanceProperty(); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalClass.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalClass.cs new file mode 100644 index 0000000000..a652fd8761 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalClass.cs @@ -0,0 +1,44 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Experimental + [JsiiClass(nativeType: typeof(ExperimentalClass), fullyQualifiedName: "jsii-calc.ExperimentalClass", parametersJson: "[{\"name\":\"readonlyString\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"mutableNumber\",\"type\":{\"primitive\":\"number\"},\"optional\":true}]")] + public class ExperimentalClass : DeputyBase + { + /// stability: Experimental + public ExperimentalClass(string readonlyString, double? mutableNumber): base(new DeputyProps(new object[]{readonlyString, mutableNumber})) + { + } + + protected ExperimentalClass(ByRefValue reference): base(reference) + { + } + + protected ExperimentalClass(DeputyProps props): base(props) + { + } + + /// stability: Experimental + [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] + public virtual string ReadonlyProperty + { + get => GetInstanceProperty(); + } + + /// stability: Experimental + [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] + public virtual double? MutableProperty + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + + /// stability: Experimental + [JsiiMethod(name: "method")] + public virtual void Method() + { + InvokeInstanceVoidMethod(new object[]{}); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalEnum.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalEnum.cs new file mode 100644 index 0000000000..7337ef57c4 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalEnum.cs @@ -0,0 +1,16 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Experimental + [JsiiEnum(nativeType: typeof(ExperimentalEnum), fullyQualifiedName: "jsii-calc.ExperimentalEnum")] + public enum ExperimentalEnum + { + /// stability: Experimental + [JsiiEnumMember(name: "OptionA")] + OptionA, + /// stability: Experimental + [JsiiEnumMember(name: "OptionB")] + OptionB + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalStruct.cs new file mode 100644 index 0000000000..5ba3647e64 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalStruct.cs @@ -0,0 +1,17 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Experimental + [JsiiByValue] + public class ExperimentalStruct : IExperimentalStruct + { + /// stability: Experimental + [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}", isOverride: true)] + public string ReadonlyProperty + { + get; + set; + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalStructProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalStructProxy.cs new file mode 100644 index 0000000000..f38d82ecf3 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExperimentalStructProxy.cs @@ -0,0 +1,20 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Experimental + [JsiiTypeProxy(nativeType: typeof(IExperimentalStruct), fullyQualifiedName: "jsii-calc.ExperimentalStruct")] + internal sealed class ExperimentalStructProxy : DeputyBase, IExperimentalStruct + { + private ExperimentalStructProxy(ByRefValue reference): base(reference) + { + } + + /// stability: Experimental + [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] + public string ReadonlyProperty + { + get => GetInstanceProperty(); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IDeprecatedInterfaceProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IDeprecatedInterfaceProxy.cs new file mode 100644 index 0000000000..95dbe136b5 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IDeprecatedInterfaceProxy.cs @@ -0,0 +1,31 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Deprecated + [JsiiTypeProxy(nativeType: typeof(IIDeprecatedInterface), fullyQualifiedName: "jsii-calc.IDeprecatedInterface")] + [System.Obsolete("useless interface")] + internal sealed class IDeprecatedInterfaceProxy : DeputyBase, IIDeprecatedInterface + { + private IDeprecatedInterfaceProxy(ByRefValue reference): base(reference) + { + } + + /// stability: Deprecated + [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] + [System.Obsolete("could be better")] + public double? MutableProperty + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + + /// stability: Deprecated + [JsiiMethod(name: "method")] + [System.Obsolete("services no purpose")] + public void Method() + { + InvokeInstanceVoidMethod(new object[]{}); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IDeprecatedStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IDeprecatedStruct.cs new file mode 100644 index 0000000000..313d2d6755 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IDeprecatedStruct.cs @@ -0,0 +1,18 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Deprecated + [JsiiInterface(nativeType: typeof(IDeprecatedStruct), fullyQualifiedName: "jsii-calc.DeprecatedStruct")] + [System.Obsolete("it just wraps a string")] + public interface IDeprecatedStruct + { + /// stability: Deprecated + [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] + [System.Obsolete("well, yeah")] + string ReadonlyProperty + { + get; + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IExperimentalInterfaceProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IExperimentalInterfaceProxy.cs new file mode 100644 index 0000000000..591b8a49f7 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IExperimentalInterfaceProxy.cs @@ -0,0 +1,28 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Experimental + [JsiiTypeProxy(nativeType: typeof(IIExperimentalInterface), fullyQualifiedName: "jsii-calc.IExperimentalInterface")] + internal sealed class IExperimentalInterfaceProxy : DeputyBase, IIExperimentalInterface + { + private IExperimentalInterfaceProxy(ByRefValue reference): base(reference) + { + } + + /// stability: Experimental + [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] + public double? MutableProperty + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + + /// stability: Experimental + [JsiiMethod(name: "method")] + public void Method() + { + InvokeInstanceVoidMethod(new object[]{}); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IExperimentalStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IExperimentalStruct.cs new file mode 100644 index 0000000000..13dc6db4c9 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IExperimentalStruct.cs @@ -0,0 +1,16 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Experimental + [JsiiInterface(nativeType: typeof(IExperimentalStruct), fullyQualifiedName: "jsii-calc.ExperimentalStruct")] + public interface IExperimentalStruct + { + /// stability: Experimental + [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] + string ReadonlyProperty + { + get; + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIDeprecatedInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIDeprecatedInterface.cs new file mode 100644 index 0000000000..83fe6ecf8e --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIDeprecatedInterface.cs @@ -0,0 +1,24 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Deprecated + [JsiiInterface(nativeType: typeof(IIDeprecatedInterface), fullyQualifiedName: "jsii-calc.IDeprecatedInterface")] + [System.Obsolete("useless interface")] + public interface IIDeprecatedInterface + { + /// stability: Deprecated + [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] + [System.Obsolete("could be better")] + double? MutableProperty + { + get; + set; + } + + /// stability: Deprecated + [JsiiMethod(name: "method")] + [System.Obsolete("services no purpose")] + void Method(); + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIExperimentalInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIExperimentalInterface.cs new file mode 100644 index 0000000000..9c413e4d2c --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIExperimentalInterface.cs @@ -0,0 +1,21 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Experimental + [JsiiInterface(nativeType: typeof(IIExperimentalInterface), fullyQualifiedName: "jsii-calc.IExperimentalInterface")] + public interface IIExperimentalInterface + { + /// stability: Experimental + [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] + double? MutableProperty + { + get; + set; + } + + /// stability: Experimental + [JsiiMethod(name: "method")] + void Method(); + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIStableInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIStableInterface.cs new file mode 100644 index 0000000000..8667119549 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIStableInterface.cs @@ -0,0 +1,21 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Stable + [JsiiInterface(nativeType: typeof(IIStableInterface), fullyQualifiedName: "jsii-calc.IStableInterface")] + public interface IIStableInterface + { + /// stability: Stable + [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] + double? MutableProperty + { + get; + set; + } + + /// stability: Stable + [JsiiMethod(name: "method")] + void Method(); + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IStableInterfaceProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IStableInterfaceProxy.cs new file mode 100644 index 0000000000..28be3607cd --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IStableInterfaceProxy.cs @@ -0,0 +1,28 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Stable + [JsiiTypeProxy(nativeType: typeof(IIStableInterface), fullyQualifiedName: "jsii-calc.IStableInterface")] + internal sealed class IStableInterfaceProxy : DeputyBase, IIStableInterface + { + private IStableInterfaceProxy(ByRefValue reference): base(reference) + { + } + + /// stability: Stable + [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] + public double? MutableProperty + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + + /// stability: Stable + [JsiiMethod(name: "method")] + public void Method() + { + InvokeInstanceVoidMethod(new object[]{}); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IStableStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IStableStruct.cs new file mode 100644 index 0000000000..d97b6c563c --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IStableStruct.cs @@ -0,0 +1,16 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Stable + [JsiiInterface(nativeType: typeof(IStableStruct), fullyQualifiedName: "jsii-calc.StableStruct")] + public interface IStableStruct + { + /// stability: Stable + [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] + string ReadonlyProperty + { + get; + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Multiply.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Multiply.cs index 1d8db3676c..85ff70bf99 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Multiply.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Multiply.cs @@ -7,6 +7,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Multiply), fullyQualifiedName: "jsii-calc.Multiply", parametersJson: "[{\"name\":\"lhs\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}},{\"name\":\"rhs\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}]")] public class Multiply : BinaryOperation, IIFriendlier, IIRandomNumberGenerator { + /// Creates a BinaryOperation. + /// Left-hand side operand. + /// Right-hand side operand. public Multiply(Value_ lhs, Value_ rhs): base(new DeputyProps(new object[]{lhs, rhs})) { } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Old.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Old.cs index 3391b74a7f..4c51606c61 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Old.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Old.cs @@ -3,8 +3,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Old class. - /// deprecated: Use the new class + /// stability: Deprecated [JsiiClass(nativeType: typeof(Old), fullyQualifiedName: "jsii-calc.Old")] + [System.Obsolete("Use the new class")] public class Old : DeputyBase { public Old(): base(new DeputyProps(new object[]{})) diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Power.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Power.cs index 70182dc48b..40f833dc1e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Power.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Power.cs @@ -8,6 +8,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Power), fullyQualifiedName: "jsii-calc.Power", parametersJson: "[{\"name\":\"base\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}},{\"name\":\"pow\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}]")] public class Power : CompositeOperation_ { + /// Creates a Power operation. + /// The base of the power. + /// The number of times to multiply. public Power(Value_ @base, Value_ pow): base(new DeputyProps(new object[]{@base, pow})) { } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableClass.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableClass.cs new file mode 100644 index 0000000000..21d94ee115 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableClass.cs @@ -0,0 +1,44 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Stable + [JsiiClass(nativeType: typeof(StableClass), fullyQualifiedName: "jsii-calc.StableClass", parametersJson: "[{\"name\":\"readonlyString\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"mutableNumber\",\"type\":{\"primitive\":\"number\"},\"optional\":true}]")] + public class StableClass : DeputyBase + { + /// stability: Stable + public StableClass(string readonlyString, double? mutableNumber): base(new DeputyProps(new object[]{readonlyString, mutableNumber})) + { + } + + protected StableClass(ByRefValue reference): base(reference) + { + } + + protected StableClass(DeputyProps props): base(props) + { + } + + /// stability: Stable + [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] + public virtual string ReadonlyProperty + { + get => GetInstanceProperty(); + } + + /// stability: Stable + [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] + public virtual double? MutableProperty + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + + /// stability: Stable + [JsiiMethod(name: "method")] + public virtual void Method() + { + InvokeInstanceVoidMethod(new object[]{}); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableEnum.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableEnum.cs new file mode 100644 index 0000000000..3e84219846 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableEnum.cs @@ -0,0 +1,16 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Stable + [JsiiEnum(nativeType: typeof(StableEnum), fullyQualifiedName: "jsii-calc.StableEnum")] + public enum StableEnum + { + /// stability: Stable + [JsiiEnumMember(name: "OptionA")] + OptionA, + /// stability: Stable + [JsiiEnumMember(name: "OptionB")] + OptionB + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableStruct.cs new file mode 100644 index 0000000000..0be21631b1 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableStruct.cs @@ -0,0 +1,17 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Stable + [JsiiByValue] + public class StableStruct : IStableStruct + { + /// stability: Stable + [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}", isOverride: true)] + public string ReadonlyProperty + { + get; + set; + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableStructProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableStructProxy.cs new file mode 100644 index 0000000000..b3144aec53 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableStructProxy.cs @@ -0,0 +1,20 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// stability: Stable + [JsiiTypeProxy(nativeType: typeof(IStableStruct), fullyQualifiedName: "jsii-calc.StableStruct")] + internal sealed class StableStructProxy : DeputyBase, IStableStruct + { + private StableStructProxy(ByRefValue reference): base(reference) + { + } + + /// stability: Stable + [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] + public string ReadonlyProperty + { + get => GetInstanceProperty(); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/VariadicMethod.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/VariadicMethod.cs index fa02b7e62b..b261f906f1 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/VariadicMethod.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/VariadicMethod.cs @@ -5,6 +5,7 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(VariadicMethod), fullyQualifiedName: "jsii-calc.VariadicMethod", parametersJson: "[{\"name\":\"prefix\",\"variadic\":true,\"type\":{\"primitive\":\"number\"}}]")] public class VariadicMethod : DeputyBase { + /// a prefix that will be use for all values returned by `#asArray`. public VariadicMethod(double prefix): base(new DeputyProps(new object[]{prefix})) { } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/pom.xml b/packages/jsii-pacmak/test/expected.jsii-calc/java/pom.xml index 29b657829b..839fcfd5e1 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/pom.xml +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/pom.xml @@ -134,6 +134,9 @@ false protected + + **/$Module.java + -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java index 0156239c12..460fede183 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java @@ -39,6 +39,9 @@ protected Class resolveClass(final String fqn) throws ClassNotFoundException case "jsii-calc.Constructors": return software.amazon.jsii.tests.calculator.Constructors.class; case "jsii-calc.ConsumersOfThisCrazyTypeSystem": return software.amazon.jsii.tests.calculator.ConsumersOfThisCrazyTypeSystem.class; case "jsii-calc.DefaultedConstructorArgument": return software.amazon.jsii.tests.calculator.DefaultedConstructorArgument.class; + case "jsii-calc.DeprecatedClass": return software.amazon.jsii.tests.calculator.DeprecatedClass.class; + case "jsii-calc.DeprecatedEnum": return software.amazon.jsii.tests.calculator.DeprecatedEnum.class; + case "jsii-calc.DeprecatedStruct": return software.amazon.jsii.tests.calculator.DeprecatedStruct.class; case "jsii-calc.DerivedClassHasNoProperties.Base": return software.amazon.jsii.tests.calculator.DerivedClassHasNoProperties.Base.class; case "jsii-calc.DerivedClassHasNoProperties.Derived": return software.amazon.jsii.tests.calculator.DerivedClassHasNoProperties.Derived.class; case "jsii-calc.DerivedStruct": return software.amazon.jsii.tests.calculator.DerivedStruct.class; @@ -49,12 +52,17 @@ protected Class resolveClass(final String fqn) throws ClassNotFoundException case "jsii-calc.DoubleTrouble": return software.amazon.jsii.tests.calculator.DoubleTrouble.class; case "jsii-calc.EraseUndefinedHashValues": return software.amazon.jsii.tests.calculator.EraseUndefinedHashValues.class; case "jsii-calc.EraseUndefinedHashValuesOptions": return software.amazon.jsii.tests.calculator.EraseUndefinedHashValuesOptions.class; + case "jsii-calc.ExperimentalClass": return software.amazon.jsii.tests.calculator.ExperimentalClass.class; + case "jsii-calc.ExperimentalEnum": return software.amazon.jsii.tests.calculator.ExperimentalEnum.class; + case "jsii-calc.ExperimentalStruct": return software.amazon.jsii.tests.calculator.ExperimentalStruct.class; case "jsii-calc.ExportedBaseClass": return software.amazon.jsii.tests.calculator.ExportedBaseClass.class; case "jsii-calc.ExtendsInternalInterface": return software.amazon.jsii.tests.calculator.ExtendsInternalInterface.class; case "jsii-calc.GiveMeStructs": return software.amazon.jsii.tests.calculator.GiveMeStructs.class; case "jsii-calc.Greetee": return software.amazon.jsii.tests.calculator.Greetee.class; case "jsii-calc.GreetingAugmenter": return software.amazon.jsii.tests.calculator.GreetingAugmenter.class; case "jsii-calc.IAnotherPublicInterface": return software.amazon.jsii.tests.calculator.IAnotherPublicInterface.class; + case "jsii-calc.IDeprecatedInterface": return software.amazon.jsii.tests.calculator.IDeprecatedInterface.class; + case "jsii-calc.IExperimentalInterface": return software.amazon.jsii.tests.calculator.IExperimentalInterface.class; case "jsii-calc.IExtendsPrivateInterface": return software.amazon.jsii.tests.calculator.IExtendsPrivateInterface.class; case "jsii-calc.IFriendlier": return software.amazon.jsii.tests.calculator.IFriendlier.class; case "jsii-calc.IFriendlyRandomGenerator": return software.amazon.jsii.tests.calculator.IFriendlyRandomGenerator.class; @@ -77,6 +85,7 @@ protected Class resolveClass(final String fqn) throws ClassNotFoundException case "jsii-calc.IPublicInterface2": return software.amazon.jsii.tests.calculator.IPublicInterface2.class; case "jsii-calc.IRandomNumberGenerator": return software.amazon.jsii.tests.calculator.IRandomNumberGenerator.class; case "jsii-calc.IReturnsNumber": return software.amazon.jsii.tests.calculator.IReturnsNumber.class; + case "jsii-calc.IStableInterface": return software.amazon.jsii.tests.calculator.IStableInterface.class; case "jsii-calc.ImplementInternalInterface": return software.amazon.jsii.tests.calculator.ImplementInternalInterface.class; case "jsii-calc.ImplementsInterfaceWithInternal": return software.amazon.jsii.tests.calculator.ImplementsInterfaceWithInternal.class; case "jsii-calc.ImplementsInterfaceWithInternalSubclass": return software.amazon.jsii.tests.calculator.ImplementsInterfaceWithInternalSubclass.class; @@ -117,6 +126,9 @@ protected Class resolveClass(final String fqn) throws ClassNotFoundException case "jsii-calc.ReturnsPrivateImplementationOfInterface": return software.amazon.jsii.tests.calculator.ReturnsPrivateImplementationOfInterface.class; case "jsii-calc.RuntimeTypeChecking": return software.amazon.jsii.tests.calculator.RuntimeTypeChecking.class; case "jsii-calc.SingleInstanceTwoTypes": return software.amazon.jsii.tests.calculator.SingleInstanceTwoTypes.class; + case "jsii-calc.StableClass": return software.amazon.jsii.tests.calculator.StableClass.class; + case "jsii-calc.StableEnum": return software.amazon.jsii.tests.calculator.StableEnum.class; + case "jsii-calc.StableStruct": return software.amazon.jsii.tests.calculator.StableStruct.class; case "jsii-calc.StaticContext": return software.amazon.jsii.tests.calculator.StaticContext.class; case "jsii-calc.Statics": return software.amazon.jsii.tests.calculator.Statics.class; case "jsii-calc.StringEnum": return software.amazon.jsii.tests.calculator.StringEnum.class; diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ClassWithDocs.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ClassWithDocs.java index 49ccc00648..154b3eef9e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ClassWithDocs.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ClassWithDocs.java @@ -11,9 +11,9 @@ * } * * @see https://aws.amazon.com/ - * @deprecated Use something else please */ @javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.ClassWithDocs") public class ClassWithDocs extends software.amazon.jsii.JsiiObject { protected ClassWithDocs(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DeprecatedClass.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DeprecatedClass.java new file mode 100644 index 0000000000..c51dca701b --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DeprecatedClass.java @@ -0,0 +1,69 @@ +package software.amazon.jsii.tests.calculator; + +/** + * @deprecated a pretty boring class + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@Deprecated +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.DeprecatedClass") +public class DeprecatedClass extends software.amazon.jsii.JsiiObject { + protected DeprecatedClass(final software.amazon.jsii.JsiiObject.InitializationMode mode) { + super(mode); + } + /** + * @deprecated this constructor is "just" okay + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + public DeprecatedClass(final java.lang.String readonlyString, @javax.annotation.Nullable final java.lang.Number mutableNumber) { + super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); + software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(readonlyString, "readonlyString is required"), mutableNumber }); + } + /** + * @deprecated this constructor is "just" okay + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + public DeprecatedClass(final java.lang.String readonlyString) { + super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); + software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(readonlyString, "readonlyString is required") }); + } + + /** + * @deprecated it was a bad idea + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + public void method() { + this.jsiiCall("method", Void.class); + } + + /** + * @deprecated this is not always "wazoo", be ready to be disappointed + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + public java.lang.String getReadonlyProperty() { + return this.jsiiGet("readonlyProperty", java.lang.String.class); + } + + /** + * @deprecated shouldn't have been mutable + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + @javax.annotation.Nullable + public java.lang.Number getMutableProperty() { + return this.jsiiGet("mutableProperty", java.lang.Number.class); + } + + /** + * @deprecated shouldn't have been mutable + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + public void setMutableProperty(@javax.annotation.Nullable final java.lang.Number value) { + this.jsiiSet("mutableProperty", value); + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DeprecatedEnum.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DeprecatedEnum.java new file mode 100644 index 0000000000..2200438388 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DeprecatedEnum.java @@ -0,0 +1,23 @@ +package software.amazon.jsii.tests.calculator; + +/** + * @deprecated your deprecated selection of bad options + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@Deprecated +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.DeprecatedEnum") +public enum DeprecatedEnum { + /** + * @deprecated option A is not great + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + OptionA, + /** + * @deprecated option B is kinda bad, too + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + OptionB, +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DeprecatedStruct.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DeprecatedStruct.java new file mode 100644 index 0000000000..2a5a1876d6 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DeprecatedStruct.java @@ -0,0 +1,92 @@ +package software.amazon.jsii.tests.calculator; + +/** + * @deprecated it just wraps a string + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@Deprecated +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) +public interface DeprecatedStruct extends software.amazon.jsii.JsiiSerializable { + /** + * @deprecated well, yeah + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + java.lang.String getReadonlyProperty(); + + /** + * @return a {@link Builder} of {@link DeprecatedStruct} + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + static Builder builder() { + return new Builder(); + } + + /** + * A builder for {@link DeprecatedStruct} + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + final class Builder { + private java.lang.String _readonlyProperty; + + /** + * Sets the value of ReadonlyProperty + * @param value the value to be set + * @return {@code this} + * @deprecated well, yeah + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + public Builder withReadonlyProperty(final java.lang.String value) { + this._readonlyProperty = java.util.Objects.requireNonNull(value, "readonlyProperty is required"); + return this; + } + + /** + * Builds the configured instance. + * @return a new instance of {@link DeprecatedStruct} + * @throws NullPointerException if any required attribute was not provided + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + public DeprecatedStruct build() { + return new DeprecatedStruct() { + private final java.lang.String $readonlyProperty = java.util.Objects.requireNonNull(_readonlyProperty, "readonlyProperty is required"); + + @Override + public java.lang.String getReadonlyProperty() { + return this.$readonlyProperty; + } + + public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() { + com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE; + com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + obj.set("readonlyProperty", om.valueToTree(this.getReadonlyProperty())); + return obj; + } + + }; + } + } + + /** + * A proxy class which represents a concrete javascript instance of this type. + */ + final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.DeprecatedStruct { + protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { + super(mode); + } + + /** + * @deprecated well, yeah + */ + @Override + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + public java.lang.String getReadonlyProperty() { + return this.jsiiGet("readonlyProperty", java.lang.String.class); + } + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DocumentedClass.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DocumentedClass.java index 53beff9d07..37051fa214 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DocumentedClass.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DocumentedClass.java @@ -9,6 +9,7 @@ * Multiple paragraphs are separated by an empty line. */ @javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.DocumentedClass") public class DocumentedClass extends software.amazon.jsii.JsiiObject { protected DocumentedClass(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -49,6 +50,7 @@ public java.lang.Number greet() { * * EXPERIMENTAL */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public void hola() { this.jsiiCall("hola", Void.class); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ExperimentalClass.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ExperimentalClass.java new file mode 100644 index 0000000000..62c5982e37 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ExperimentalClass.java @@ -0,0 +1,62 @@ +package software.amazon.jsii.tests.calculator; + +/** + * EXPERIMENTAL + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.ExperimentalClass") +public class ExperimentalClass extends software.amazon.jsii.JsiiObject { + protected ExperimentalClass(final software.amazon.jsii.JsiiObject.InitializationMode mode) { + super(mode); + } + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public ExperimentalClass(final java.lang.String readonlyString, @javax.annotation.Nullable final java.lang.Number mutableNumber) { + super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); + software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(readonlyString, "readonlyString is required"), mutableNumber }); + } + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public ExperimentalClass(final java.lang.String readonlyString) { + super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); + software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(readonlyString, "readonlyString is required") }); + } + + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public void method() { + this.jsiiCall("method", Void.class); + } + + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public java.lang.String getReadonlyProperty() { + return this.jsiiGet("readonlyProperty", java.lang.String.class); + } + + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + @javax.annotation.Nullable + public java.lang.Number getMutableProperty() { + return this.jsiiGet("mutableProperty", java.lang.Number.class); + } + + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public void setMutableProperty(@javax.annotation.Nullable final java.lang.Number value) { + this.jsiiSet("mutableProperty", value); + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ExperimentalEnum.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ExperimentalEnum.java new file mode 100644 index 0000000000..068e43779e --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ExperimentalEnum.java @@ -0,0 +1,20 @@ +package software.amazon.jsii.tests.calculator; + +/** + * EXPERIMENTAL + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.ExperimentalEnum") +public enum ExperimentalEnum { + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + OptionA, + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + OptionB, +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ExperimentalStruct.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ExperimentalStruct.java new file mode 100644 index 0000000000..0831739468 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ExperimentalStruct.java @@ -0,0 +1,84 @@ +package software.amazon.jsii.tests.calculator; + +/** + * EXPERIMENTAL + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) +public interface ExperimentalStruct extends software.amazon.jsii.JsiiSerializable { + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + java.lang.String getReadonlyProperty(); + + /** + * @return a {@link Builder} of {@link ExperimentalStruct} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + static Builder builder() { + return new Builder(); + } + + /** + * A builder for {@link ExperimentalStruct} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + final class Builder { + private java.lang.String _readonlyProperty; + + /** + * Sets the value of ReadonlyProperty + * @param value the value to be set + * @return {@code this} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public Builder withReadonlyProperty(final java.lang.String value) { + this._readonlyProperty = java.util.Objects.requireNonNull(value, "readonlyProperty is required"); + return this; + } + + /** + * Builds the configured instance. + * @return a new instance of {@link ExperimentalStruct} + * @throws NullPointerException if any required attribute was not provided + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public ExperimentalStruct build() { + return new ExperimentalStruct() { + private final java.lang.String $readonlyProperty = java.util.Objects.requireNonNull(_readonlyProperty, "readonlyProperty is required"); + + @Override + public java.lang.String getReadonlyProperty() { + return this.$readonlyProperty; + } + + public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() { + com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE; + com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + obj.set("readonlyProperty", om.valueToTree(this.getReadonlyProperty())); + return obj; + } + + }; + } + } + + /** + * A proxy class which represents a concrete javascript instance of this type. + */ + final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.ExperimentalStruct { + protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { + super(mode); + } + + /** + * EXPERIMENTAL + */ + @Override + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public java.lang.String getReadonlyProperty() { + return this.jsiiGet("readonlyProperty", java.lang.String.class); + } + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IDeprecatedInterface.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IDeprecatedInterface.java new file mode 100644 index 0000000000..0ce4d4b6bc --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IDeprecatedInterface.java @@ -0,0 +1,66 @@ +package software.amazon.jsii.tests.calculator; + +/** + * @deprecated useless interface + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@Deprecated +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) +public interface IDeprecatedInterface extends software.amazon.jsii.JsiiSerializable { + /** + * @deprecated could be better + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + java.lang.Number getMutableProperty(); + /** + * @deprecated could be better + */ + void setMutableProperty(final java.lang.Number value); + /** + * @deprecated services no purpose + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + void method(); + + /** + * A proxy class which represents a concrete javascript instance of this type. + */ + final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IDeprecatedInterface { + protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { + super(mode); + } + + /** + * @deprecated could be better + */ + @Override + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + @javax.annotation.Nullable + public java.lang.Number getMutableProperty() { + return this.jsiiGet("mutableProperty", java.lang.Number.class); + } + + /** + * @deprecated could be better + */ + @Override + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + public void setMutableProperty(@javax.annotation.Nullable final java.lang.Number value) { + this.jsiiSet("mutableProperty", value); + } + + /** + * @deprecated services no purpose + */ + @Deprecated + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + @Override + public void method() { + this.jsiiCall("method", Void.class); + } + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IExperimentalInterface.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IExperimentalInterface.java new file mode 100644 index 0000000000..9b5e377dc5 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IExperimentalInterface.java @@ -0,0 +1,60 @@ +package software.amazon.jsii.tests.calculator; + +/** + * EXPERIMENTAL + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) +public interface IExperimentalInterface extends software.amazon.jsii.JsiiSerializable { + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + java.lang.Number getMutableProperty(); + /** + * EXPERIMENTAL + */ + void setMutableProperty(final java.lang.Number value); + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + void method(); + + /** + * A proxy class which represents a concrete javascript instance of this type. + */ + final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IExperimentalInterface { + protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { + super(mode); + } + + /** + * EXPERIMENTAL + */ + @Override + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + @javax.annotation.Nullable + public java.lang.Number getMutableProperty() { + return this.jsiiGet("mutableProperty", java.lang.Number.class); + } + + /** + * EXPERIMENTAL + */ + @Override + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public void setMutableProperty(@javax.annotation.Nullable final java.lang.Number value) { + this.jsiiSet("mutableProperty", value); + } + + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + @Override + public void method() { + this.jsiiCall("method", Void.class); + } + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IStableInterface.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IStableInterface.java new file mode 100644 index 0000000000..d83bb9d5d1 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IStableInterface.java @@ -0,0 +1,53 @@ +package software.amazon.jsii.tests.calculator; + +/** + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) +public interface IStableInterface extends software.amazon.jsii.JsiiSerializable { + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + java.lang.Number getMutableProperty(); + /** + */ + void setMutableProperty(final java.lang.Number value); + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + void method(); + + /** + * A proxy class which represents a concrete javascript instance of this type. + */ + final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IStableInterface { + protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { + super(mode); + } + + /** + */ + @Override + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @javax.annotation.Nullable + public java.lang.Number getMutableProperty() { + return this.jsiiGet("mutableProperty", java.lang.Number.class); + } + + /** + */ + @Override + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public void setMutableProperty(@javax.annotation.Nullable final java.lang.Number value) { + this.jsiiSet("mutableProperty", value); + } + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @Override + public void method() { + this.jsiiCall("method", Void.class); + } + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Old.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Old.java index 5d3a042dc0..85a4d6fe82 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Old.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Old.java @@ -6,6 +6,8 @@ * @deprecated Use the new class */ @javax.annotation.Generated(value = "jsii-pacmak") +@Deprecated +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.Old") public class Old extends software.amazon.jsii.JsiiObject { protected Old(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StableClass.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StableClass.java new file mode 100644 index 0000000000..d45dd01205 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StableClass.java @@ -0,0 +1,55 @@ +package software.amazon.jsii.tests.calculator; + +/** + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.StableClass") +public class StableClass extends software.amazon.jsii.JsiiObject { + protected StableClass(final software.amazon.jsii.JsiiObject.InitializationMode mode) { + super(mode); + } + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public StableClass(final java.lang.String readonlyString, @javax.annotation.Nullable final java.lang.Number mutableNumber) { + super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); + software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(readonlyString, "readonlyString is required"), mutableNumber }); + } + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public StableClass(final java.lang.String readonlyString) { + super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); + software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(readonlyString, "readonlyString is required") }); + } + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public void method() { + this.jsiiCall("method", Void.class); + } + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public java.lang.String getReadonlyProperty() { + return this.jsiiGet("readonlyProperty", java.lang.String.class); + } + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @javax.annotation.Nullable + public java.lang.Number getMutableProperty() { + return this.jsiiGet("mutableProperty", java.lang.Number.class); + } + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public void setMutableProperty(@javax.annotation.Nullable final java.lang.Number value) { + this.jsiiSet("mutableProperty", value); + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StableEnum.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StableEnum.java new file mode 100644 index 0000000000..a150455ab7 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StableEnum.java @@ -0,0 +1,17 @@ +package software.amazon.jsii.tests.calculator; + +/** + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.StableEnum") +public enum StableEnum { + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + OptionA, + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + OptionB, +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StableStruct.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StableStruct.java new file mode 100644 index 0000000000..96642436cb --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StableStruct.java @@ -0,0 +1,81 @@ +package software.amazon.jsii.tests.calculator; + +/** + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) +public interface StableStruct extends software.amazon.jsii.JsiiSerializable { + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + java.lang.String getReadonlyProperty(); + + /** + * @return a {@link Builder} of {@link StableStruct} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + static Builder builder() { + return new Builder(); + } + + /** + * A builder for {@link StableStruct} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + final class Builder { + private java.lang.String _readonlyProperty; + + /** + * Sets the value of ReadonlyProperty + * @param value the value to be set + * @return {@code this} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public Builder withReadonlyProperty(final java.lang.String value) { + this._readonlyProperty = java.util.Objects.requireNonNull(value, "readonlyProperty is required"); + return this; + } + + /** + * Builds the configured instance. + * @return a new instance of {@link StableStruct} + * @throws NullPointerException if any required attribute was not provided + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public StableStruct build() { + return new StableStruct() { + private final java.lang.String $readonlyProperty = java.util.Objects.requireNonNull(_readonlyProperty, "readonlyProperty is required"); + + @Override + public java.lang.String getReadonlyProperty() { + return this.$readonlyProperty; + } + + public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() { + com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE; + com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + obj.set("readonlyProperty", om.valueToTree(this.getReadonlyProperty())); + return obj; + } + + }; + } + } + + /** + * A proxy class which represents a concrete javascript instance of this type. + */ + final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.StableStruct { + protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { + super(mode); + } + + /** + */ + @Override + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public java.lang.String getReadonlyProperty() { + return this.jsiiGet("readonlyProperty", java.lang.String.class); + } + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/package-info.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/package-info.java new file mode 100644 index 0000000000..971596537b --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/package-info.java @@ -0,0 +1,12 @@ +/** + *

jsii Calculator

+ *

This library is used to demonstrate and test the features of JSII

+ *

Sphinx

+ *

This file will be incorporated into the sphinx documentation.

+ *

If this file starts with an "H1" line (in our case # jsii Calculator), this + * heading will be used as the Sphinx topic name. Otherwise, the name of the module + * (jsii-calc) will be used instead.

+ * + */ +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) +package software.amazon.jsii.tests.calculator; diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py b/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py index cc3a369245..24ae61c06d 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py +++ b/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py @@ -424,11 +424,10 @@ class ClassWithDocs(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ClassWithDocs" The docs are great. They're a bunch of tags. - Deprecated: - Use something else please - See: https://aws.amazon.com/ + Stability: + stable customAttribute: hasAValue @@ -550,6 +549,112 @@ def arg2(self) -> typing.Optional[str]: return jsii.get(self, "arg2") +class DeprecatedClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DeprecatedClass"): + """ + Deprecated: + a pretty boring class + + Stability: + deprecated + """ + def __init__(self, readonly_string: str, mutable_number: typing.Optional[jsii.Number]=None) -> None: + """ + Arguments: + readonlyString: - + mutableNumber: - + + Deprecated: + this constructor is "just" okay + + Stability: + deprecated + """ + jsii.create(DeprecatedClass, self, [readonly_string, mutable_number]) + + @jsii.member(jsii_name="method") + def method(self) -> None: + """ + Deprecated: + it was a bad idea + + Stability: + deprecated + """ + return jsii.invoke(self, "method", []) + + @property + @jsii.member(jsii_name="readonlyProperty") + def readonly_property(self) -> str: + """ + Deprecated: + this is not always "wazoo", be ready to be disappointed + + Stability: + deprecated + """ + return jsii.get(self, "readonlyProperty") + + @property + @jsii.member(jsii_name="mutableProperty") + def mutable_property(self) -> typing.Optional[jsii.Number]: + """ + Deprecated: + shouldn't have been mutable + + Stability: + deprecated + """ + return jsii.get(self, "mutableProperty") + + @mutable_property.setter + def mutable_property(self, value: typing.Optional[jsii.Number]): + return jsii.set(self, "mutableProperty", value) + + +@jsii.enum(jsii_type="jsii-calc.DeprecatedEnum") +class DeprecatedEnum(enum.Enum): + """ + Deprecated: + your deprecated selection of bad options + + Stability: + deprecated + """ + OptionA = "OptionA" + """ + Deprecated: + option A is not great + + Stability: + deprecated + """ + OptionB = "OptionB" + """ + Deprecated: + option B is kinda bad, too + + Stability: + deprecated + """ + +@jsii.data_type(jsii_type="jsii-calc.DeprecatedStruct", jsii_struct_bases=[]) +class DeprecatedStruct(jsii.compat.TypedDict): + """ + Deprecated: + it just wraps a string + + Stability: + deprecated + """ + readonlyProperty: str + """ + Deprecated: + well, yeah + + Stability: + deprecated + """ + class DerivedClassHasNoProperties: class Base(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DerivedClassHasNoProperties.Base"): def __init__(self) -> None: @@ -632,6 +737,9 @@ class DocumentedClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.DocumentedCl multiple lines and multiple paragraphs. Multiple paragraphs are separated by an empty line. + + Stability: + stable """ def __init__(self) -> None: jsii.create(DocumentedClass, self, []) @@ -718,6 +826,82 @@ class EraseUndefinedHashValuesOptions(jsii.compat.TypedDict, total=False): option2: str +class ExperimentalClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ExperimentalClass"): + """ + Stability: + experimental + """ + def __init__(self, readonly_string: str, mutable_number: typing.Optional[jsii.Number]=None) -> None: + """ + Arguments: + readonlyString: - + mutableNumber: - + + Stability: + experimental + """ + jsii.create(ExperimentalClass, self, [readonly_string, mutable_number]) + + @jsii.member(jsii_name="method") + def method(self) -> None: + """ + Stability: + experimental + """ + return jsii.invoke(self, "method", []) + + @property + @jsii.member(jsii_name="readonlyProperty") + def readonly_property(self) -> str: + """ + Stability: + experimental + """ + return jsii.get(self, "readonlyProperty") + + @property + @jsii.member(jsii_name="mutableProperty") + def mutable_property(self) -> typing.Optional[jsii.Number]: + """ + Stability: + experimental + """ + return jsii.get(self, "mutableProperty") + + @mutable_property.setter + def mutable_property(self, value: typing.Optional[jsii.Number]): + return jsii.set(self, "mutableProperty", value) + + +@jsii.enum(jsii_type="jsii-calc.ExperimentalEnum") +class ExperimentalEnum(enum.Enum): + """ + Stability: + experimental + """ + OptionA = "OptionA" + """ + Stability: + experimental + """ + OptionB = "OptionB" + """ + Stability: + experimental + """ + +@jsii.data_type(jsii_type="jsii-calc.ExperimentalStruct", jsii_struct_bases=[]) +class ExperimentalStruct(jsii.compat.TypedDict): + """ + Stability: + experimental + """ + readonlyProperty: str + """ + Stability: + experimental + """ + class ExportedBaseClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ExportedBaseClass"): def __init__(self, success: bool) -> None: """ @@ -880,6 +1064,144 @@ def a(self, value: str): return jsii.set(self, "a", value) +@jsii.interface(jsii_type="jsii-calc.IDeprecatedInterface") +class IDeprecatedInterface(jsii.compat.Protocol): + """ + Deprecated: + useless interface + + Stability: + deprecated + """ + @staticmethod + def __jsii_proxy_class__(): + return _IDeprecatedInterfaceProxy + + @property + @jsii.member(jsii_name="mutableProperty") + def mutable_property(self) -> typing.Optional[jsii.Number]: + """ + Deprecated: + could be better + + Stability: + deprecated + """ + ... + + @mutable_property.setter + def mutable_property(self, value: typing.Optional[jsii.Number]): + ... + + @jsii.member(jsii_name="method") + def method(self) -> None: + """ + Deprecated: + services no purpose + + Stability: + deprecated + """ + ... + + +class _IDeprecatedInterfaceProxy(): + """ + Deprecated: + useless interface + + Stability: + deprecated + """ + __jsii_type__ = "jsii-calc.IDeprecatedInterface" + @property + @jsii.member(jsii_name="mutableProperty") + def mutable_property(self) -> typing.Optional[jsii.Number]: + """ + Deprecated: + could be better + + Stability: + deprecated + """ + return jsii.get(self, "mutableProperty") + + @mutable_property.setter + def mutable_property(self, value: typing.Optional[jsii.Number]): + return jsii.set(self, "mutableProperty", value) + + @jsii.member(jsii_name="method") + def method(self) -> None: + """ + Deprecated: + services no purpose + + Stability: + deprecated + """ + return jsii.invoke(self, "method", []) + + +@jsii.interface(jsii_type="jsii-calc.IExperimentalInterface") +class IExperimentalInterface(jsii.compat.Protocol): + """ + Stability: + experimental + """ + @staticmethod + def __jsii_proxy_class__(): + return _IExperimentalInterfaceProxy + + @property + @jsii.member(jsii_name="mutableProperty") + def mutable_property(self) -> typing.Optional[jsii.Number]: + """ + Stability: + experimental + """ + ... + + @mutable_property.setter + def mutable_property(self, value: typing.Optional[jsii.Number]): + ... + + @jsii.member(jsii_name="method") + def method(self) -> None: + """ + Stability: + experimental + """ + ... + + +class _IExperimentalInterfaceProxy(): + """ + Stability: + experimental + """ + __jsii_type__ = "jsii-calc.IExperimentalInterface" + @property + @jsii.member(jsii_name="mutableProperty") + def mutable_property(self) -> typing.Optional[jsii.Number]: + """ + Stability: + experimental + """ + return jsii.get(self, "mutableProperty") + + @mutable_property.setter + def mutable_property(self, value: typing.Optional[jsii.Number]): + return jsii.set(self, "mutableProperty", value) + + @jsii.member(jsii_name="method") + def method(self) -> None: + """ + Stability: + experimental + """ + return jsii.invoke(self, "method", []) + + @jsii.interface(jsii_type="jsii-calc.IExtendsPrivateInterface") class IExtendsPrivateInterface(jsii.compat.Protocol): @staticmethod @@ -1610,6 +1932,66 @@ def obtain_number(self) -> scope.jsii_calc_lib.IDoublable: return jsii.invoke(self, "obtainNumber", []) +@jsii.interface(jsii_type="jsii-calc.IStableInterface") +class IStableInterface(jsii.compat.Protocol): + """ + Stability: + stable + """ + @staticmethod + def __jsii_proxy_class__(): + return _IStableInterfaceProxy + + @property + @jsii.member(jsii_name="mutableProperty") + def mutable_property(self) -> typing.Optional[jsii.Number]: + """ + Stability: + stable + """ + ... + + @mutable_property.setter + def mutable_property(self, value: typing.Optional[jsii.Number]): + ... + + @jsii.member(jsii_name="method") + def method(self) -> None: + """ + Stability: + stable + """ + ... + + +class _IStableInterfaceProxy(): + """ + Stability: + stable + """ + __jsii_type__ = "jsii-calc.IStableInterface" + @property + @jsii.member(jsii_name="mutableProperty") + def mutable_property(self) -> typing.Optional[jsii.Number]: + """ + Stability: + stable + """ + return jsii.get(self, "mutableProperty") + + @mutable_property.setter + def mutable_property(self, value: typing.Optional[jsii.Number]): + return jsii.set(self, "mutableProperty", value) + + @jsii.member(jsii_name="method") + def method(self) -> None: + """ + Stability: + stable + """ + return jsii.invoke(self, "method", []) + + class ImplementInternalInterface(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ImplementInternalInterface"): def __init__(self) -> None: jsii.create(ImplementInternalInterface, self, []) @@ -2265,6 +2647,9 @@ class Old(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Old"): Deprecated: Use the new class + + Stability: + deprecated """ def __init__(self) -> None: jsii.create(Old, self, []) @@ -2638,6 +3023,82 @@ def interface2(self) -> "IPublicInterface": return jsii.invoke(self, "interface2", []) +class StableClass(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.StableClass"): + """ + Stability: + stable + """ + def __init__(self, readonly_string: str, mutable_number: typing.Optional[jsii.Number]=None) -> None: + """ + Arguments: + readonlyString: - + mutableNumber: - + + Stability: + stable + """ + jsii.create(StableClass, self, [readonly_string, mutable_number]) + + @jsii.member(jsii_name="method") + def method(self) -> None: + """ + Stability: + stable + """ + return jsii.invoke(self, "method", []) + + @property + @jsii.member(jsii_name="readonlyProperty") + def readonly_property(self) -> str: + """ + Stability: + stable + """ + return jsii.get(self, "readonlyProperty") + + @property + @jsii.member(jsii_name="mutableProperty") + def mutable_property(self) -> typing.Optional[jsii.Number]: + """ + Stability: + stable + """ + return jsii.get(self, "mutableProperty") + + @mutable_property.setter + def mutable_property(self, value: typing.Optional[jsii.Number]): + return jsii.set(self, "mutableProperty", value) + + +@jsii.enum(jsii_type="jsii-calc.StableEnum") +class StableEnum(enum.Enum): + """ + Stability: + stable + """ + OptionA = "OptionA" + """ + Stability: + stable + """ + OptionB = "OptionB" + """ + Stability: + stable + """ + +@jsii.data_type(jsii_type="jsii-calc.StableStruct", jsii_struct_bases=[]) +class StableStruct(jsii.compat.TypedDict): + """ + Stability: + stable + """ + readonlyProperty: str + """ + Stability: + stable + """ + class StaticContext(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.StaticContext"): """This is used to validate the ability to use ``this`` from within a static context. @@ -3320,6 +3781,6 @@ def parts(self, value: typing.List[scope.jsii_calc_lib.Value]): return jsii.set(self, "parts", value) -__all__ = ["AbstractClass", "AbstractClassBase", "AbstractClassReturner", "Add", "AllTypes", "AllTypesEnum", "AllowedMethodNames", "AsyncVirtualMethods", "AugmentableClass", "BinaryOperation", "Calculator", "CalculatorProps", "ClassThatImplementsTheInternalInterface", "ClassThatImplementsThePrivateInterface", "ClassWithDocs", "ClassWithMutableObjectLiteralProperty", "ClassWithPrivateConstructorAndAutomaticProperties", "ConstructorPassesThisOut", "Constructors", "ConsumersOfThisCrazyTypeSystem", "DefaultedConstructorArgument", "DerivedClassHasNoProperties", "DerivedStruct", "DoNotOverridePrivates", "DoNotRecognizeAnyAsOptional", "DocumentedClass", "DontComplainAboutVariadicAfterOptional", "DoubleTrouble", "EraseUndefinedHashValues", "EraseUndefinedHashValuesOptions", "ExportedBaseClass", "ExtendsInternalInterface", "GiveMeStructs", "Greetee", "GreetingAugmenter", "IAnotherPublicInterface", "IExtendsPrivateInterface", "IFriendlier", "IFriendlyRandomGenerator", "IInterfaceImplementedByAbstractClass", "IInterfaceThatShouldNotBeADataType", "IInterfaceWithInternal", "IInterfaceWithMethods", "IInterfaceWithOptionalMethodArguments", "IInterfaceWithProperties", "IInterfaceWithPropertiesExtension", "IJSII417Derived", "IJSII417PublicBaseOfBase", "IJsii487External", "IJsii487External2", "IJsii496", "IMutableObjectLiteral", "INonInternalInterface", "IPrivatelyImplemented", "IPublicInterface", "IPublicInterface2", "IRandomNumberGenerator", "IReturnsNumber", "ImplementInternalInterface", "ImplementsInterfaceWithInternal", "ImplementsInterfaceWithInternalSubclass", "ImplementsPrivateInterface", "ImplictBaseOfBase", "InbetweenClass", "InterfaceInNamespaceIncludesClasses", "InterfaceInNamespaceOnlyInterface", "JSII417Derived", "JSII417PublicBaseOfBase", "JSObjectLiteralForInterface", "JSObjectLiteralToNative", "JSObjectLiteralToNativeClass", "JavaReservedWords", "Jsii487Derived", "Jsii496Derived", "JsiiAgent", "LoadBalancedFargateServiceProps", "Multiply", "Negate", "NodeStandardLibrary", "NullShouldBeTreatedAsUndefined", "NullShouldBeTreatedAsUndefinedData", "NumberGenerator", "ObjectRefsInCollections", "Old", "OptionalConstructorArgument", "OptionalStruct", "OptionalStructConsumer", "OverrideReturnsObject", "PartiallyInitializedThisConsumer", "Polymorphism", "Power", "PublicClass", "PythonReservedWords", "ReferenceEnumFromScopedPackage", "ReturnsPrivateImplementationOfInterface", "RuntimeTypeChecking", "SingleInstanceTwoTypes", "StaticContext", "Statics", "StringEnum", "StripInternal", "Sum", "SyncVirtualMethods", "Thrower", "UnaryOperation", "UnionProperties", "UseBundledDependency", "UseCalcBase", "UsesInterfaceWithProperties", "VariadicMethod", "VirtualMethodPlayground", "VoidCallback", "__jsii_assembly__", "composition"] +__all__ = ["AbstractClass", "AbstractClassBase", "AbstractClassReturner", "Add", "AllTypes", "AllTypesEnum", "AllowedMethodNames", "AsyncVirtualMethods", "AugmentableClass", "BinaryOperation", "Calculator", "CalculatorProps", "ClassThatImplementsTheInternalInterface", "ClassThatImplementsThePrivateInterface", "ClassWithDocs", "ClassWithMutableObjectLiteralProperty", "ClassWithPrivateConstructorAndAutomaticProperties", "ConstructorPassesThisOut", "Constructors", "ConsumersOfThisCrazyTypeSystem", "DefaultedConstructorArgument", "DeprecatedClass", "DeprecatedEnum", "DeprecatedStruct", "DerivedClassHasNoProperties", "DerivedStruct", "DoNotOverridePrivates", "DoNotRecognizeAnyAsOptional", "DocumentedClass", "DontComplainAboutVariadicAfterOptional", "DoubleTrouble", "EraseUndefinedHashValues", "EraseUndefinedHashValuesOptions", "ExperimentalClass", "ExperimentalEnum", "ExperimentalStruct", "ExportedBaseClass", "ExtendsInternalInterface", "GiveMeStructs", "Greetee", "GreetingAugmenter", "IAnotherPublicInterface", "IDeprecatedInterface", "IExperimentalInterface", "IExtendsPrivateInterface", "IFriendlier", "IFriendlyRandomGenerator", "IInterfaceImplementedByAbstractClass", "IInterfaceThatShouldNotBeADataType", "IInterfaceWithInternal", "IInterfaceWithMethods", "IInterfaceWithOptionalMethodArguments", "IInterfaceWithProperties", "IInterfaceWithPropertiesExtension", "IJSII417Derived", "IJSII417PublicBaseOfBase", "IJsii487External", "IJsii487External2", "IJsii496", "IMutableObjectLiteral", "INonInternalInterface", "IPrivatelyImplemented", "IPublicInterface", "IPublicInterface2", "IRandomNumberGenerator", "IReturnsNumber", "IStableInterface", "ImplementInternalInterface", "ImplementsInterfaceWithInternal", "ImplementsInterfaceWithInternalSubclass", "ImplementsPrivateInterface", "ImplictBaseOfBase", "InbetweenClass", "InterfaceInNamespaceIncludesClasses", "InterfaceInNamespaceOnlyInterface", "JSII417Derived", "JSII417PublicBaseOfBase", "JSObjectLiteralForInterface", "JSObjectLiteralToNative", "JSObjectLiteralToNativeClass", "JavaReservedWords", "Jsii487Derived", "Jsii496Derived", "JsiiAgent", "LoadBalancedFargateServiceProps", "Multiply", "Negate", "NodeStandardLibrary", "NullShouldBeTreatedAsUndefined", "NullShouldBeTreatedAsUndefinedData", "NumberGenerator", "ObjectRefsInCollections", "Old", "OptionalConstructorArgument", "OptionalStruct", "OptionalStructConsumer", "OverrideReturnsObject", "PartiallyInitializedThisConsumer", "Polymorphism", "Power", "PublicClass", "PythonReservedWords", "ReferenceEnumFromScopedPackage", "ReturnsPrivateImplementationOfInterface", "RuntimeTypeChecking", "SingleInstanceTwoTypes", "StableClass", "StableEnum", "StableStruct", "StaticContext", "Statics", "StringEnum", "StripInternal", "Sum", "SyncVirtualMethods", "Thrower", "UnaryOperation", "UnionProperties", "UseBundledDependency", "UseCalcBase", "UsesInterfaceWithProperties", "VariadicMethod", "VirtualMethodPlayground", "VoidCallback", "__jsii_assembly__", "composition"] publication.publish() diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst b/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst index 607b034b60..b53b3269c7 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst +++ b/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst @@ -1489,6 +1489,118 @@ DefaultedConstructorArgument :type: string *(optional)* *(readonly)* +DeprecatedClass +^^^^^^^^^^^^^^^ + +.. py:class:: DeprecatedClass(readonlyString, [mutableNumber]) + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.DeprecatedClass; + + .. code-tab:: javascript + + const { DeprecatedClass } = require('jsii-calc'); + + .. code-tab:: typescript + + import { DeprecatedClass } from 'jsii-calc'; + + + + :param readonlyString: + :type readonlyString: string + :param mutableNumber: + :type mutableNumber: number + + .. py:method:: method() + + + + .. py:attribute:: readonlyProperty + + :type: string *(readonly)* + + + .. py:attribute:: mutableProperty + + :type: number *(optional)* + + +DeprecatedEnum (enum) +^^^^^^^^^^^^^^^^^^^^^ + +.. py:class:: DeprecatedEnum + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.DeprecatedEnum; + + .. code-tab:: javascript + + const { DeprecatedEnum } = require('jsii-calc'); + + .. code-tab:: typescript + + import { DeprecatedEnum } from 'jsii-calc'; + + + + .. py:data:: OptionA + + .. py:data:: OptionB + + +DeprecatedStruct (interface) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. py:class:: DeprecatedStruct + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.DeprecatedStruct; + + .. code-tab:: javascript + + // DeprecatedStruct is an interface + + .. code-tab:: typescript + + import { DeprecatedStruct } from 'jsii-calc'; + + + + + + .. py:attribute:: readonlyProperty + + :type: string *(readonly)* + + DerivedClassHasNoProperties ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -2013,6 +2125,118 @@ EraseUndefinedHashValuesOptions (interface) :type: string *(optional)* *(readonly)* +ExperimentalClass +^^^^^^^^^^^^^^^^^ + +.. py:class:: ExperimentalClass(readonlyString, [mutableNumber]) + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.ExperimentalClass; + + .. code-tab:: javascript + + const { ExperimentalClass } = require('jsii-calc'); + + .. code-tab:: typescript + + import { ExperimentalClass } from 'jsii-calc'; + + + + :param readonlyString: + :type readonlyString: string + :param mutableNumber: + :type mutableNumber: number + + .. py:method:: method() + + + + .. py:attribute:: readonlyProperty + + :type: string *(readonly)* + + + .. py:attribute:: mutableProperty + + :type: number *(optional)* + + +ExperimentalEnum (enum) +^^^^^^^^^^^^^^^^^^^^^^^ + +.. py:class:: ExperimentalEnum + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.ExperimentalEnum; + + .. code-tab:: javascript + + const { ExperimentalEnum } = require('jsii-calc'); + + .. code-tab:: typescript + + import { ExperimentalEnum } from 'jsii-calc'; + + + + .. py:data:: OptionA + + .. py:data:: OptionB + + +ExperimentalStruct (interface) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. py:class:: ExperimentalStruct + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.ExperimentalStruct; + + .. code-tab:: javascript + + // ExperimentalStruct is an interface + + .. code-tab:: typescript + + import { ExperimentalStruct } from 'jsii-calc'; + + + + + + .. py:attribute:: readonlyProperty + + :type: string *(readonly)* + + ExportedBaseClass ^^^^^^^^^^^^^^^^^ @@ -2265,6 +2489,84 @@ IAnotherPublicInterface (interface) :type: string +IDeprecatedInterface (interface) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. py:class:: IDeprecatedInterface + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.IDeprecatedInterface; + + .. code-tab:: javascript + + // IDeprecatedInterface is an interface + + .. code-tab:: typescript + + import { IDeprecatedInterface } from 'jsii-calc'; + + + + + + .. py:attribute:: mutableProperty + + :type: number *(optional)* + + + .. py:method:: method() + + :abstract: Yes + + +IExperimentalInterface (interface) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. py:class:: IExperimentalInterface + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.IExperimentalInterface; + + .. code-tab:: javascript + + // IExperimentalInterface is an interface + + .. code-tab:: typescript + + import { IExperimentalInterface } from 'jsii-calc'; + + + + + + .. py:attribute:: mutableProperty + + :type: number *(optional)* + + + .. py:method:: method() + + :abstract: Yes + + IExtendsPrivateInterface (interface) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -3175,6 +3477,45 @@ IReturnsNumber (interface) :abstract: Yes +IStableInterface (interface) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. py:class:: IStableInterface + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.IStableInterface; + + .. code-tab:: javascript + + // IStableInterface is an interface + + .. code-tab:: typescript + + import { IStableInterface } from 'jsii-calc'; + + + + + + .. py:attribute:: mutableProperty + + :type: number *(optional)* + + + .. py:method:: method() + + :abstract: Yes + + ImplementInternalInterface ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -5490,6 +5831,118 @@ SingleInstanceTwoTypes :rtype: :py:class:`~jsii-calc.IPublicInterface`\ +StableClass +^^^^^^^^^^^ + +.. py:class:: StableClass(readonlyString, [mutableNumber]) + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.StableClass; + + .. code-tab:: javascript + + const { StableClass } = require('jsii-calc'); + + .. code-tab:: typescript + + import { StableClass } from 'jsii-calc'; + + + + :param readonlyString: + :type readonlyString: string + :param mutableNumber: + :type mutableNumber: number + + .. py:method:: method() + + + + .. py:attribute:: readonlyProperty + + :type: string *(readonly)* + + + .. py:attribute:: mutableProperty + + :type: number *(optional)* + + +StableEnum (enum) +^^^^^^^^^^^^^^^^^ + +.. py:class:: StableEnum + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.StableEnum; + + .. code-tab:: javascript + + const { StableEnum } = require('jsii-calc'); + + .. code-tab:: typescript + + import { StableEnum } from 'jsii-calc'; + + + + .. py:data:: OptionA + + .. py:data:: OptionB + + +StableStruct (interface) +^^^^^^^^^^^^^^^^^^^^^^^^ + +.. py:class:: StableStruct + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.StableStruct; + + .. code-tab:: javascript + + // StableStruct is an interface + + .. code-tab:: typescript + + import { StableStruct } from 'jsii-calc'; + + + + + + .. py:attribute:: readonlyProperty + + :type: string *(readonly)* + + StaticContext ^^^^^^^^^^^^^ diff --git a/packages/jsii-reflect/test/classes.expected.txt b/packages/jsii-reflect/test/classes.expected.txt index 11f35d759f..2c2e244197 100644 --- a/packages/jsii-reflect/test/classes.expected.txt +++ b/packages/jsii-reflect/test/classes.expected.txt @@ -20,6 +20,7 @@ ConstructorPassesThisOut Constructors ConsumersOfThisCrazyTypeSystem DefaultedConstructorArgument +DeprecatedClass Derived DoNotOverridePrivates DoNotRecognizeAnyAsOptional @@ -27,6 +28,7 @@ DocumentedClass DontComplainAboutVariadicAfterOptional DoubleTrouble EraseUndefinedHashValues +ExperimentalClass ExportedBaseClass Foo GiveMeStructs @@ -66,6 +68,7 @@ ReferenceEnumFromScopedPackage ReturnsPrivateImplementationOfInterface RuntimeTypeChecking SingleInstanceTwoTypes +StableClass StaticContext Statics StripInternal diff --git a/packages/jsii-reflect/test/jsii-tree.test.all.expected.txt b/packages/jsii-reflect/test/jsii-tree.test.all.expected.txt index 1ba0d6f468..559508bb05 100644 --- a/packages/jsii-reflect/test/jsii-tree.test.all.expected.txt +++ b/packages/jsii-reflect/test/jsii-tree.test.all.expected.txt @@ -331,6 +331,21 @@ assemblies │ │ └─┬ arg2 property │ │ ├── immutable │ │ └── type: Optional + │ ├─┬ class DeprecatedClass + │ │ └─┬ members + │ │ ├─┬ (readonlyString,mutableNumber) initializer + │ │ │ └─┬ parameters + │ │ │ ├─┬ readonlyString + │ │ │ │ └── type: string + │ │ │ └─┬ mutableNumber + │ │ │ └── type: Optional + │ │ ├─┬ method() method + │ │ │ └── returns: void + │ │ ├─┬ readonlyProperty property + │ │ │ ├── immutable + │ │ │ └── type: string + │ │ └─┬ mutableProperty property + │ │ └── type: Optional │ ├─┬ class Base │ │ └─┬ members │ │ ├── () initializer @@ -411,6 +426,21 @@ assemblies │ │ └─┬ prop2IsUndefined() method │ │ ├── static │ │ └── returns: any + │ ├─┬ class ExperimentalClass + │ │ └─┬ members + │ │ ├─┬ (readonlyString,mutableNumber) initializer + │ │ │ └─┬ parameters + │ │ │ ├─┬ readonlyString + │ │ │ │ └── type: string + │ │ │ └─┬ mutableNumber + │ │ │ └── type: Optional + │ │ ├─┬ method() method + │ │ │ └── returns: void + │ │ ├─┬ readonlyProperty property + │ │ │ ├── immutable + │ │ │ └── type: string + │ │ └─┬ mutableProperty property + │ │ └── type: Optional │ ├─┬ class ExportedBaseClass │ │ └─┬ members │ │ ├─┬ (success) initializer @@ -958,6 +988,21 @@ assemblies │ │ │ └── returns: jsii-calc.InbetweenClass │ │ └─┬ interface2() method │ │ └── returns: jsii-calc.IPublicInterface + │ ├─┬ class StableClass + │ │ └─┬ members + │ │ ├─┬ (readonlyString,mutableNumber) initializer + │ │ │ └─┬ parameters + │ │ │ ├─┬ readonlyString + │ │ │ │ └── type: string + │ │ │ └─┬ mutableNumber + │ │ │ └── type: Optional + │ │ ├─┬ method() method + │ │ │ └── returns: void + │ │ ├─┬ readonlyProperty property + │ │ │ ├── immutable + │ │ │ └── type: string + │ │ └─┬ mutableProperty property + │ │ └── type: Optional │ ├─┬ class StaticContext │ │ └─┬ members │ │ ├─┬ canAccessStaticContext() method @@ -1203,6 +1248,12 @@ assemblies │ │ ├── abstract │ │ ├── immutable │ │ └── type: Optional + │ ├─┬ interface DeprecatedStruct + │ │ └─┬ members + │ │ └─┬ readonlyProperty property + │ │ ├── abstract + │ │ ├── immutable + │ │ └── type: string │ ├─┬ interface DerivedStruct │ │ ├─┬ interfaces │ │ │ └── MyFirstStruct @@ -1241,6 +1292,12 @@ assemblies │ │ ├── abstract │ │ ├── immutable │ │ └── type: Optional + │ ├─┬ interface ExperimentalStruct + │ │ └─┬ members + │ │ └─┬ readonlyProperty property + │ │ ├── abstract + │ │ ├── immutable + │ │ └── type: string │ ├─┬ interface ExtendsInternalInterface │ │ └─┬ members │ │ ├─┬ boom property @@ -1262,6 +1319,22 @@ assemblies │ │ └─┬ a property │ │ ├── abstract │ │ └── type: string + │ ├─┬ interface IDeprecatedInterface + │ │ └─┬ members + │ │ ├─┬ method() method + │ │ │ ├── abstract + │ │ │ └── returns: void + │ │ └─┬ mutableProperty property + │ │ ├── abstract + │ │ └── type: Optional + │ ├─┬ interface IExperimentalInterface + │ │ └─┬ members + │ │ ├─┬ method() method + │ │ │ ├── abstract + │ │ │ └── returns: void + │ │ └─┬ mutableProperty property + │ │ ├── abstract + │ │ └── type: Optional │ ├─┬ interface IExtendsPrivateInterface │ │ └─┬ members │ │ ├─┬ moreThings property @@ -1414,6 +1487,14 @@ assemblies │ │ ├── abstract │ │ ├── immutable │ │ └── type: @scope/jsii-calc-lib.Number + │ ├─┬ interface IStableInterface + │ │ └─┬ members + │ │ ├─┬ method() method + │ │ │ ├── abstract + │ │ │ └── returns: void + │ │ └─┬ mutableProperty property + │ │ ├── abstract + │ │ └── type: Optional │ ├─┬ interface ImplictBaseOfBase │ │ ├─┬ interfaces │ │ │ └── BaseProps @@ -1472,6 +1553,12 @@ assemblies │ │ ├── abstract │ │ ├── immutable │ │ └── type: Optional + │ ├─┬ interface StableStruct + │ │ └─┬ members + │ │ └─┬ readonlyProperty property + │ │ ├── abstract + │ │ ├── immutable + │ │ └── type: string │ ├─┬ interface UnionProperties │ │ └─┬ members │ │ ├─┬ bar property @@ -1486,6 +1573,15 @@ assemblies │ │ ├── MyEnumValue │ │ ├── YourEnumValue │ │ └── ThisIsGreat + │ ├─┬ enum DeprecatedEnum + │ │ ├── OptionA + │ │ └── OptionB + │ ├─┬ enum ExperimentalEnum + │ │ ├── OptionA + │ │ └── OptionB + │ ├─┬ enum StableEnum + │ │ ├── OptionA + │ │ └── OptionB │ ├─┬ enum StringEnum │ │ ├── A │ │ ├── B diff --git a/packages/jsii-reflect/test/jsii-tree.test.inheritance.expected.txt b/packages/jsii-reflect/test/jsii-tree.test.inheritance.expected.txt index 27972a66b8..5c30a6e070 100644 --- a/packages/jsii-reflect/test/jsii-tree.test.inheritance.expected.txt +++ b/packages/jsii-reflect/test/jsii-tree.test.inheritance.expected.txt @@ -29,6 +29,7 @@ assemblies │ ├── class Constructors │ ├── class ConsumersOfThisCrazyTypeSystem │ ├── class DefaultedConstructorArgument + │ ├── class DeprecatedClass │ ├── class Base │ ├─┬ class Derived │ │ └── base: Base @@ -39,6 +40,7 @@ assemblies │ ├─┬ class DoubleTrouble │ │ └── interfaces: IFriendlyRandomGenerator │ ├── class EraseUndefinedHashValues + │ ├── class ExperimentalClass │ ├── class ExportedBaseClass │ ├── class GiveMeStructs │ ├── class GreetingAugmenter @@ -88,6 +90,7 @@ assemblies │ ├── class ReturnsPrivateImplementationOfInterface │ ├── class RuntimeTypeChecking │ ├── class SingleInstanceTwoTypes + │ ├── class StableClass │ ├── class StaticContext │ ├── class Statics │ ├── class StripInternal @@ -106,13 +109,17 @@ assemblies │ ├─┬ class CompositeOperation │ │ └── base: Operation │ ├── interface CalculatorProps + │ ├── interface DeprecatedStruct │ ├─┬ interface DerivedStruct │ │ └─┬ interfaces │ │ └── MyFirstStruct │ ├── interface EraseUndefinedHashValuesOptions + │ ├── interface ExperimentalStruct │ ├── interface ExtendsInternalInterface │ ├── interface Greetee │ ├── interface IAnotherPublicInterface + │ ├── interface IDeprecatedInterface + │ ├── interface IExperimentalInterface │ ├── interface IExtendsPrivateInterface │ ├─┬ interface IFriendlier │ │ └─┬ interfaces @@ -148,6 +155,7 @@ assemblies │ ├── interface IPublicInterface2 │ ├── interface IRandomNumberGenerator │ ├── interface IReturnsNumber + │ ├── interface IStableInterface │ ├─┬ interface ImplictBaseOfBase │ │ └─┬ interfaces │ │ └── BaseProps @@ -156,8 +164,12 @@ assemblies │ ├── interface LoadBalancedFargateServiceProps │ ├── interface NullShouldBeTreatedAsUndefinedData │ ├── interface OptionalStruct + │ ├── interface StableStruct │ ├── interface UnionProperties │ ├── enum AllTypesEnum + │ ├── enum DeprecatedEnum + │ ├── enum ExperimentalEnum + │ ├── enum StableEnum │ ├── enum StringEnum │ └── enum CompositionStringStyle ├─┬ @scope/jsii-calc-base diff --git a/packages/jsii-reflect/test/jsii-tree.test.members.expected.txt b/packages/jsii-reflect/test/jsii-tree.test.members.expected.txt index 004b4a2fff..a434acf0ab 100644 --- a/packages/jsii-reflect/test/jsii-tree.test.members.expected.txt +++ b/packages/jsii-reflect/test/jsii-tree.test.members.expected.txt @@ -138,6 +138,12 @@ assemblies │ │ ├── arg1 property │ │ ├── arg3 property │ │ └── arg2 property + │ ├─┬ class DeprecatedClass + │ │ └─┬ members + │ │ ├── (readonlyString,mutableNumber) initializer + │ │ ├── method() method + │ │ ├── readonlyProperty property + │ │ └── mutableProperty property │ ├─┬ class Base │ │ └─┬ members │ │ ├── () initializer @@ -175,6 +181,12 @@ assemblies │ │ ├── doesKeyExist(opts,key) method │ │ ├── prop1IsNull() method │ │ └── prop2IsUndefined() method + │ ├─┬ class ExperimentalClass + │ │ └─┬ members + │ │ ├── (readonlyString,mutableNumber) initializer + │ │ ├── method() method + │ │ ├── readonlyProperty property + │ │ └── mutableProperty property │ ├─┬ class ExportedBaseClass │ │ └─┬ members │ │ ├── (success) initializer @@ -439,6 +451,12 @@ assemblies │ │ ├── () initializer │ │ ├── interface1() method │ │ └── interface2() method + │ ├─┬ class StableClass + │ │ └─┬ members + │ │ ├── (readonlyString,mutableNumber) initializer + │ │ ├── method() method + │ │ ├── readonlyProperty property + │ │ └── mutableProperty property │ ├─┬ class StaticContext │ │ └─┬ members │ │ ├── canAccessStaticContext() method @@ -537,6 +555,9 @@ assemblies │ │ └─┬ members │ │ ├── initialValue property │ │ └── maximumValue property + │ ├─┬ interface DeprecatedStruct + │ │ └─┬ members + │ │ └── readonlyProperty property │ ├─┬ interface DerivedStruct │ │ └─┬ members │ │ ├── anotherRequired property @@ -549,6 +570,9 @@ assemblies │ │ └─┬ members │ │ ├── option1 property │ │ └── option2 property + │ ├─┬ interface ExperimentalStruct + │ │ └─┬ members + │ │ └── readonlyProperty property │ ├─┬ interface ExtendsInternalInterface │ │ └─┬ members │ │ ├── boom property @@ -559,6 +583,14 @@ assemblies │ ├─┬ interface IAnotherPublicInterface │ │ └─┬ members │ │ └── a property + │ ├─┬ interface IDeprecatedInterface + │ │ └─┬ members + │ │ ├── method() method + │ │ └── mutableProperty property + │ ├─┬ interface IExperimentalInterface + │ │ └─┬ members + │ │ ├── method() method + │ │ └── mutableProperty property │ ├─┬ interface IExtendsPrivateInterface │ │ └─┬ members │ │ ├── moreThings property @@ -630,6 +662,10 @@ assemblies │ │ └─┬ members │ │ ├── obtainNumber() method │ │ └── numberProp property + │ ├─┬ interface IStableInterface + │ │ └─┬ members + │ │ ├── method() method + │ │ └── mutableProperty property │ ├─┬ interface ImplictBaseOfBase │ │ └─┬ members │ │ └── goo property @@ -653,6 +689,9 @@ assemblies │ ├─┬ interface OptionalStruct │ │ └─┬ members │ │ └── field property + │ ├─┬ interface StableStruct + │ │ └─┬ members + │ │ └── readonlyProperty property │ ├─┬ interface UnionProperties │ │ └─┬ members │ │ ├── bar property @@ -661,6 +700,15 @@ assemblies │ │ ├── MyEnumValue │ │ ├── YourEnumValue │ │ └── ThisIsGreat + │ ├─┬ enum DeprecatedEnum + │ │ ├── OptionA + │ │ └── OptionB + │ ├─┬ enum ExperimentalEnum + │ │ ├── OptionA + │ │ └── OptionB + │ ├─┬ enum StableEnum + │ │ ├── OptionA + │ │ └── OptionB │ ├─┬ enum StringEnum │ │ ├── A │ │ ├── B diff --git a/packages/jsii-reflect/test/jsii-tree.test.types.expected.txt b/packages/jsii-reflect/test/jsii-tree.test.types.expected.txt index 3c4c10f766..726ecf0266 100644 --- a/packages/jsii-reflect/test/jsii-tree.test.types.expected.txt +++ b/packages/jsii-reflect/test/jsii-tree.test.types.expected.txt @@ -20,6 +20,7 @@ assemblies │ ├── class Constructors │ ├── class ConsumersOfThisCrazyTypeSystem │ ├── class DefaultedConstructorArgument + │ ├── class DeprecatedClass │ ├── class Base │ ├── class Derived │ ├── class DoNotOverridePrivates @@ -28,6 +29,7 @@ assemblies │ ├── class DontComplainAboutVariadicAfterOptional │ ├── class DoubleTrouble │ ├── class EraseUndefinedHashValues + │ ├── class ExperimentalClass │ ├── class ExportedBaseClass │ ├── class GiveMeStructs │ ├── class GreetingAugmenter @@ -65,6 +67,7 @@ assemblies │ ├── class ReturnsPrivateImplementationOfInterface │ ├── class RuntimeTypeChecking │ ├── class SingleInstanceTwoTypes + │ ├── class StableClass │ ├── class StaticContext │ ├── class Statics │ ├── class StripInternal @@ -80,11 +83,15 @@ assemblies │ ├── class VoidCallback │ ├── class CompositeOperation │ ├── interface CalculatorProps + │ ├── interface DeprecatedStruct │ ├── interface DerivedStruct │ ├── interface EraseUndefinedHashValuesOptions + │ ├── interface ExperimentalStruct │ ├── interface ExtendsInternalInterface │ ├── interface Greetee │ ├── interface IAnotherPublicInterface + │ ├── interface IDeprecatedInterface + │ ├── interface IExperimentalInterface │ ├── interface IExtendsPrivateInterface │ ├── interface IFriendlier │ ├── interface IFriendlyRandomGenerator @@ -107,14 +114,19 @@ assemblies │ ├── interface IPublicInterface2 │ ├── interface IRandomNumberGenerator │ ├── interface IReturnsNumber + │ ├── interface IStableInterface │ ├── interface ImplictBaseOfBase │ ├── interface Hello │ ├── interface Hello │ ├── interface LoadBalancedFargateServiceProps │ ├── interface NullShouldBeTreatedAsUndefinedData │ ├── interface OptionalStruct + │ ├── interface StableStruct │ ├── interface UnionProperties │ ├── enum AllTypesEnum + │ ├── enum DeprecatedEnum + │ ├── enum ExperimentalEnum + │ ├── enum StableEnum │ ├── enum StringEnum │ └── enum CompositionStringStyle ├─┬ @scope/jsii-calc-base diff --git a/packages/jsii-spec/lib/spec.ts b/packages/jsii-spec/lib/spec.ts index bc87ecbcae..8d1e3dde67 100644 --- a/packages/jsii-spec/lib/spec.ts +++ b/packages/jsii-spec/lib/spec.ts @@ -334,15 +334,30 @@ export interface Docs { } /** - * API Stability levels. + * API Stability levels. These are modeled after the `node` stability index. + * + * @see https://nodejs.org/api/documentation.html#documentation_stability_index. */ export enum Stability { /** - * Experimental APIs may change in breaking ways in a minor version update. + * The API may emit warnings. Backward compatibility is not guaranteed. + * + * More information about the deprecation can usually be found in the + * `deprecated` field. + */ + Deprecated = 'deprecated', + + /** + * This API is still under active development and subject to non-backward + * compatible changes or removal in any future version. Use of the API is + * not recommended in production environments. Experimental APIs are not + * subject to the Semantic Versioning model. */ Experimental = 'experimental', + /** - * Stable APIs may not change in breaking ways without a major version bump. + * This API is subject to the Semantic Versioning model and may not change + * in breaking ways in a subsequent minor or patch version. */ Stable = 'stable', } @@ -896,3 +911,14 @@ export function describeTypeReference(type?: TypeReference): string { throw new Error('Unrecognized type reference'); } + +/** + * Determines whether an entity is deprecated. + * + * @param entity the entity to be checked. + * + * @returns true if the entity is marked as deprecated. + */ +export function isDeprecated(entity: Documentable): boolean { + return entity.docs != null && entity.docs.stability === Stability.Deprecated; +} diff --git a/packages/jsii/lib/assembler.ts b/packages/jsii/lib/assembler.ts index cdd68e57d3..49cf73f74c 100644 --- a/packages/jsii/lib/assembler.ts +++ b/packages/jsii/lib/assembler.ts @@ -61,11 +61,12 @@ export class Assembler implements Emitter { 'A "homepage" field should be specified in "package.json"'); } const readme = await _loadReadme.call(this); - if (!readme) { + if (readme == null) { this._diagnostic(null, ts.DiagnosticCategory.Suggestion, - 'There is not "README.md" file. It is recommended to have one.'); + 'There is no "README.md" file. It is recommended to have one.'); } + const docs = _loadDocs.call(this); this._types = {}; this._deferred = []; @@ -99,7 +100,7 @@ export class Assembler implements Emitter { const jsiiVersion = this.projectInfo.jsiiVersionFormat === 'short' ? SHORT_VERSION : VERSION; - const assembly = { + const assembly: spec.Assembly = { schema: spec.SchemaVersion.LATEST, name: this.projectInfo.name, version: this.projectInfo.version, @@ -115,6 +116,7 @@ export class Assembler implements Emitter { types: this._types, targets: this.projectInfo.targets, metadata: this.projectInfo.metadata, + docs, readme, jsiiVersion, fingerprint: '', @@ -150,6 +152,15 @@ export class Assembler implements Emitter { ); return { markdown: renderedLines.join('\n') }; } + + function _loadDocs(this: Assembler): spec.Docs | undefined { + if (!this.projectInfo.stability && !this.projectInfo.deprecated) { + return undefined; + } + const deprecated = this.projectInfo.deprecated; + const stability = this.projectInfo.stability; + return { deprecated, stability }; + } } /** diff --git a/packages/jsii/lib/docs.ts b/packages/jsii/lib/docs.ts index b775bf2422..ed4f977884 100644 --- a/packages/jsii/lib/docs.ts +++ b/packages/jsii/lib/docs.ts @@ -101,12 +101,21 @@ function parseDocParts(comments: string | undefined, tags: ts.JSDocTagInfo[]): D diagnostics.push('Element is marked both @experimental and @stable.'); } - if (docs.deprecated !== undefined && docs.deprecated.trim() === '') { - diagnostics.push('@deprecated tag needs a reason and/or suggested alternatives.'); + if (docs.deprecated !== undefined) { + if (docs.deprecated.trim() === '') { + diagnostics.push('@deprecated tag needs a reason and/or suggested alternatives.'); + } + if (stable) { + diagnostics.push('Element is marked both @deprecated and @stable.'); + } + if (experimental) { + diagnostics.push('Element is marked both @deprecated and @experimental.'); + } } if (experimental) { docs.stability = spec.Stability.Experimental; } if (stable) { docs.stability = spec.Stability.Stable; } + if (docs.deprecated) { docs.stability = spec.Stability.Deprecated; } if (tagNames.size > 0) { docs.custom = {}; diff --git a/packages/jsii/lib/project-info.ts b/packages/jsii/lib/project-info.ts index 0e3c2e5a45..764068b8a5 100644 --- a/packages/jsii/lib/project-info.ts +++ b/packages/jsii/lib/project-info.ts @@ -17,6 +17,8 @@ export interface ProjectInfo { readonly name: string; readonly version: string; readonly author: spec.Person; + readonly deprecated?: string; + readonly stability?: spec.Stability; readonly license: string; readonly repository: { readonly type: string; @@ -105,6 +107,8 @@ export async function loadProjectInfo(projectRoot: string, { fixPeerDependencies name: _required(pkg.name, 'The "package.json" file must specify the "name" attribute'), version: _required(pkg.version, 'The "package.json" file must specify the "version" attribute'), + deprecated: pkg.deprecated, + stability: _validateStability(pkg.stability, pkg.deprecated), author: _toPerson(_required(pkg.author, 'The "package.json" file must specify the "author" attribute'), 'author'), repository: { url: _required(pkg.repository.url, 'The "package.json" file must specify the "repository.url" attribute'), @@ -228,3 +232,18 @@ function _validateVersionFormat(format: string): 'short' | 'full' { } return format; } + +function _validateStability(stability: string | undefined, deprecated: string | undefined): spec.Stability | undefined { + if (!stability && deprecated) { + stability = spec.Stability.Deprecated; + } else if (deprecated && stability !== spec.Stability.Deprecated) { + throw new Error(`Package is deprecated (${deprecated}), but it's stability is ${stability} and not ${spec.Stability.Deprecated}`); + } + if (!stability) { + return undefined; + } + if (Object.values(spec.Stability).indexOf(stability) === -1) { + throw new Error(`Invalid stability "${stability}", it must be one of ${Object.values(spec.Stability).join(', ')}`); + } + return stability as spec.Stability; +}