diff --git a/fetch-dotnet-snk.sh b/fetch-dotnet-snk.sh index ce4dc28ebf..a4d78e5f6f 100644 --- a/fetch-dotnet-snk.sh +++ b/fetch-dotnet-snk.sh @@ -50,7 +50,6 @@ TMP_KEY="$TMP_DIR/key.snk" echo $SNK_SECRET | jq -r .SecretBinary | base64 --decode > $TMP_KEY cp $TMP_KEY packages/jsii-dotnet-jsonmodel/src/Amazon.JSII.JsonModel/ -cp $TMP_KEY packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/ cp $TMP_KEY packages/jsii-dotnet-runtime/src/Amazon.JSII.Runtime/ rm -rf $TMP_DIR diff --git a/packages/jsii-dotnet-generator/.gitignore b/packages/jsii-dotnet-generator/.gitignore deleted file mode 100644 index 66d8e6fb6f..0000000000 --- a/packages/jsii-dotnet-generator/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -src/Amazon.JSII.Generator/JsiiVersion.cs -src/Directory.Build.props -src/NuGet.Metadata.props - -!*.t.js - -*.js -*.d.ts -node_modules/ -.nyc_output/ -coverage/ - -*.nupkg -bin/ -cli/ -obj/ \ No newline at end of file diff --git a/packages/jsii-dotnet-generator/.npmignore b/packages/jsii-dotnet-generator/.npmignore deleted file mode 100644 index 3cb24af2cb..0000000000 --- a/packages/jsii-dotnet-generator/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -# by default, exclude everything -* - -# bundle only... -!*.nupkg -!package.json -!index.js -!cli/**/* - diff --git a/packages/jsii-dotnet-generator/CHANGELOG.md b/packages/jsii-dotnet-generator/CHANGELOG.md deleted file mode 100644 index 9f9984d3cc..0000000000 --- a/packages/jsii-dotnet-generator/CHANGELOG.md +++ /dev/null @@ -1,388 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.14.2](https://github.com/aws/jsii/compare/v0.14.1...v0.14.2) (2019-07-19) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -## [0.14.1](https://github.com/aws/jsii/compare/v0.14.0...v0.14.1) (2019-07-17) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -# [0.14.0](https://github.com/aws/jsii/compare/v0.13.4...v0.14.0) (2019-07-08) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -## [0.13.4](https://github.com/aws/jsii/compare/v0.13.3...v0.13.4) (2019-07-03) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -## [0.13.3](https://github.com/aws/jsii/compare/v0.13.2...v0.13.3) (2019-07-01) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -## [0.13.2](https://github.com/aws/jsii/compare/v0.12.1...v0.13.2) (2019-07-01) - - -### Features - -* **pacmak:** support adding suffix to .NET package versions ([#557](https://github.com/aws/jsii/issues/557)) ([99adf19](https://github.com/aws/jsii/commit/99adf19)) - - - - - -## [0.12.1](https://github.com/aws/jsii/compare/v0.12.0...v0.12.1) (2019-06-25) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -# [0.12.0](https://github.com/aws/jsii/compare/v0.11.3...v0.12.0) (2019-06-24) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -## [0.11.3](https://github.com/aws/jsii/compare/v0.11.2...v0.11.3) (2019-06-18) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -## [0.11.2](https://github.com/aws/jsii/compare/v0.11.1...v0.11.2) (2019-06-07) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -## [0.11.1](https://github.com/aws/jsii/compare/v0.11.0...v0.11.1) (2019-06-07) - - -### Features - -* Register module-level stability ([#515](https://github.com/aws/jsii/issues/515)) ([efae447](https://github.com/aws/jsii/commit/efae447)), closes [awslabs/cdk-ops#367](https://github.com/awslabs/cdk-ops/issues/367) -* **jsii:** Propagate stability to members ([#522](https://github.com/aws/jsii/issues/522)) ([20507e6](https://github.com/aws/jsii/commit/20507e6)) -* **jsii-spec:** Add optional metadata field ([#512](https://github.com/aws/jsii/issues/512)) ([10e2bfe](https://github.com/aws/jsii/commit/10e2bfe)) - - - - - -# [0.11.0](https://github.com/aws/jsii/compare/v0.10.5...v0.11.0) (2019-05-21) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -## [0.10.5](https://github.com/aws/jsii/compare/v0.10.4...v0.10.5) (2019-05-06) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -## [0.10.4](https://github.com/aws/jsii/compare/v0.10.3...v0.10.4) (2019-05-05) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -## [0.10.3](https://github.com/aws/jsii/compare/v0.10.2...v0.10.3) (2019-04-24) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -## [0.10.2](https://github.com/aws/jsii/compare/v0.10.1...v0.10.2) (2019-04-18) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -## [0.10.1](https://github.com/aws/jsii/compare/v0.10.0...v0.10.1) (2019-04-17) - - -### Bug Fixes - -* **dotnet:** Correctly generate "optional" markers ([#466](https://github.com/aws/jsii/issues/466)) ([17403dc](https://github.com/aws/jsii/commit/17403dc)) - - - - - -# [0.10.0](https://github.com/aws/jsii/compare/v0.9.0...v0.10.0) (2019-04-16) - - -### Bug Fixes - -* **dotnet:** fix doc comment model parsing in .NET generator ([#455](https://github.com/aws/jsii/issues/455)) ([ae85aa5](https://github.com/aws/jsii/commit/ae85aa5)) - - -### Features - -* **jsii-spec:** Model parameter optionality ([#432](https://github.com/aws/jsii/issues/432)) ([21e485a](https://github.com/aws/jsii/commit/21e485a)), closes [#296](https://github.com/aws/jsii/issues/296) [#414](https://github.com/aws/jsii/issues/414) - - -### BREAKING CHANGES - -* **jsii-spec:** JSII assemblies generated by older versions of the tool -will fail loading with this new version, and vice-versa. Re-compile your -projects in order to fix this. - - - - - -# [0.9.0](https://github.com/aws/jsii/compare/v0.8.2...v0.9.0) (2019-04-04) - - -### Features - -* **jsii-diff:** standardize doc comments, add API compatibility tool ([#415](https://github.com/aws/jsii/issues/415)) ([9cfd867](https://github.com/aws/jsii/commit/9cfd867)) - - - - - -## [0.8.2](https://github.com/aws/jsii/compare/v0.8.1...v0.8.2) (2019-03-28) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -## [0.8.1](https://github.com/aws/jsii/compare/v0.8.0...v0.8.1) (2019-03-28) - -**Note:** Version bump only for package jsii-dotnet-generator - - - - - -# [0.8.0](https://github.com/aws/jsii/compare/v0.7.15...v0.8.0) (2019-03-20) - - -### Features - -* pass data types (structs) by-value instead of by-ref ([#376](https://github.com/aws/jsii/issues/376)) ([db3ccdf](https://github.com/aws/jsii/commit/db3ccdf)), closes [awslabs/aws-cdk#965](https://github.com/awslabs/aws-cdk/issues/965) [#375](https://github.com/aws/jsii/issues/375) - - -### BREAKING CHANGES - -* all properties in interfaces which represent data types must be marked as `readonly`. Otherwise, jsii compilation will fail. - - - - - - -## [0.7.15](https://github.com/aws/jsii/compare/v0.7.14...v0.7.15) (2019-02-27) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -## [0.7.14](https://github.com/aws/jsii/compare/v0.7.13...v0.7.14) (2019-02-04) - - -### Features - -* Generate NuGet symbol and source packages ([#243](https://github.com/aws/jsii/issues/243)) ([aafd405](https://github.com/aws/jsii/commit/aafd405)) - - - - - -## [0.7.13](https://github.com/aws/jsii/compare/v0.7.12...v0.7.13) (2019-01-03) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -## [0.7.12](https://github.com/aws/jsii/compare/v0.7.11...v0.7.12) (2018-12-11) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -## [0.7.11](https://github.com/aws/jsii/compare/v0.7.10...v0.7.11) (2018-11-18) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -## [0.7.10](https://github.com/aws/jsii/compare/v0.7.9...v0.7.10) (2018-11-12) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -## [0.7.9](https://github.com/aws/jsii/compare/v0.7.8...v0.7.9) (2018-11-12) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -## [0.7.8](https://github.com/aws/jsii/compare/v0.7.7...v0.7.8) (2018-10-23) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -## [0.7.7](https://github.com/aws/jsii/compare/v0.7.6...v0.7.7) (2018-10-10) - - -### Bug Fixes - -* **dotnet:** abstract classes should have proxy implementations ([#241](https://github.com/aws/jsii/issues/241)) ([828a26f](https://github.com/aws/jsii/commit/828a26f)), closes [#223](https://github.com/aws/jsii/issues/223) -* **jsii:** support public autoproperties in private constructor ([#256](https://github.com/aws/jsii/issues/256)) ([181012e](https://github.com/aws/jsii/commit/181012e)) -* **jsii-dotnet-generator:** Use FQ type returns in conflict. ([#258](https://github.com/aws/jsii/issues/258)) ([a78784a](https://github.com/aws/jsii/commit/a78784a)), closes [#252](https://github.com/aws/jsii/issues/252) - - - - - -## [0.7.6](https://github.com/aws/jsii/compare/v0.7.5...v0.7.6) (2018-09-20) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -## [0.7.5](https://github.com/aws/jsii/compare/v0.7.4...v0.7.5) (2018-09-13) - - -### Bug Fixes - -* **java:** support abstract return types ([#224](https://github.com/aws/jsii/issues/224)) ([3257223](https://github.com/aws/jsii/commit/3257223)), closes [#220](https://github.com/aws/jsii/issues/220) [#223](https://github.com/aws/jsii/issues/223) [awslabs/aws-cdk#680](https://github.com/awslabs/aws-cdk/issues/680) - - - - - -## [0.7.4](https://github.com/aws/jsii/compare/v0.7.3...v0.7.4) (2018-09-10) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -## [0.7.3](https://github.com/aws/jsii/compare/v0.7.2...v0.7.3) (2018-09-06) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -## [0.7.2](https://github.com/aws/jsii/compare/v0.7.1...v0.7.2) (2018-09-06) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -## [0.7.1](https://github.com/aws/jsii/compare/v0.7.0...v0.7.1) (2018-08-28) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -# [0.7.0](https://github.com/aws/jsii/compare/v0.6.4...v0.7.0) (2018-08-21) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -# [0.7.0](https://github.com/aws/jsii/compare/v0.6.4...v0.7.0) (2018-08-21) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -## [0.6.4](https://github.com/aws/jsii/compare/v0.6.3...v0.6.4) (2018-08-08) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -## [0.6.3](https://github.com/aws/jsii/compare/v0.6.2...v0.6.3) (2018-08-08) - - - - -**Note:** Version bump only for package jsii-dotnet-generator - - -## 0.6.2 (2018-08-07) - - - - -**Note:** Version bump only for package jsii-dotnet-generator diff --git a/packages/jsii-dotnet-generator/Directory.Build.props.t.js b/packages/jsii-dotnet-generator/Directory.Build.props.t.js deleted file mode 100644 index 77bca5d03c..0000000000 --- a/packages/jsii-dotnet-generator/Directory.Build.props.t.js +++ /dev/null @@ -1,9 +0,0 @@ -const version = require('./package.json').version.replace(/\+.+$/, ''); // omit "+build" suffix - -process.stdout.write(` - - ${version} - netstandard2.0 - - -`); diff --git a/packages/jsii-dotnet-generator/JsiiVersion.t.js b/packages/jsii-dotnet-generator/JsiiVersion.t.js deleted file mode 100644 index 498cbdd13f..0000000000 --- a/packages/jsii-dotnet-generator/JsiiVersion.t.js +++ /dev/null @@ -1,10 +0,0 @@ -const path = require('path'); -const version = require('./package.json').version.replace(/\+.+$/, ''); // omit "+build" postfix; -process.stdout.write(`namespace Amazon.JSII.Generator -{ - public static class JsiiVersion - { - public static readonly string Version = "${version}"; - } -} -`); diff --git a/packages/jsii-dotnet-generator/LICENSE b/packages/jsii-dotnet-generator/LICENSE deleted file mode 100644 index 129acd53d9..0000000000 --- a/packages/jsii-dotnet-generator/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/packages/jsii-dotnet-generator/NOTICE b/packages/jsii-dotnet-generator/NOTICE deleted file mode 100644 index dc4ac3f857..0000000000 --- a/packages/jsii-dotnet-generator/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -jsii -Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/jsii-dotnet-generator/NuGet.Metadata.props.t.js b/packages/jsii-dotnet-generator/NuGet.Metadata.props.t.js deleted file mode 100644 index a16129c39c..0000000000 --- a/packages/jsii-dotnet-generator/NuGet.Metadata.props.t.js +++ /dev/null @@ -1,19 +0,0 @@ -const package = require('./package.json'); - -process.stdout.write(` - - True - True - True - ..\\..\\bin\\$(Configuration)\\NuGet\\ - $(JsiiVersion) - ${package.description} - ${package.homepage} - https://spdx.org/licenses/${package.license}.html - ${package.author.name} - ${package.author.name} - key.snk - True - - -`); diff --git a/packages/jsii-dotnet-generator/build.sh b/packages/jsii-dotnet-generator/build.sh deleted file mode 100644 index 6da18654bb..0000000000 --- a/packages/jsii-dotnet-generator/build.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -euo pipefail - -npm run gen - -dotnet build --force -c Release ./src/Amazon.JSII.Generator.sln -dotnet publish -c Release src/Amazon.JSII.Generator.CLI/ - -mkdir -p cli -rsync -av ./src/Amazon.JSII.Generator.CLI/bin/Release/netcoreapp2.0/ ./cli/ - -cp -f ./bin/Release/NuGet/*.nupkg . diff --git a/packages/jsii-dotnet-generator/generate.sh b/packages/jsii-dotnet-generator/generate.sh deleted file mode 100644 index 223d19008d..0000000000 --- a/packages/jsii-dotnet-generator/generate.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -euo pipefail -src="./src" - -# Generate metadata files based on package.json. -/usr/bin/env node ./Directory.Build.props.t.js > ${src}/Directory.Build.props -/usr/bin/env node ./NuGet.Metadata.props.t.js > ${src}/NuGet.Metadata.props -/usr/bin/env node JsiiVersion.t.js > ${src}/Amazon.JSII.Generator/JsiiVersion.cs diff --git a/packages/jsii-dotnet-generator/index.js b/packages/jsii-dotnet-generator/index.js deleted file mode 100644 index e04488cec0..0000000000 --- a/packages/jsii-dotnet-generator/index.js +++ /dev/null @@ -1 +0,0 @@ -// Do not delete. Required for require.resolve('jsii-dotnet-generator') to succeed. diff --git a/packages/jsii-dotnet-generator/package-lock.json b/packages/jsii-dotnet-generator/package-lock.json deleted file mode 100644 index 2a6c579be3..0000000000 --- a/packages/jsii-dotnet-generator/package-lock.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "jsii-dotnet-generator", - "version": "0.14.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "jsii-build-tools": { - "version": "file:../jsii-build-tools", - "dev": true, - "requires": { - "fs-extra": "^8.1.0" - } - }, - "jsii-dotnet-jsonmodel": { - "version": "file:../jsii-dotnet-jsonmodel" - } - } -} diff --git a/packages/jsii-dotnet-generator/package.json b/packages/jsii-dotnet-generator/package.json deleted file mode 100644 index b69afc315e..0000000000 --- a/packages/jsii-dotnet-generator/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "jsii-dotnet-generator", - "version": "0.14.2", - "description": ".NET code generator for jsii assemblies", - "main": "index.js", - "private": true, - "scripts": { - "gen": "/bin/bash ./generate.sh", - "build": "/bin/bash ./build.sh", - "test": "/bin/bash ./test.sh", - "package": "package-dotnet" - }, - "dependencies": { - "jsii-dotnet-jsonmodel": "file:../jsii-dotnet-jsonmodel" - }, - "devDependencies": { - "jsii-build-tools": "file:../jsii-build-tools" - }, - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "email": "aws-jsii@amazon.com" - }, - "license": "Apache-2.0", - "repository": { - "type": "git", - "url": "https://github.com/aws/jsii.git" - }, - "homepage": "https://github.com/aws/jsii" -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.CLI/Amazon.JSII.Generator.CLI.csproj b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.CLI/Amazon.JSII.Generator.CLI.csproj deleted file mode 100644 index e62a84d41c..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.CLI/Amazon.JSII.Generator.CLI.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - Exe - netcoreapp2.0 - - - - - - - - - - - diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.CLI/Options.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.CLI/Options.cs deleted file mode 100644 index feee40ede4..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.CLI/Options.cs +++ /dev/null @@ -1,16 +0,0 @@ -using CommandLine; - -namespace Amazon.JSII.Generator.CLI -{ - class Options - { - [Option('j', "jsii", Required = true, HelpText = "Path to the .jsii spec file")] - public string JsiiFile { get; set; } - - [Option('t', "tarball", Required = true, HelpText = "The location of the module's .tgz file")] - public string Tarball { get; set; } - - [Option('o', "output", Required = true, HelpText = "Directory in which to place generated code.")] - public string OutputDirectory { get; set; } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.CLI/Program.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.CLI/Program.cs deleted file mode 100644 index ee697a72ad..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.CLI/Program.cs +++ /dev/null @@ -1,28 +0,0 @@ -using CommandLine; -using System; -using System.Collections.Generic; - -namespace Amazon.JSII.Generator.CLI -{ - class Program - { - static void Main(string[] args) - { - Parser.Default.ParseArguments(args) - .WithParsed(Generate) - .WithNotParsed(errs => HandleParseError(errs)); - } - - static void HandleParseError(IEnumerable errors) - { - Environment.Exit(1); - } - - static void Generate(Options options) - { - AssemblyGenerator generator = new AssemblyGenerator(options.OutputDirectory); - - generator.Generate(options.JsiiFile, options.Tarball); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.CLI/Properties/PublishProfiles/FolderProfile.pubxml b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.CLI/Properties/PublishProfiles/FolderProfile.pubxml deleted file mode 100644 index f901e37e2c..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.CLI/Properties/PublishProfiles/FolderProfile.pubxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - FileSystem - Release - Any CPU - netcoreapp2.0 - bin\Debug\netcoreapp2.0\publish\ - - \ No newline at end of file diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Amazon.JSII.Generator.UnitTests.csproj b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Amazon.JSII.Generator.UnitTests.csproj deleted file mode 100644 index d9aee9bbeb..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Amazon.JSII.Generator.UnitTests.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - netcoreapp2.0 - - false - - - - - - - - - - - - - - - - diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/AssemblyExtensionsTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/AssemblyExtensionsTests.cs deleted file mode 100644 index 2480d6ef2f..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/AssemblyExtensionsTests.cs +++ /dev/null @@ -1,330 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Linq; -using Xunit; - -namespace Amazon.JSII.Generator.UnitTests -{ - public class AssemblyExtensionsTests - { - const string Prefix = nameof(Generator) + "." + nameof(AssemblyExtensions) + "."; - - public class GetNativeName - { - const string _Prefix = Prefix + nameof(GetNativeName) + "."; - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnNullAssembly))] - public void ThrowsOnNullAssembly() - { - ArgumentNullException exception = Assert.Throws(() => ((Assembly)null).GetNativeNamespace()); - Assert.Equal("assembly", exception.ParamName); - } - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnMissingDotNetKey))] - public void ThrowsOnMissingDotNetKey() - { - Assembly assembly = new Assembly( - name: "myName", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: null, - version: "myVersion", - types: new Dictionary() - ); - - ArgumentException exception = Assert.Throws(() => assembly.GetNativeNamespace()); - Assert.Equal("assembly", exception.ParamName); - } - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnEmptyDotNetNamespace))] - public void ThrowsOnEmptyDotNetNamespace() - { - Assembly assembly = new Assembly( - name: "myName", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: " ", - packageId: "") - ), - version: "myVersion", - types: new Dictionary() - ); - - ArgumentException exception = Assert.Throws(() => assembly.GetNativeNamespace()); - Assert.Equal("assembly", exception.ParamName); - } - - [Fact(DisplayName = _Prefix + nameof(RetrievesDotNetName))] - public void RetrievesDotNetName() - { - Assembly assembly = new Assembly( - name: "myName", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: "myNativeName", - packageId: "myPackageId" - )), - version: "myVersion", - types: new Dictionary() - ); - - string actual = assembly.GetNativeNamespace(); - Assert.Equal("myNativeName", actual); - } - } - - public class GetNativeName_WithPackage - { - const string _Prefix = Prefix + nameof(GetNativeName_WithPackage) + "."; - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnNullAssembly))] - public void ThrowsOnNullAssembly() - { - ArgumentNullException exception = Assert.Throws(() => ((Assembly)null).GetNativeNamespace("myPackage")); - Assert.Equal("assembly", exception.ParamName); - } - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnMissingPackage))] - public void ThrowsOnMissingPackage() - { - Assembly assembly = new Assembly( - name: "myName", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: "myNativeName", - packageId: "myPackageId1" - )), - dependencies: new Dictionary - { - { - "myPackage", - new PackageVersion( - "0.0.1", - new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: "myPackageNativeName", - packageId: "myPackageId2" - - )) - ) - } - }, - version: "myVersion", - types: new Dictionary() - ); - - ArgumentException exception = Assert.Throws(() => assembly.GetNativeNamespace("notMyPackage")); - Assert.Equal("assembly", exception.ParamName); - } - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnMissingDotNetKey))] - public void ThrowsOnMissingDotNetKey() - { - Assembly assembly = new Assembly( - name: "myName", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: "myNativeName", - packageId: "myPackageId" - )), - dependencies: new Dictionary - { - { - "myPackage", - new PackageVersion("0.0.1") - } - }, - version: "myVersion", - types: new Dictionary() - ); - - ArgumentException exception = Assert.Throws(() => assembly.GetNativeNamespace("myPackage")); - Assert.Equal("assembly", exception.ParamName); - } - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnEmptyDotNetKey))] - public void ThrowsOnEmptyDotNetKey() - { - Assembly assembly = new Assembly( - name: "myName", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: "myNativeName", - packageId: "myPackageId1" - )), - dependencies: new Dictionary - { - { - "myPackage", - new PackageVersion( - "0.0.1", - new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: " ", - packageId: "myPackageId2" - )) - ) - } - }, - version: "myVersion", - types: new Dictionary() - ); - - ArgumentException exception = Assert.Throws(() => assembly.GetNativeNamespace("myPackage")); - Assert.Equal("assembly", exception.ParamName); - } - - [Fact(DisplayName = _Prefix + nameof(RetrievesDotNetName))] - public void RetrievesDotNetName() - { - Assembly assembly = new Assembly( - name: "myName", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: "myNativeName", - packageId: "myPackageId1" - )), - dependencies: new Dictionary - { - { - "myPackage", - new PackageVersion( - "0.0.1", - new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: "myPackageNativeName", - packageId: "myPackageId2" - )) - ) - } - }, - version: "myVersion", - types: new Dictionary() - ); - - string actual = assembly.GetNativeNamespace("myPackage"); - Assert.Equal("myPackageNativeName", actual); - } - } - - public class GetMsBuildProperties - { - const string _Prefix = Prefix + nameof(GetMsBuildProperties) + "."; - - public void IncludesAllPresentProperties() - { - Assembly assembly = new Assembly( - name: "my-assembly", - description: "my description", - homepage: "https://www.example.com/", - repository: new Assembly.AssemblyRepository - ( - type: "git", - url: "https://github.com/" - ), - author: new Person - ( - name: "Jane Doe", - roles: new string[] { "Administrator" } - ), - fingerprint: "myFingerprint", - version: "1.2.3", - license: "Apache-2.0", - targets: new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace", - packageId: "My.PackageId", - title: "My Human Readable Title", - signAssembly: true, - assemblyOriginatorKeyFile: "key.snk", - iconUrl: "https://www.example.com/icon.svg" - )) - ); - - IEnumerable actual = assembly.GetMsBuildProperties(); - Assert.Collection(actual, - element => Assert.Equal("netstandard2.0", element.ToString()), - element => Assert.Equal("true", element.ToString()), - element => Assert.Equal("True", element.ToString()), - element => Assert.Equal("True", element.ToString()), - element => Assert.Equal("1.2.3", element.ToString()), - element => Assert.Equal("My.PackageId", element.ToString()), - element => Assert.Equal("my description", element.ToString()), - element => Assert.Equal("https://www.example.com/", element.ToString()), - element => Assert.Equal("https://spdx.org/licenses/Apache-2.0.html", element.ToString()), - element => Assert.Equal("Jane Doe", element.ToString()), - element => Assert.Equal("My Human Readable Title", element.ToString()), - element => Assert.Equal("true", element.ToString()), - element => Assert.Equal("key.snk", element.ToString()), - element => Assert.Equal("http://www.example.com/icon.svg", element.ToString()) - ); - } - - public void SkipsNullProperties() - { - Assembly assembly = new Assembly( - description: "my description", - homepage: "https://www.example.com/", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person - ( - name: "Jane Doe", - roles: new string[] { } - ), - fingerprint: "", - license: "Apache-2.0", - name: "my-assembly", - version: "1.2.3", - targets: new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace", - packageId: "My.PackageId" - )) - ); - - IEnumerable actual = assembly.GetMsBuildProperties(); - Assert.Collection(actual, - element => Assert.Equal("netstandard2.0", element.ToString()), - element => Assert.Equal("true", element.ToString()), - element => Assert.Equal("1.2.3", element.ToString()), - element => Assert.Equal("My.PackageId", element.ToString()), - element => Assert.Equal("my description", element.ToString()), - element => Assert.Equal("https://www.example.com/", element.ToString()), - element => Assert.Equal("https://spdx.org/licenses/Apache-2.0.html", element.ToString()), - element => Assert.Equal("Jane Doe", element.ToString()) - ); - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/AssemblyGeneratorTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/AssemblyGeneratorTests.cs deleted file mode 100644 index 3f54745c24..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/AssemblyGeneratorTests.cs +++ /dev/null @@ -1,648 +0,0 @@ -using Amazon.JSII.JsonModel.FileSystem; -using Amazon.JSII.JsonModel.Spec; -using NSubstitute; -using System.IO; -using Xunit; -using Xunit.Sdk; - -namespace Amazon.JSII.Generator.UnitTests -{ - public class AssemblyGeneratorTests : GeneratorTestBase - { - const string Prefix = nameof(Generator) + "." + nameof(AssemblyGenerator) + "."; - - const string InputRoot = "myInputRoot"; - const string OutputRoot = "myOutputRoot"; - - static string GetJsonPath(string jsiiPackage) - { - return Path.Combine(InputRoot, jsiiPackage, "dist", Constants.SPEC_FILE_NAME); - } - - static string GetPackageOutputRoot(string dotnetPackage) - { - return Path.Combine(OutputRoot, dotnetPackage); - } - - static string GetProjectFilePath(string dotnetPackage, string dotnetAssembly) - { - return $"{Path.Combine(GetPackageOutputRoot(dotnetPackage), dotnetAssembly)}.csproj"; - } - - static string GetAnchorFilePath(string dotnetPackage, string dotnetNamespace) - { - string path = GetPackageOutputRoot(dotnetPackage); - - foreach (string token in dotnetNamespace.Split('.')) { - path = Path.Combine(path, token); - } - - return Path.Combine(path, "Internal", "DependencyResolution", "Anchor.cs"); - } - - static string GetTypeFilePath(string dotnetPackage, string dotnetNamespace, string dotnetType) - { - string directory = Path.Combine(GetPackageOutputRoot(dotnetPackage), Path.Combine(dotnetNamespace.Split('.'))); - return $"{Path.Combine(directory, dotnetType)}.cs"; - } - - [Fact(DisplayName = Prefix + nameof(AccessesFileSystemThroughShim))] - public void AccessesFileSystemThroughShim() - { - const string json = -@"{ - ""name"": ""jsii$aws_cdk_cx_api$"", - ""description"": """", - ""homepage"": """", - ""repository"": { - ""type"": """", - ""url"": """" - }, - ""author"": { - ""name"": """", - ""roles"": [] - }, - ""fingerprint"": """", - ""license"": """", - ""targets"": { - ""dotnet"": { - ""namespace"": ""Aws.Cdk.CxApiNamespace"", - ""packageId"": ""Aws.Cdk.CxApiPackageId"" - } - }, - ""version"": """", - ""types"": { - ""jsii$aws_cdk_cx_api$.MissingContext"": { - ""kind"": ""class"", - ""fqn"": ""jsii$aws_cdk_cx_api$.MissingContext"", - ""assembly"": ""jsii$aws_cdk_cx_api$"", - ""name"": ""MissingContext"", - ""initializer"": { - ""initializer"": true - } - } - } -}"; - - string jsonPath = GetJsonPath("aws-cdk-cx-api"); - string packageOutputRoot = GetPackageOutputRoot("Aws.Cdk.CxApiPackageId"); - string projectFilePath = GetProjectFilePath("Aws.Cdk.CxApiPackageId", "Aws.Cdk.CxApiPackageId"); - string typeFilePath = GetTypeFilePath("Aws.Cdk.CxApiPackageId", "Aws.Cdk.CxApiNamespace", "MissingContext"); - - IDirectory directory = Substitute.For(); - directory.Exists(packageOutputRoot).Returns(true, false); - - IFile file = Substitute.For(); - file.ReadAllText(jsonPath).Returns(json); - - IFileSystem fileSystem = Substitute.For(); - fileSystem.Directory.Returns(directory); - fileSystem.File.Returns(file); - - //Symbols.MapTypeToPackage("aws-cdk-cx-api", "Aws.Cdk.CxApi"); - Symbols.MapNamespace("jsii$aws_cdk_cx_api$", "Aws.Cdk.CxApiNamespace"); - Symbols.MapTypeName("jsii$aws_cdk_cx_api$.MissingContext", "MissingContext", TypeKind.Class); - - AssemblyGenerator generator = new AssemblyGenerator - ( - OutputRoot, - fileSystem - ); - generator.Generate - ( - Path.Combine(InputRoot, "aws-cdk-cx-api", "dist", Constants.SPEC_FILE_NAME), - Path.Combine(InputRoot, "aws-cdk-cx-api", "aws-cdk-cx-api-1.2.3.5.tgz"), - Symbols - ); - - directory.Received().Delete(packageOutputRoot, true); - directory.Received().CreateDirectory(packageOutputRoot); - file.Received().ReadAllText(jsonPath); - file.Received().WriteAllText(projectFilePath, Arg.Any()); - file.Received().WriteAllText(typeFilePath, Arg.Any()); - } - - [Fact(DisplayName = Prefix + nameof(CopiesJsiiToOutput))] - public void CopiesJsiiToOutput() - { - const string json = -@"{ - ""name"": ""jsii$aws_cdk_cx_api$"", - ""description"": """", - ""homepage"": """", - ""repository"": { - ""type"": """", - ""url"": """" - }, - ""author"": { - ""name"": """", - ""roles"": [] - }, - ""fingerprint"": """", - ""license"": """", - ""targets"": { - ""dotnet"": { - ""namespace"": ""Aws.Cdk.CxApiNamespace"", - ""packageId"": ""Aws.Cdk.CxApiPackageId"" - } - }, - ""version"": """", - ""types"": {} -}"; - - string jsonPath = GetJsonPath("aws-cdk-cx-api"); - string projectFilePath = GetProjectFilePath("Aws.Cdk.CxApi", "Aws.Cdk.CxApi"); - - IFile file = Substitute.For(); - file.ReadAllText(jsonPath).Returns(json); - - IFileSystem fileSystem = Substitute.For(); - fileSystem.Directory.Returns(Substitute.For()); - fileSystem.File.Returns(file); - - Symbols.MapTypeToPackage("aws-cdk-cx-api", "Aws.Cdk.CxApiPackageId"); - - AssemblyGenerator generator = new AssemblyGenerator - ( - OutputRoot, - fileSystem - ); - generator.Generate - ( - Path.Combine(InputRoot, "aws-cdk-cx-api", "dist", Constants.SPEC_FILE_NAME), - Path.Combine(InputRoot, "aws-cdk-cx-api", "aws-cdk-cx-api-1.2.3.5.tgz"), - Symbols - ); - - file.Received().Copy(jsonPath, Path.Combine(OutputRoot, "Aws.Cdk.CxApiPackageId", ".jsii")); - } - - [Fact(DisplayName = Prefix + nameof(CreatesBasicProjectFile))] - public void CreatesBasicProjectFile() - { - const string json = -@"{ - ""name"": ""jsii$aws_cdk_cx_api$"", - ""description"": """", - ""homepage"": """", - ""repository"": { - ""type"": """", - ""url"": """" - }, - ""author"": { - ""name"": """", - ""roles"": [] - }, - ""fingerprint"": """", - ""license"": """", - ""targets"": { - ""dotnet"": { - ""namespace"": ""Aws.Cdk.CxApiNamespace"", - ""packageId"": ""Aws.Cdk.CxApiPackageId"" - } - }, - ""version"": ""1.2.3"", - ""types"": {} -}"; - - string jsonPath = GetJsonPath("aws-cdk-cx-api"); - string projectFilePath = GetProjectFilePath("Aws.Cdk.CxApiPackageId", "Aws.Cdk.CxApiPackageId"); - - IFile file = Substitute.For(); - file.ReadAllText(jsonPath).Returns(json); - - IFileSystem fileSystem = Substitute.For(); - fileSystem.Directory.Returns(Substitute.For()); - fileSystem.File.Returns(file); - - Symbols.MapTypeToPackage("aws-cdk-cx-api", "Aws.Cdk.CxApiPackageId"); - - AssemblyGenerator generator = new AssemblyGenerator - ( - OutputRoot, - fileSystem - ); - generator.Generate - ( - Path.Combine(InputRoot, "aws-cdk-cx-api", "dist", Constants.SPEC_FILE_NAME), - Path.Combine(InputRoot, "aws-cdk-cx-api", "aws-cdk-cx-api-1.2.3.5.tgz"), - Symbols - ); - - string expected = -@" - - netstandard2.0 - true - true - true - myAuthors - myCompany - 1.2.3 - - - - - - - -"; - file.Received().WriteAllText(projectFilePath, Arg.Do(actual => PlatformIndependentEqual(expected, actual))); - } - - [Fact(DisplayName = Prefix + nameof(CreatesProjectFileWithDependencies))] - public void CreatesProjectFileWithDependencies() - { - string json = -@"{ - ""name"": ""jsii$aws_cdk$"", - ""description"": """", - ""homepage"": """", - ""repository"": { - ""type"": """", - ""url"": """" - }, - ""author"": { - ""name"": """", - ""roles"": [] - }, - ""fingerprint"": """", - ""license"": """", - ""targets"": { - ""dotnet"": { - ""namespace"": ""Aws.CdkNamespace"", - ""packageId"": ""Aws.CdkPackageId"" - } - }, - ""version"": ""1.2.3"", - ""types"": {}, - ""dependencies"": { - ""jsii$aws_cdk_cx_api$"": { - ""package"": ""aws-cdk-cx-api"", - ""version"": """", - ""targets"": { - ""dotnet"": { - ""namespace"": ""Aws.Cdk.CxApi"", - ""packageId"": ""Aws.Cdk.CxApi"" - } - } - } - } -}"; - string cxJson = -@"{ - ""name"": ""jsii$aws_cdk_cx_api$"", - ""description"": """", - ""homepage"": """", - ""repository"": { - ""type"": """", - ""url"": """" - }, - ""author"": { - ""name"": """", - ""roles"": [] - }, - ""fingerprint"": """", - ""license"": """", - ""version"": """", - ""targets"": { - ""dotnet"": { - ""namespace"": ""Aws.Cdk.CxApiNamespace"", - ""packageId"": ""Aws.Cdk.CxApiPackageId"" - } - }, - ""types"": {} -}"; - - string jsonPath = GetJsonPath("aws-cdk"); - string cxJsonPath = Path.Combine(Path.GetDirectoryName(jsonPath), "node_modules", "jsii$aws_cdk_cx_api$"); - string projectFilePath = GetProjectFilePath("Aws.CdkPackageId", "Aws.CdkPackageId"); - - IFile file = Substitute.For(); - file.ReadAllText(jsonPath).Returns(json); - file.ReadAllText(Path.Combine(cxJsonPath, ".jsii")).Returns(cxJson); - - IDirectory directory = Substitute.For(); - directory.Exists(cxJsonPath).Returns(true); - - IFileSystem fileSystem = Substitute.For(); - fileSystem.Directory.Returns(directory); - fileSystem.File.Returns(file); - - Symbols.MapTypeToPackage("aws-cdk", "Aws.CdkPackageId"); - Symbols.MapTypeToPackage("aws-cdk-cx-api", "Aws.Cdk.CxApiNamespace"); - Symbols.MapAssemblyName("jsii$aws_cdk_cx_api$", "Aws.Cdk.CxApiPackageId"); - - AssemblyGenerator generator = new AssemblyGenerator - ( - OutputRoot, - fileSystem - ); - generator.Generate - ( - Path.Combine(InputRoot, "aws-cdk", "dist", Constants.SPEC_FILE_NAME), - Path.Combine(InputRoot, "aws-cdk", "aws-cdk-1.2.3.4.tgz"), - Symbols - ); - - string expected = -@" - - netstandard2.0 - true - myAuthors - myCompany - 1.2.3 - - - - - - - - -"; - file.Received().WriteAllText(projectFilePath, Arg.Do(actual => PlatformIndependentEqual(expected, actual))); - } - - [Fact(DisplayName = Prefix + nameof(CreatesAnchorFile))] - public void CreatesAnchorFile() - { - string json = -@"{ - ""name"": ""jsii$aws_cdk$"", - ""description"": """", - ""homepage"": """", - ""repository"": { - ""type"": """", - ""url"": """" - }, - ""author"": { - ""name"": """", - ""roles"": [] - }, - ""fingerprint"": """", - ""license"": """", - ""targets"": { - ""dotnet"": { - ""namespace"": ""Aws.CdkNamespace"", - ""packageId"": ""Aws.CdkPackageId"" - } - }, - ""version"": ""1.2.3"", - ""types"": {}, - ""dependencies"": { - ""jsii$aws_cdk_cx_api$"": { - ""package"": ""aws-cdk-cx-api"", - ""version"": """", - ""targets"": { - ""dotnet"": { - ""namespace"": ""Aws.Cdk.CxApi"", - ""packageId"": ""Aws.Cdk.CxApi"" - } - } - } - } -}"; - string cxJson = -@"{ - ""name"": ""jsii$aws_cdk_cx_api$"", - ""description"": """", - ""homepage"": """", - ""repository"": { - ""type"": """", - ""url"": """" - }, - ""author"": { - ""name"": """", - ""roles"": [] - }, - ""fingerprint"": """", - ""license"": """", - ""version"": """", - ""targets"": { - ""dotnet"": { - ""namespace"": ""Aws.Cdk.CxApiNamespace"", - ""packageId"": ""Aws.Cdk.CxApiPackageId"" - } - }, - ""types"": {} -}"; - - string jsonPath = GetJsonPath("aws-cdk"); - string cxJsonPath = Path.Combine(Path.GetDirectoryName(jsonPath), "node_modules", "jsii$aws_cdk_cx_api$"); - string anchorFilePath = GetAnchorFilePath("Aws.CdkPackageId", "Aws.CdkNamespace"); - - IFile file = Substitute.For(); - file.ReadAllText(jsonPath).Returns(json); - file.ReadAllText(Path.Combine(cxJsonPath, ".jsii")).Returns(cxJson); - - IDirectory directory = Substitute.For(); - directory.Exists(cxJsonPath).Returns(true); - - IFileSystem fileSystem = Substitute.For(); - fileSystem.Directory.Returns(directory); - fileSystem.File.Returns(file); - - Symbols.MapTypeToPackage("aws-cdk", "Aws.CdkPackageId"); - Symbols.MapTypeToPackage("aws-cdk-cx-api", "Aws.Cdk.CxApiNamespace"); - Symbols.MapAssemblyName("jsii$aws_cdk_cx_api$", "Aws.Cdk.CxApiPackageId"); - - AssemblyGenerator generator = new AssemblyGenerator - ( - OutputRoot, - fileSystem - ); - generator.Generate - ( - Path.Combine(InputRoot, "aws-cdk", "dist", Constants.SPEC_FILE_NAME), - Path.Combine(InputRoot, "aws-cdk", "aws-cdk-1.2.3.4.tgz"), - Symbols - ); - - string expected = -@"namespace Aws.CdkNamespace.Internal.DependencyResolution -{ - public class Anchor - { - public Anchor() - { - new Aws.Cdk.CxApiNamespace.Internal.DependencyResolution.Anchor(); - } - } -}"; - file.Received().WriteAllText(anchorFilePath, Arg.Do(actual => PlatformIndependentEqual(expected, actual))); - } - - [Fact(DisplayName = Prefix + nameof(CreatesAssemblyInfo))] - public void CreatesAssemblyInfo() - { - const string json = -@"{ - ""name"": ""jsii$aws_cdk_cx_api$"", - ""description"": """", - ""homepage"": """", - ""repository"": { - ""type"": """", - ""url"": """" - }, - ""author"": { - ""name"": """", - ""roles"": [] - }, - ""fingerprint"": """", - ""license"": """", - ""targets"": { - ""dotnet"": { - ""namespace"": ""Aws.Cdk.CxApiNamespace"", - ""packageId"": ""Aws.Cdk.CxApiPackageId"" - } - }, - ""version"": """", - ""types"": {} -}"; - - string jsonPath = GetJsonPath("aws-cdk-cx-api"); - string projectFilePath = GetProjectFilePath("Aws.Cdk.CxApiPackageId", "Aws.Cdk.CxApiPackageId"); - - IFile file = Substitute.For(); - file.ReadAllText(jsonPath).Returns(json); - - IFileSystem fileSystem = Substitute.For(); - fileSystem.Directory.Returns(Substitute.For()); - fileSystem.File.Returns(file); - - Symbols.MapTypeToPackage("aws-cdk-cx-api", "Aws.Cdk.CxApiPackageId"); - - AssemblyGenerator generator = new AssemblyGenerator - ( - OutputRoot, - fileSystem - ); - generator.Generate - ( - Path.Combine(InputRoot, "aws-cdk-cx-api", "dist", Constants.SPEC_FILE_NAME), - Path.Combine(InputRoot, "aws-cdk-cx-api", "aws-cdk-cx-api-1.2.3.5.tgz"), - Symbols - ); - - file.Received().WriteAllText(Path.Combine(OutputRoot, "Aws.Cdk.CxApiPackageId", "AssemblyInfo.cs"), - Arg.Do( - code => Assert.Equal( -@"using Amazon.JSII.Runtime.Deputy; - -[assembly: JsiiAssembly(""jsii$aws_cdk_cx_api$"", """", ""aws-cdk-cx-api-1.2.3.5.tgz"")]", - code, - ignoreLineEndingDifferences: true - ) - ) - ); - } - - [Fact(DisplayName = Prefix + nameof(CreatesBasicTypeFile))] - public void CreatesBasicTypeFile() - { - const string json = -@"{ - ""name"": ""jsii$aws_cdk_cx_api$"", - ""description"": """", - ""homepage"": """", - ""repository"": { - ""type"": """", - ""url"": """" - }, - ""author"": { - ""name"": """", - ""roles"": [] - }, - ""fingerprint"": """", - ""license"": """", - ""targets"": { - ""dotnet"": { - ""namespace"": ""Aws.Cdk.CxApiNamespace"", - ""packageId"": ""Aws.Cdk.CxApiPackageId"" - } - }, - ""version"": """", - ""types"": { - ""jsii$aws_cdk_cx_api$.MissingContext"": { - ""kind"": ""class"", - ""fqn"": ""jsii$aws_cdk_cx_api$.MissingContext"", - ""assembly"": ""jsii$aws_cdk_cx_api$"", - ""name"": ""MissingContext"", - ""initializer"": { - ""initializer"": true - } - } - } -}"; - - string jsonPath = GetJsonPath("aws-cdk-cx-api"); - string typeFilePath = GetTypeFilePath("Aws.Cdk.CxApiPackageId", "Aws.Cdk.CxApiNamespace", "MissingContext"); - - IFile file = Substitute.For(); - file.ReadAllText(jsonPath).Returns(json); - - IFileSystem fileSystem = Substitute.For(); - fileSystem.Directory.Returns(Substitute.For()); - fileSystem.File.Returns(file); - - Symbols.MapTypeToPackage("aws-cdk-cx-api", "Aws.Cdk.CxApiPackageId"); - Symbols.MapNamespace("jsii$aws_cdk_cx_api$", "Aws.Cdk.CxApiNamespace"); - Symbols.MapTypeName("jsii$aws_cdk_cx_api$.MissingContext", "MissingContext", TypeKind.Class); - - AssemblyGenerator generator = new AssemblyGenerator - ( - OutputRoot, - fileSystem - ); - generator.Generate - ( - Path.Combine(InputRoot, "aws-cdk-cx-api", "dist", Constants.SPEC_FILE_NAME), - Path.Combine(InputRoot, "aws-cdk-cx-api", "aws-cdk-cx-api-1.1.1.tgz"), - Symbols - ); - - - string expected = -@"using Amazon.JSII.Runtime.Deputy; - -namespace Aws.Cdk.CxApiNamespace -{ - [JsiiClass(nativeType: typeof(MissingContext), fullyQualifiedName: ""jsii$aws_cdk_cx_api$.MissingContext"")] - public class MissingContext : DeputyBase - { - public MissingContext(): base(new DeputyProps(new object[]{})) - { - } - - protected MissingContext(ByRefValue reference): base(reference) - { - } - - protected MissingContext(DeputyProps props): base(props) - { - } - } -}"; - - file.Received().WriteAllText(typeFilePath, - Arg.Is(actual => PlatformIndependentEqual(expected, actual)) - ); - } - - bool PlatformIndependentEqual(string expected, string actual) - { - try - { - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - catch (EqualException) - { - return false; - } - - return true; - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Class/AbstractClassProxyGeneratorTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Class/AbstractClassProxyGeneratorTests.cs deleted file mode 100644 index aa94abb45d..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Class/AbstractClassProxyGeneratorTests.cs +++ /dev/null @@ -1,184 +0,0 @@ -using Amazon.JSII.Generator.Class; -using Amazon.JSII.JsonModel.Spec; -using Xunit; -using System.Collections.Generic; - -namespace Amazon.JSII.Generator.UnitTests.Class -{ - public class AbstractClassProxyGeneratorTests : GeneratorTestBase - { - private const string Prefix = nameof(Generator) + "." + nameof(AbstractClassProxyGenerator) + "."; - - private string Render(ClassType classType) - { - Symbols.MapTypeToPackage("myFqn", classType.Assembly); - Symbols.MapNamespace(classType.QualifiedNamespace, "MyNamespace"); - Symbols.MapTypeName("myFqn", "MyClass", TypeKind.Class); - - var generator = new AbstractClassProxyGenerator(classType.Assembly, classType, Symbols, Namespaces); - - var syntaxTree = generator.CreateSyntaxTree(); - return syntaxTree.ToString(); - } - - [Fact(DisplayName = Prefix + nameof(IncludesAttribute))] - public void IncludesAttribute() - { - var classType = new ClassType - ( - "myFqn", - "myPackage", - "myClass", - true, - initializer: new Initializer() - ); - - var actual = Render(classType); - var expected = - @"namespace MyNamespace -{ - [JsiiTypeProxy(nativeType: typeof(MyClass), fullyQualifiedName: ""myFqn"")] - internal sealed class MyClassProxy : MyClass - { - private MyClassProxy(ByRefValue reference): base(reference) - { - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesDocs))] - public void IncludesDocs() - { - // Docs are not currently generated as part of the C# code. - ClassType classType = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "myPackage", - name: "myClass", - isAbstract: true, - initializer: new Initializer(), - docs: new Docs(custom: new Dictionary{{"foo", "bar"}}) - ); - - string actual = Render(classType); - string expected = - @"namespace MyNamespace -{ - /// foo: bar - [JsiiTypeProxy(nativeType: typeof(MyClass), fullyQualifiedName: ""myFqn"")] - internal sealed class MyClassProxy : MyClass - { - private MyClassProxy(ByRefValue reference): base(reference) - { - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesProperties))] - public void IncludesProperties() - { - ClassType classType = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "myPackage", - name: "myClass", - isAbstract: true, - initializer: new Initializer(), - properties: new[] - { - new Property - ( - name: "myProp", - type: new TypeReference("myPropTypeFqn"), - isImmutable: false, - isAbstract: true, - isProtected: false - ), - new Property - ( - name: "notMyProp", - type: new TypeReference("myPropTypeFqn"), - isImmutable: false, - isAbstract: false, - isProtected: false - ) - } - ); - - Symbols.MapTypeName("myPropTypeFqn", "MyPropType", TypeKind.Class); - Symbols.MapPropertyName("myFqn", "myProp", "MyProp"); - - string actual = Render(classType); - string expected = - @"namespace MyNamespace -{ - [JsiiTypeProxy(nativeType: typeof(MyClass), fullyQualifiedName: ""myFqn"")] - internal sealed class MyClassProxy : MyClass - { - private MyClassProxy(ByRefValue reference): base(reference) - { - } - - [JsiiProperty(name: ""myProp"", typeJson: ""{\""fqn\"":\""myPropTypeFqn\""}"")] - public override MyPropType MyProp - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesMethods))] - public void IncludesMethods() - { - ClassType classType = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "myPackage", - name: "myClass", - isAbstract: true, - initializer: new Initializer(), - methods: new[] - { - new Method - ( - isAbstract: true, - name: "myMethod" - ), - new Method - ( - name: "notMyMethod" - ) - } - ); - - Symbols.MapMethodName("myFqn", "myMethod", "MyMethod"); - - string actual = Render(classType); - string expected = - @"namespace MyNamespace -{ - [JsiiTypeProxy(nativeType: typeof(MyClass), fullyQualifiedName: ""myFqn"")] - internal sealed class MyClassProxy : MyClass - { - private MyClassProxy(ByRefValue reference): base(reference) - { - } - - [JsiiMethod(name: ""myMethod"")] - public override void MyMethod() - { - InvokeInstanceVoidMethod(new object[]{}); - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - } -} \ No newline at end of file diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Class/ClassGeneratorTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Class/ClassGeneratorTests.cs deleted file mode 100644 index b4fe4d7caa..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Class/ClassGeneratorTests.cs +++ /dev/null @@ -1,351 +0,0 @@ -using Amazon.JSII.Generator.Class; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Xunit; -using TypeKind = Amazon.JSII.JsonModel.Spec.TypeKind; -using System.Collections.Generic; - -namespace Amazon.JSII.Generator.UnitTests.Class -{ - public class ClassGeneratorTests : GeneratorTestBase - { - const string Prefix = nameof(Generator) + "." + nameof(ClassGenerator) + "."; - - private string Render(ClassType classType) - { - Symbols.MapTypeToPackage("myFqn", classType.Assembly); - Symbols.MapNamespace(classType.QualifiedNamespace, "MyNamespace"); - Symbols.MapTypeName("myFqn", "MyClass", TypeKind.Class); - - ClassGenerator generator = new ClassGenerator(classType.Assembly, classType, Symbols, Namespaces); - - SyntaxTree syntaxTree = generator.CreateSyntaxTree(); - return syntaxTree.ToString(); - } - - [Fact(DisplayName = Prefix + nameof(IncludesAttribute))] - public void IncludesAttribute() - { - ClassType classType = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "myPackage", - name: "myClass", - isAbstract: false, - initializer: new Initializer() - ); - - string actual = Render(classType); - string expected = - @"namespace MyNamespace -{ - [JsiiClass(nativeType: typeof(MyClass), fullyQualifiedName: ""myFqn"")] - public class MyClass : DeputyBase - { - public MyClass(): base(new DeputyProps(new object[]{})) - { - } - - protected MyClass(ByRefValue reference): base(reference) - { - } - - protected MyClass(DeputyProps props): base(props) - { - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(AllowsPrivateConstructor))] - public void AllowsPrivateConstructor() - { - ClassType classType = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "myPackage", - name: "myClass", - isAbstract: false - ); - - string actual = Render(classType); - string expected = - @"namespace MyNamespace -{ - [JsiiClass(nativeType: typeof(MyClass), fullyQualifiedName: ""myFqn"")] - public class MyClass : DeputyBase - { - protected MyClass(ByRefValue reference): base(reference) - { - } - - protected MyClass(DeputyProps props): base(props) - { - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesAbstractKeyword))] - public void IncludesAbstractKeyword() - { - ClassType classType = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "myPackage", - name: "myClass", - isAbstract: true, - initializer: new Initializer() - ); - - string actual = Render(classType); - string expected = - @"namespace MyNamespace -{ - [JsiiClass(nativeType: typeof(MyClass), fullyQualifiedName: ""myFqn"")] - public abstract class MyClass : DeputyBase - { - protected MyClass(): base(new DeputyProps(new object[]{})) - { - } - - protected MyClass(ByRefValue reference): base(reference) - { - } - - protected MyClass(DeputyProps props): base(props) - { - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesDocs))] - public void IncludesDocs() - { - // Docs are not currently generated as part of the C# code. - ClassType classType = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "myPackage", - name: "myClass", - isAbstract: false, - initializer: new Initializer(), - docs: new Docs(custom: new Dictionary{{"foo", "bar"}}) - ); - - string actual = Render(classType); - string expected = - @"namespace MyNamespace -{ - /// foo: bar - [JsiiClass(nativeType: typeof(MyClass), fullyQualifiedName: ""myFqn"")] - public class MyClass : DeputyBase - { - public MyClass(): base(new DeputyProps(new object[]{})) - { - } - - protected MyClass(ByRefValue reference): base(reference) - { - } - - protected MyClass(DeputyProps props): base(props) - { - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesProperties))] - public void IncludesProperties() - { - ClassType classType = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "myPackage", - name: "myClass", - isAbstract: false, - initializer: new Initializer(), - properties: new[] - { - new Property - ( - name: "myProp", - type: new TypeReference("myPropTypeFqn"), - isImmutable: false, - isAbstract: false, - isProtected: false - ) - } - ); - - Symbols.MapTypeName("myPropTypeFqn", "MyPropType", TypeKind.Class); - Symbols.MapPropertyName("myFqn", "myProp", "MyProp"); - - string actual = Render(classType); - string expected = - @"namespace MyNamespace -{ - [JsiiClass(nativeType: typeof(MyClass), fullyQualifiedName: ""myFqn"")] - public class MyClass : DeputyBase - { - public MyClass(): base(new DeputyProps(new object[]{})) - { - } - - protected MyClass(ByRefValue reference): base(reference) - { - } - - protected MyClass(DeputyProps props): base(props) - { - } - - [JsiiProperty(name: ""myProp"", typeJson: ""{\""fqn\"":\""myPropTypeFqn\""}"")] - public virtual MyPropType MyProp - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesMethods))] - public void IncludesMethods() - { - ClassType classType = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "myPackage", - name: "myClass", - isAbstract: false, - initializer: new Initializer(), - methods: new[] - { - new Method - ( - name: "myMethod" - ) - } - ); - - Symbols.MapMethodName("myFqn", "myMethod", "MyMethod"); - - string actual = Render(classType); - string expected = - @"namespace MyNamespace -{ - [JsiiClass(nativeType: typeof(MyClass), fullyQualifiedName: ""myFqn"")] - public class MyClass : DeputyBase - { - public MyClass(): base(new DeputyProps(new object[]{})) - { - } - - protected MyClass(ByRefValue reference): base(reference) - { - } - - protected MyClass(DeputyProps props): base(props) - { - } - - [JsiiMethod(name: ""myMethod"")] - public virtual void MyMethod() - { - InvokeInstanceVoidMethod(new object[]{}); - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesBase))] - public void IncludesBase() - { - ClassType classType = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "myPackage", - name: "myClass", - isAbstract: false, - initializer: new Initializer(), - @base: "myBaseTypeFqn" - ); - - Symbols.MapTypeName("myBaseTypeFqn", "MyBaseType", TypeKind.Class); - - string actual = Render(classType); - string expected = - @"namespace MyNamespace -{ - [JsiiClass(nativeType: typeof(MyClass), fullyQualifiedName: ""myFqn"")] - public class MyClass : MyBaseType - { - public MyClass(): base(new DeputyProps(new object[]{})) - { - } - - protected MyClass(ByRefValue reference): base(reference) - { - } - - protected MyClass(DeputyProps props): base(props) - { - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesInterfaces))] - public void IncludesInterfaces() - { - ClassType classType = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "myPackage", - name: "myClass", - isAbstract: false, - initializer: new Initializer(), - interfaces: new[] - { - "myInterfaceFqn1", - "myInterfaceFqn2", - } - ); - - Symbols.MapTypeName("myInterfaceFqn1", "MyInterface1", TypeKind.Interface); - Symbols.MapTypeName("myInterfaceFqn2", "MyInterface2", TypeKind.Interface); - - string actual = Render(classType); - string expected = - @"namespace MyNamespace -{ - [JsiiClass(nativeType: typeof(MyClass), fullyQualifiedName: ""myFqn"")] - public class MyClass : DeputyBase, IMyInterface1, IMyInterface2 - { - public MyClass(): base(new DeputyProps(new object[]{})) - { - } - - protected MyClass(ByRefValue reference): base(reference) - { - } - - protected MyClass(DeputyProps props): base(props) - { - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - } -} \ No newline at end of file diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Class/ClassMethodGeneratorTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Class/ClassMethodGeneratorTests.cs deleted file mode 100644 index 204b1e44f3..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Class/ClassMethodGeneratorTests.cs +++ /dev/null @@ -1,182 +0,0 @@ -using Amazon.JSII.Generator.Class; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Xunit; -using System.Collections.Generic; - -namespace Amazon.JSII.Generator.UnitTests.Class -{ - public class ClassMethodGeneratorTests : GeneratorTestBase - { - const string Prefix = nameof(Generator) + "." + nameof(ClassMethodGenerator) + "."; - - string Render(Method method) - { - ClassType classType = new ClassType - ( - fullyQualifiedName: "myClassFqn", - assembly: "myModule", - name: "myClass", - isAbstract: true, - initializer: new Initializer(), - methods: new[] { method } - ); - - Symbols.MapTypeToPackage("myClassFqn", "myPackage"); - Symbols.MapNamespace("myNamespace", "MyNamespace"); - Symbols.MapTypeName("myClassFqn", "MyClass", JsonModel.Spec.TypeKind.Class); - - ClassMethodGenerator generator = new ClassMethodGenerator(classType, method, Symbols, Namespaces); - - MethodDeclarationSyntax methodSyntax = generator.CreateMethod(); - return methodSyntax.NormalizeWhitespace(elasticTrivia: true).ToString(); - } - - [Fact(DisplayName = Prefix + nameof(IncludesProtectedKeyword))] - public void IncludesAttribute() - { - Method method = new Method(name: "myMethod"); - - Symbols.MapMethodName("myClassFqn", "myMethod", "MyMethod"); - - string actual = Render(method); - string expected = -@"[JsiiMethod(name: ""myMethod"")] -public virtual void MyMethod() -{ - InvokeInstanceVoidMethod(new object[]{}); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesProtectedKeyword))] - public void IncludesProtectedKeyword() - { - Method method = new Method(isProtected: true, name: "myMethod"); - - Symbols.MapMethodName("myClassFqn", "myMethod", "MyMethod"); - - string actual = Render(method); - string expected = -@"[JsiiMethod(name: ""myMethod"")] -protected virtual void MyMethod() -{ - InvokeInstanceVoidMethod(new object[]{}); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesAbstractKeyword))] - public void IncludesAbstractKeyword() - { - Method method = new Method(isAbstract: true, name: "myMethod"); - - Symbols.MapMethodName("myClassFqn", "myMethod", "MyMethod"); - - string actual = Render(method); - string expected = -@"[JsiiMethod(name: ""myMethod"")] -public abstract void MyMethod();"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncluesParameters))] - public void IncluesParameters() - { - Method method = new Method - ( - name: "myMethod", - parameters: new[] - { - new Parameter(name: "myParam", type: new TypeReference("myParamTypeFqn")), - new Parameter(name: "event", type: new TypeReference(primitive: PrimitiveType.String)) - } - ); - - Symbols.MapMethodName("myClassFqn", "myMethod", "MyMethod"); - Symbols.MapTypeName("myParamTypeFqn", "MyParamType", JsonModel.Spec.TypeKind.Class); - Symbols.MapParameterName("myParam", "myParam"); - Symbols.MapParameterName("event", "@event"); - - string actual = Render(method); - string expected = -@"[JsiiMethod(name: ""myMethod"", parametersJson: ""[{\""name\"":\""myParam\"",\""type\"":{\""fqn\"":\""myParamTypeFqn\""}},{\""name\"":\""event\"",\""type\"":{\""primitive\"":\""string\""}}]"")] -public virtual void MyMethod(MyParamType myParam, string @event) -{ - InvokeInstanceVoidMethod(new object[]{myParam, @event}); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(DoesNotIncludeDocs))] - public void DoesNotIncludeDocs() - { - Method method = new Method - ( - name: "myMethod", - docs: new Docs(custom: new Dictionary{{"foo", "bar"}}) - ); - - Symbols.MapMethodName("myClassFqn", "myMethod", "MyMethod"); - - string actual = Render(method); - string expected = -@"[JsiiMethod(name: ""myMethod"")] -public virtual void MyMethod() -{ - InvokeInstanceVoidMethod(new object[]{}); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesReturnTypeForNonVoid))] - public void IncludesReturnTypeForNonVoid() - { - Method method = new Method - ( - isProtected: false, - isAbstract: false, - name: "myMethod", - returns: new OptionalValue(type: new TypeReference("myReturnTypeFqn")) - ); - - Symbols.MapMethodName("myClassFqn", "myMethod", "MyMethod"); - Symbols.MapTypeName("myReturnTypeFqn", "MyReturnType", JsonModel.Spec.TypeKind.Class); - - string actual = Render(method); - string expected = -@"[JsiiMethod(name: ""myMethod"", returnsJson: ""{\""type\"":{\""fqn\"":\""myReturnTypeFqn\""}}"")] -public virtual MyReturnType MyMethod() -{ - return InvokeInstanceMethod(new object[]{}); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(SupportsStaticMethods))] - public void SupportsStaticMethods() - { - Method method = new Method - ( - isProtected: false, - isAbstract: false, - name: "myMethod", - returns: new OptionalValue(type: new TypeReference("myReturnTypeFqn")), - isStatic: true - ); - - Symbols.MapMethodName("myClassFqn", "myMethod", "MyMethod"); - Symbols.MapTypeName("myReturnTypeFqn", "MyReturnType", JsonModel.Spec.TypeKind.Class); - - string actual = Render(method); - string expected = -@"[JsiiMethod(name: ""myMethod"", returnsJson: ""{\""type\"":{\""fqn\"":\""myReturnTypeFqn\""}}"")] -public static MyReturnType MyMethod() -{ - return InvokeStaticMethod(typeof(MyClass), new object[]{}); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Class/ClassPropertyGeneratorTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Class/ClassPropertyGeneratorTests.cs deleted file mode 100644 index 7b4fc3b06f..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Class/ClassPropertyGeneratorTests.cs +++ /dev/null @@ -1,218 +0,0 @@ -using Amazon.JSII.Generator.Class; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Xunit; -using System.Collections.Generic; - -namespace Amazon.JSII.Generator.UnitTests.Class -{ - public class ClassPropertyGeneratorTests : GeneratorTestBase - { - const string Prefix = nameof(Generator) + "." + nameof(ClassPropertyGenerator) + "."; - - string Render(Property property) - { - ClassType classType = new ClassType - ( - fullyQualifiedName: "myClassFqn", - assembly: "myModule", - name: "myClass", - @namespace: "myNamespace", - isAbstract: true, - initializer: new Initializer(), - properties: new[] { property } - ); - - Symbols.MapTypeToPackage("myClassFqn", "myPackage"); - Symbols.MapNamespace("myNamespace", "MyNamespace"); - Symbols.MapTypeName("myClassFqn", "MyClass", JsonModel.Spec.TypeKind.Class); - - ClassPropertyGenerator generator = new ClassPropertyGenerator(classType, property, Symbols, Namespaces); - - PropertyDeclarationSyntax methodSyntax = generator.CreateProperty(); - return methodSyntax.NormalizeWhitespace(elasticTrivia: true).ToString(); - } - - [Fact(DisplayName = Prefix + nameof(IncludesAttribute))] - public void IncludesAttribute() - { - Property property = new Property - ( - name: "myProperty", - type: new TypeReference("myPropTypeFqn"), - isImmutable: true, - isAbstract: false, - isProtected: false - ); - - Symbols.MapPropertyName("myClassFqn", "myProperty", "MyProperty"); - Symbols.MapTypeName("myPropTypeFqn", "MyPropType", JsonModel.Spec.TypeKind.Class); - - string actual = Render(property); - string expected = -@"[JsiiProperty(name: ""myProperty"", typeJson: ""{\""fqn\"":\""myPropTypeFqn\""}"")] -public virtual MyPropType MyProperty -{ - get => GetInstanceProperty(); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesGetter))] - public void IncludesGetter() - { - Property property = new Property - ( - name: "myProperty", - type: new TypeReference("myPropTypeFqn"), - isImmutable: true, - isAbstract: false, - isProtected: false - ); - - Symbols.MapPropertyName("myClassFqn", "myProperty", "MyProperty"); - Symbols.MapTypeName("myPropTypeFqn", "MyPropType", JsonModel.Spec.TypeKind.Class); - - string actual = Render(property); - string expected = -@"[JsiiProperty(name: ""myProperty"", typeJson: ""{\""fqn\"":\""myPropTypeFqn\""}"")] -public virtual MyPropType MyProperty -{ - get => GetInstanceProperty(); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesSetter))] - public void IncludesSetter() - { - Property property = new Property - ( - name: "myProperty", - type: new TypeReference("myPropTypeFqn"), - isImmutable: false, - isAbstract: false, - isProtected: false - ); - - Symbols.MapPropertyName("myClassFqn", "myProperty", "MyProperty"); - Symbols.MapTypeName("myPropTypeFqn", "MyPropType", JsonModel.Spec.TypeKind.Class); - - string actual = Render(property); - string expected = -@"[JsiiProperty(name: ""myProperty"", typeJson: ""{\""fqn\"":\""myPropTypeFqn\""}"")] -public virtual MyPropType MyProperty -{ - get => GetInstanceProperty(); - set => SetInstanceProperty(value); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesProtectedKeyword))] - public void IncludesProtectedKeyword() - { - Property property = new Property - ( - name: "myProperty", - type: new TypeReference("myPropTypeFqn"), - isImmutable: true, - isAbstract: false, - isProtected: true - ); - - Symbols.MapPropertyName("myClassFqn", "myProperty", "MyProperty"); - Symbols.MapTypeName("myPropTypeFqn", "MyPropType", JsonModel.Spec.TypeKind.Class); - - string actual = Render(property); - string expected = -@"[JsiiProperty(name: ""myProperty"", typeJson: ""{\""fqn\"":\""myPropTypeFqn\""}"")] -protected virtual MyPropType MyProperty -{ - get => GetInstanceProperty(); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(SupportsStaticProperties))] - public void SupportsStaticProperties() - { - Property property = new Property - ( - name: "myProperty", - type: new TypeReference("myPropTypeFqn"), - isImmutable: false, - isAbstract: false, - isProtected: false, - isStatic: true - ); - - Symbols.MapPropertyName("myClassFqn", "myProperty", "MyProperty"); - Symbols.MapTypeName("myPropTypeFqn", "MyPropType", JsonModel.Spec.TypeKind.Class); - - string actual = Render(property); - string expected = -@"[JsiiProperty(name: ""myProperty"", typeJson: ""{\""fqn\"":\""myPropTypeFqn\""}"")] -public static MyPropType MyProperty -{ - get => GetStaticProperty(typeof(MyClass)); - set => SetStaticProperty(typeof(MyClass), value); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(OptimizesConstantProperties))] - public void OptimizesConstantProperties() - { - Property property = new Property - ( - name: "myProperty", - type: new TypeReference("myPropTypeFqn"), - isAbstract: false, - isProtected: false, - isConstant: true - ); - - Symbols.MapPropertyName("myClassFqn", "myProperty", "MyProperty"); - Symbols.MapTypeName("myPropTypeFqn", "MyPropType", JsonModel.Spec.TypeKind.Class); - - string actual = Render(property); - string expected = -@"[JsiiProperty(name: ""myProperty"", typeJson: ""{\""fqn\"":\""myPropTypeFqn\""}"")] -public static MyPropType MyProperty -{ - get; -} - -= GetStaticProperty(typeof(MyClass));"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(DoesNotIncludeDocs))] - public void DoesNotIncludeDocs() - { - Property property = new Property - ( - name: "myProperty", - type: new TypeReference("myPropTypeFqn"), - isImmutable: true, - isAbstract: false, - isProtected: false, - docs: new Docs(custom: new Dictionary{{"foo", "bar"}}) - ); - - Symbols.MapPropertyName("myClassFqn", "myProperty", "MyProperty"); - Symbols.MapTypeName("myPropTypeFqn", "MyPropType", JsonModel.Spec.TypeKind.Class); - - string actual = Render(property); - string expected = -@"[JsiiProperty(name: ""myProperty"", typeJson: ""{\""fqn\"":\""myPropTypeFqn\""}"")] -public virtual MyPropType MyProperty -{ - get => GetInstanceProperty(); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/DelegateComparerTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/DelegateComparerTests.cs deleted file mode 100644 index 57a1def311..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/DelegateComparerTests.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Xunit; - -namespace Amazon.JSII.Generator.UnitTests -{ - public class DelegateComparerTests - { - const string Prefix = nameof(Generator) + ".DelegateComparer."; - - [Fact(DisplayName = Prefix + nameof(DistinctComparesByComparator))] - public void DistinctComparesByComparator() - { - var comparer = new DelegateComparer, string>(p => p.Key); - - int actual = new[] - { - new KeyValuePair("myKey", "myValue1"), - new KeyValuePair("myKey", "myValue2"), - } - .Distinct(comparer) - .Count(); - - Assert.Equal(1, actual); - } - - [Fact(DisplayName = Prefix + nameof(DistinctComparesByComparator))] - public void HashSetComparesByComparator() - { - var comparer = new DelegateComparer, string>(p => p.Key); - - var items = new[] { - new KeyValuePair("myKey", "myValue1"), - new KeyValuePair("myKey", "myValue2"), - }; - int actual = new HashSet>(items, comparer).Count; - - Assert.Equal(1, actual); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/DocComment/EnumMemberDocCommentGeneratorTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/DocComment/EnumMemberDocCommentGeneratorTests.cs deleted file mode 100644 index 18215a7d2a..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/DocComment/EnumMemberDocCommentGeneratorTests.cs +++ /dev/null @@ -1,150 +0,0 @@ -using Amazon.JSII.Generator.DocComment; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Xunit; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; -using System.Collections.Generic; - -namespace Amazon.JSII.Generator.UnitTests.DocComment -{ - public class EnumMemberDocCommentGeneratorTests : GeneratorTestBase - { - const string Prefix = nameof(Generator) + "." + nameof(EnumMemberDocCommentGenerator) + "."; - - string Render(Docs docs) - { - EnumMember member = new EnumMember("member", docs); - EnumMemberDocCommentGenerator generator = new EnumMemberDocCommentGenerator(member); - - SyntaxTrivia docComment = generator.CreateDocComment(); - SyntaxTree tree = SF.SyntaxTree( - SF.EnumMemberDeclaration("Member") - .WithLeadingTrivia(generator.CreateDocComment()) - .NormalizeWhitespace(elasticTrivia: true) - ); - - return tree.ToString(); - } - - [Fact(DisplayName = Prefix + nameof(IncludesSingleLineSummary))] - public void IncludesSingleLineSummary() - { - Docs docs = new Docs - ( - summary: "my comment" - ); - - string actual = Render(docs); - string expected = -@"/// my comment - Member"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Theory(DisplayName = Prefix + nameof(IncludesMultiLineSummary))] - [InlineData("my\ncomment")] - [InlineData("my\r\ncomment")] - public void IncludesMultiLineSummary(string summary) - { - Docs docs = new Docs - ( - summary: summary - ); - - string actual = Render(docs); - string expected = -@"/// -/// my -/// comment -/// - Member"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesSingleLineRemarks))] - public void IncludesSingleLineRemarks() - { - Docs docs = new Docs - ( - custom: new Dictionary{{ "myKey", "my comment" }} - ); - - string actual = Render(docs); - string expected = -@"/// myKey: my comment - Member"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesMultiLineRemarks))] - public void IncludesMultiLineRemarks() - { - Docs docs = new Docs - ( - custom: new Dictionary{ - { "myKey1", "my\ncomment" }, - { "myKey2", "my\r\ncomment" } - } - ); - - string actual = Render(docs); - string expected = -@"/// -/// myKey1: my -/// comment -/// myKey2: my -/// comment -/// - Member"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(SeparatesSingleLineLink))] - public void SeparatesSingleLineLink() - { - Docs docs = new Docs - ( - custom: new Dictionary{{ "link", "www.example.com" }} - ); - - string actual = Render(docs); - string expected = -@"/// link: www.example.com - Member"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IgnoresParam))] - public void IgnoresParam() - { - Docs docs = new Docs - ( - custom: new Dictionary{{ "param", "my comment" }} - ); - - string actual = Render(docs); - string expected = @"Member"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IgnoresReturns))] - public void IgnoresReturns() - { - Docs docs = new Docs - ( - returns: "my comment" - ); - - string actual = Render(docs); - string expected = @"Member"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/DocComment/MethodDocCommentGeneratorTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/DocComment/MethodDocCommentGeneratorTests.cs deleted file mode 100644 index 2e49a4827c..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/DocComment/MethodDocCommentGeneratorTests.cs +++ /dev/null @@ -1,221 +0,0 @@ -using Amazon.JSII.Generator.DocComment; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Xunit; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; -using System.Collections.Generic; - -namespace Amazon.JSII.Generator.UnitTests.DocComment -{ - public class MethodDocCommentGeneratorTests : GeneratorTestBase - { - const string Prefix = nameof(Generator) + "." + nameof(MethodDocCommentGenerator) + "."; - - string Render(Docs docs, params Parameter[] parameters) - { - Method method = new Method( - parameters: parameters, - docs: docs, - name: "method" - ); - - MethodDocCommentGenerator generator = new MethodDocCommentGenerator(method, Symbols); - - SyntaxTrivia docComment = generator.CreateDocComment(); - SyntaxTree tree = SF.SyntaxTree( - SF.MethodDeclaration(SF.ParseTypeName("void"), "Method") - .WithLeadingTrivia(generator.CreateDocComment()) - .NormalizeWhitespace(elasticTrivia: true) - ); - - return tree.ToString(); - } - - [Fact(DisplayName = Prefix + nameof(IncludesSingleLineSummary))] - public void IncludesSingleLineSummary() - { - Docs docs = new Docs - ( - summary: "my comment" - ); - - string actual = Render(docs); - string expected = -@"/// my comment - void Method()"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Theory(DisplayName = Prefix + nameof(IncludesMultiLineSummary))] - [InlineData("my\ncomment")] - [InlineData("my\r\ncomment")] - public void IncludesMultiLineSummary(string summary) - { - Docs docs = new Docs - ( - summary: summary - ); - - string actual = Render(docs); - string expected = -@"/// -/// my -/// comment -/// - void Method()"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesSingleLineRemarks))] - public void IncludesSingleLineRemarks() - { - Docs docs = new Docs - ( - custom: new Dictionary{{ "myKey", "my comment" }} - ); - - string actual = Render(docs); - string expected = -@"/// myKey: my comment - void Method()"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesMultiLineRemarks))] - public void IncludesMultiLineRemarks() - { - Docs docs = new Docs - ( - custom: new Dictionary{ - { "myKey1", "my\ncomment" }, - { "myKey2", "my\r\ncomment" } - } - ); - - string actual = Render(docs); - string expected = -@"/// -/// myKey1: my -/// comment -/// myKey2: my -/// comment -/// - void Method()"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(SeparatesSingleLineLink))] - public void SeparatesSingleLineLink() - { - Docs docs = new Docs - ( - custom: new Dictionary{ { "link", "www.example.com" } } - ); - - string actual = Render(docs); - string expected = -@"/// link: www.example.com - void Method()"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IgnoresParam))] - public void IgnoresParam() - { - Docs docs = new Docs - ( - custom: new Dictionary{ { "param", "my comment" } } - ); - - string actual = Render(docs); - string expected = @"void Method()"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesReturns))] - public void IncludesReturns() - { - Docs docs = new Docs - ( - returns: "my comment" - ); - - string actual = Render(docs); - string expected = -@"/// my comment - void Method()"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IgnoresParameterParam))] - public void IgnoresParameterParam() - { - Parameter parameter = new Parameter( - name: "myParam", - type: new TypeReference(primitive: PrimitiveType.String), - docs: new Docs - ( - custom: new Dictionary{ { "param", "my comment" } } - ) - ); - - Symbols.MapParameterName("myParam", "myParam"); - - string actual = Render(null, parameter); - string expected = @"void Method()"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IgnoresParameterParam))] - public void TrimsParameterSummary() - { - Parameter parameter = new Parameter( - name: "myParam", - type: new TypeReference(primitive: PrimitiveType.String), - docs: new Docs - ( - summary: "my comment" - ) - ); - - Symbols.MapParameterName("myParam", "myParam"); - - string actual = Render(null, parameter); - string expected = -@"/// my comment - void Method()"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesParameterSummary))] - public void IncludesParameterSummary() - { - Parameter parameter = new Parameter( - name: "myParam", - type: new TypeReference(primitive: PrimitiveType.String), - docs: new Docs - ( - summary: "This parameter is swell" - ) - ); - - Symbols.MapParameterName("myParam", "myParam"); - - string actual = Render(null, parameter); - string expected = -@"/// This parameter is swell - void Method()"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/DocComment/PropertyDocCommentGeneratorTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/DocComment/PropertyDocCommentGeneratorTests.cs deleted file mode 100644 index 9f9608983d..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/DocComment/PropertyDocCommentGeneratorTests.cs +++ /dev/null @@ -1,182 +0,0 @@ -using Amazon.JSII.Generator.DocComment; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Xunit; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; -using System.Collections.Generic; - -namespace Amazon.JSII.Generator.UnitTests.DocComment -{ - public class PropertyDocCommentGeneratorTests : GeneratorTestBase - { - const string Prefix = nameof(Generator) + "." + nameof(PropertyDocCommentGenerator) + "."; - - string Render(Docs docs) - { - Property property = new Property( - name: "myProp", - type: new TypeReference(primitive: PrimitiveType.String), - isImmutable: false, - isAbstract: false, - isStatic: false, - docs: docs - ); - - PropertyDocCommentGenerator generator = new PropertyDocCommentGenerator(property); - - SyntaxTrivia docComment = generator.CreateDocComment(); - SyntaxTree tree = SF.SyntaxTree( - SF.PropertyDeclaration(SF.ParseTypeName("string"), "MyProp") - .WithLeadingTrivia(generator.CreateDocComment()) - .NormalizeWhitespace(elasticTrivia: true) - ); - - return tree.ToString(); - } - - [Fact(DisplayName = Prefix + nameof(IncludesSingleLineSummary))] - public void IncludesSingleLineSummary() - { - Docs docs = new Docs - ( - summary: "my comment" - ); - - string actual = Render(docs); - string expected = -@"/// my comment - string MyProp"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Theory(DisplayName = Prefix + nameof(IncludesMultiLineSummary))] - [InlineData("my\ncomment")] - [InlineData("my\r\ncomment")] - public void IncludesMultiLineSummary(string summary) - { - Docs docs = new Docs - ( - summary: summary - ); - - string actual = Render(docs); - string expected = -@"/// -/// my -/// comment -/// - string MyProp"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesSingleLineRemarks))] - public void IncludesSingleLineRemarks() - { - Docs docs = new Docs - ( - custom: new Dictionary{{ "myKey", "my comment" }} - ); - - string actual = Render(docs); - string expected = -@"/// myKey: my comment - string MyProp"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesMultiLineRemarks))] - public void IncludesMultiLineRemarks() - { - Docs docs = new Docs - ( - custom: new Dictionary{ - { "myKey1", "my\ncomment" }, - { "myKey2", "my\r\ncomment" } - } - ); - - string actual = Render(docs); - string expected = -@"/// -/// myKey1: my -/// comment -/// myKey2: my -/// comment -/// - string MyProp"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(SeparatesSingleLineLink))] - public void SeparatesSingleLineLink() - { - Docs docs = new Docs - ( - custom: new Dictionary{{"link", "www.example.com" }} - ); - - string actual = Render(docs); - string expected = -@"/// link: www.example.com - string MyProp"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IgnoresParam))] - public void IgnoresParam() - { - Docs docs = new Docs - ( - custom: new Dictionary{{"param", "my comment" }} - ); - - string actual = Render(docs); - string expected = @"string MyProp"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesReturns))] - public void IncludesReturns() - { - Docs docs = new Docs - ( - returns: "my comment" - ); - - string actual = Render(docs); - string expected = -@"/// my comment - string MyProp"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(ShowsDefault))] - public void ShowsDefault() - { - Docs docs = new Docs - ( - summary: "A property", - remarks: "Some remarks.", - @default: "Tis a default" - ); - - string actual = Render(docs); - string expected = -@"/// A property -/// -/// Some remarks. -/// default: Tis a default -/// - string MyProp"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/DocComment/TypeDocCommentGeneratorTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/DocComment/TypeDocCommentGeneratorTests.cs deleted file mode 100644 index 638272854e..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/DocComment/TypeDocCommentGeneratorTests.cs +++ /dev/null @@ -1,173 +0,0 @@ -using Amazon.JSII.Generator.DocComment; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Xunit; -using System.Collections.Generic; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.UnitTests.DocComment -{ - public class TypeDocCommentGeneratorTests : GeneratorTestBase - { - const string Prefix = nameof(Generator) + "." + nameof(TypeDocCommentGenerator) + "."; - - string Render(Docs docs) - { - Type type = new InterfaceType( - "myFqn", - "myModule", - "myInterfaceName", - "myInterfaceNamespace", - docs - ); - - TypeDocCommentGenerator generator = new TypeDocCommentGenerator(type); - - SyntaxTrivia docComment = generator.CreateDocComment(); - SyntaxTree tree = SF.SyntaxTree( - SF.InterfaceDeclaration("MyInterface") - .WithLeadingTrivia(generator.CreateDocComment()) - .NormalizeWhitespace(elasticTrivia: true) - ); - - return tree.ToString(); - } - - [Fact(DisplayName = Prefix + nameof(IncludesSingleLineSummary))] - public void IncludesSingleLineSummary() - { - Docs docs = new Docs - ( - summary: "my comment" - ); - - string actual = Render(docs); - string expected = -@"/// my comment - interface MyInterface -{ -}"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Theory(DisplayName = Prefix + nameof(IncludesMultiLineSummary))] - [InlineData("my\ncomment")] - [InlineData("my\r\ncomment")] - public void IncludesMultiLineSummary(string summary) - { - Docs docs = new Docs - ( - summary: summary - ); - - string actual = Render(docs); - string expected = -@"/// -/// my -/// comment -/// - interface MyInterface -{ -}"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesSingleLineRemarks))] - public void IncludesSingleLineRemarks() - { - Docs docs = new Docs - ( - custom: new Dictionary{{ "myKey", "my comment" }} - ); - - string actual = Render(docs); - string expected = -@"/// myKey: my comment - interface MyInterface -{ -}"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesMultiLineRemarks))] - public void IncludesMultiLineRemarks() - { - Docs docs = new Docs - ( - custom: new Dictionary{ - { "myKey1", "my\ncomment" }, - { "myKey2", "my\r\ncomment" } - } - ); - - string actual = Render(docs); - string expected = -@"/// -/// myKey1: my -/// comment -/// myKey2: my -/// comment -/// - interface MyInterface -{ -}"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(SeparatesSingleLineLink))] - public void SeparatesSingleLineLink() - { - Docs docs = new Docs - ( - custom: new Dictionary{ { "link", "www.example.com" } } - ); - - string actual = Render(docs); - string expected = -@"/// link: www.example.com - interface MyInterface -{ -}"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IgnoresParam))] - public void IgnoresParam() - { - Docs docs = new Docs - ( - custom: new Dictionary{ { "param", "my comment" } } - ); - - string actual = Render(docs); - string expected = -@"interface MyInterface -{ -}"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IgnoresReturns))] - public void IgnoresReturns() - { - Docs docs = new Docs - ( - returns: "my comment" - ); - - string actual = Render(docs); - string expected = -@"interface MyInterface -{ -}"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Enum/EnumGeneratorTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Enum/EnumGeneratorTests.cs deleted file mode 100644 index 55f4606cbd..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Enum/EnumGeneratorTests.cs +++ /dev/null @@ -1,144 +0,0 @@ -using Amazon.JSII.Generator.Enum; -using Amazon.JSII.Generator.Interface; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Xunit; -using System.Collections.Generic; - -namespace Amazon.JSII.Generator.UnitTests.Enum -{ - public class EnumGeneratorTests : GeneratorTestBase - { - const string Prefix = nameof(Generator) + "." + nameof(InterfaceGenerator) + "."; - - string Render(EnumType enumType) - { - Symbols.MapTypeToPackage("myEnumFqn", enumType.Assembly); - Symbols.MapNamespace(enumType.QualifiedNamespace, "MyNamespace"); - Symbols.MapTypeName("myEnumFqn", "MyEnum", JsonModel.Spec.TypeKind.Enum); - - EnumGenerator generator = new EnumGenerator(enumType.Assembly, enumType, Symbols, Namespaces); - - SyntaxTree syntaxTree = generator.CreateSyntaxTree(); - return syntaxTree.ToString(); - } - - [Fact(DisplayName = Prefix + nameof(IncludesAttribute))] - public void IncludesAttribute() - { - EnumType enumType = new EnumType - ( - fullyQualifiedName: "myEnumFqn", - assembly: "myPackage", - name: "myEnum", - members: new EnumMember[] { } - ); - - string actual = Render(enumType); - string expected = -@"namespace MyNamespace -{ - [JsiiEnum(nativeType: typeof(MyEnum), fullyQualifiedName: ""myEnumFqn"")] - public enum MyEnum - { - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesMembers))] - public void IncludesMembers() - { - EnumType enumType = new EnumType - ( - fullyQualifiedName: "myEnumFqn", - assembly: "myPackage", - name: "myEnum", - members: new EnumMember[] - { - new EnumMember("member1"), - new EnumMember("member2"), - } - ); - - Symbols.MapEnumMemberName("myEnumFqn", "member1", "Member1"); - Symbols.MapEnumMemberName("myEnumFqn", "member2", "Member2"); - - string actual = Render(enumType); - string expected = -@"namespace MyNamespace -{ - [JsiiEnum(nativeType: typeof(MyEnum), fullyQualifiedName: ""myEnumFqn"")] - public enum MyEnum - { - [JsiiEnumMember(name: ""member1"")] - Member1, - [JsiiEnumMember(name: ""member2"")] - Member2 - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesDocs))] - public void IncludesDocs() - { - EnumType enumType = new EnumType - ( - fullyQualifiedName: "myEnumFqn", - assembly: "myPackage", - name: "myEnum", - members: new EnumMember[] { }, - docs: new Docs(custom: new Dictionary{{"foo", "bar"}}) - ); - - string actual = Render(enumType); - string expected = -@"namespace MyNamespace -{ - /// foo: bar - [JsiiEnum(nativeType: typeof(MyEnum), fullyQualifiedName: ""myEnumFqn"")] - public enum MyEnum - { - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesMemberDocs))] - public void IncludesMemberDocs() - { - EnumType enumType = new EnumType - ( - fullyQualifiedName: "myEnumFqn", - assembly: "myPackage", - name: "myEnum", - members: new EnumMember[] - { - new EnumMember("member1", docs: new Docs(custom: new Dictionary{{"foo", "bar"}})), - new EnumMember("member2", docs: new Docs(custom: new Dictionary{{"foo", "bar"}})) - } - ); - - Symbols.MapEnumMemberName("myEnumFqn", "member1", "Member1"); - Symbols.MapEnumMemberName("myEnumFqn", "member2", "Member2"); - - string actual = Render(enumType); - string expected = -@"namespace MyNamespace -{ - [JsiiEnum(nativeType: typeof(MyEnum), fullyQualifiedName: ""myEnumFqn"")] - public enum MyEnum - { - /// foo: bar - [JsiiEnumMember(name: ""member1"")] - Member1, - /// foo: bar - [JsiiEnumMember(name: ""member2"")] - Member2 - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/GeneratorTestBase.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/GeneratorTestBase.cs deleted file mode 100644 index 419e7e6358..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/GeneratorTestBase.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using NSubstitute; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; -using Type = Amazon.JSII.JsonModel.Spec.Type; - -namespace Amazon.JSII.Generator.UnitTests -{ - public abstract class GeneratorTestBase - { - public GeneratorTestBase() - { - Symbols = Substitute.For(); - Namespaces = Substitute.For(); - - Symbols - .GetTypeSyntax(Arg.Is(t => t.Primitive == PrimitiveType.String), false) - .Returns(SF.ParseTypeName("string")); - } - - protected ISymbolMap Symbols { get; } - - protected INamespaceSet Namespaces { get; } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Interface/InterfaceGeneratorTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Interface/InterfaceGeneratorTests.cs deleted file mode 100644 index 4a4eac350f..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Interface/InterfaceGeneratorTests.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Amazon.JSII.Generator.Interface; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Xunit; - -namespace Amazon.JSII.Generator.UnitTests.Interface -{ - public class InterfaceGeneratorTests : GeneratorTestBase - { - const string Prefix = nameof(Generator) + "." + nameof(InterfaceGenerator) + "."; - - string Render(InterfaceType interfaceType) - { - Symbols.MapTypeToPackage("myInterfaceFqn", interfaceType.Assembly); - Symbols.MapNamespace(interfaceType.QualifiedNamespace, "MyNamespace"); - Symbols.MapTypeName("myInterfaceFqn", "MyInterface", kind: JsonModel.Spec.TypeKind.Interface); - - InterfaceGenerator generator = new InterfaceGenerator(interfaceType.Assembly, interfaceType, Symbols, Namespaces); - - SyntaxTree syntaxTree = generator.CreateSyntaxTree(); - return syntaxTree.ToString(); - } - - [Fact(DisplayName = Prefix + nameof(IncludesAttribute))] - public void IncludesAttribute() - { - InterfaceType interfaceType = new InterfaceType - ( - fullyQualifiedName: "myInterfaceFqn", - assembly: "myPackage", - name: "MyInterface" - ); - - string actual = Render(interfaceType); - string expected = -@"namespace MyNamespace -{ - [JsiiInterface(nativeType: typeof(IMyInterface), fullyQualifiedName: ""myInterfaceFqn"")] - public interface IMyInterface - { - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesBaseInterfaces))] - public void IncludesBaseInterfaces() - { - InterfaceType interfaceType = new InterfaceType - ( - fullyQualifiedName: "myInterfaceFqn", - assembly: "myPackage", - name: "MyInterface", - interfaces: new[] - { - "myBaseFqn1", - "myBaseFqn2", - } - ); - - Symbols.MapTypeName("myBaseFqn1", "MyBaseInterface1", kind: JsonModel.Spec.TypeKind.Interface); - Symbols.MapTypeName("myBaseFqn2", "MyBaseInterface2", kind: JsonModel.Spec.TypeKind.Interface); - - string actual = Render(interfaceType); - string expected = -@"namespace MyNamespace -{ - [JsiiInterface(nativeType: typeof(IMyInterface), fullyQualifiedName: ""myInterfaceFqn"")] - public interface IMyInterface : IMyBaseInterface1, IMyBaseInterface2 - { - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesMethods))] - public void IncludesMethods() - { - InterfaceType interfaceType = new InterfaceType - ( - fullyQualifiedName: "myInterfaceFqn", - assembly: "", - name: "MyInterface", - methods: new Method[] { new Method(name: "myMethod", isAbstract: true) } - ); - - Symbols.MapMethodName("myInterfaceFqn", "myMethod", "MyMethod"); - - string actual = Render(interfaceType); - string expected = -@"namespace MyNamespace -{ - [JsiiInterface(nativeType: typeof(IMyInterface), fullyQualifiedName: ""myInterfaceFqn"")] - public interface IMyInterface - { - [JsiiMethod(name: ""myMethod"")] - void MyMethod(); - } -}"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Interface/InterfaceMethodGeneratorTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Interface/InterfaceMethodGeneratorTests.cs deleted file mode 100644 index 535156c6cb..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Interface/InterfaceMethodGeneratorTests.cs +++ /dev/null @@ -1,146 +0,0 @@ -using Amazon.JSII.Generator.Interface; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using NSubstitute; -using Xunit; - -namespace Amazon.JSII.Generator.UnitTests.Interface -{ - public class InterfaceMethodGeneratorTests : GeneratorTestBase - { - const string Prefix = nameof(Generator) + "." + nameof(InterfaceMethodGenerator) + "."; - - string Render(Method method) - { - InterfaceType interfaceType = new InterfaceType - ( - "myInterfaceFqn", - "", - "IMyInterface", - "myNamespace", - methods: new[] { method } - ); - - Symbols.MapMethodName("myInterfaceFqn", "myMethod", "MyMethod"); - Symbols.MapTypeName("myInterfaceFqn", "MyInterface", JsonModel.Spec.TypeKind.Interface); - Symbols.MapTypeName("myReturnTypeFqn", "MyReturnType", JsonModel.Spec.TypeKind.Class); - - InterfaceMethodGenerator generator = new InterfaceMethodGenerator(interfaceType, method, Symbols, Namespaces); - - MethodDeclarationSyntax methodSyntax = generator.CreateMethod(); - return methodSyntax.NormalizeWhitespace(elasticTrivia: true).ToString(); - } - - [Fact(DisplayName = Prefix + nameof(RecordsReferencedReturnType))] - public void RecordsReferencedReturnType() - { - Method method = new Method - ( - isProtected: false, - isAbstract: true, - name: "myMethod", - returns: new OptionalValue(type: new TypeReference(fullyQualifiedName: "myReturnTypeFqn")) - ); - - Render(method); - Namespaces.Received().Add(Arg.Is(t => t.FullyQualifiedName == "myReturnTypeFqn")); - } - - [Fact(DisplayName = Prefix + nameof(RecordsReferencedParameterType))] - public void RecordsReferencedParameterType() - { - Method method = new Method - ( - isProtected: false, - isAbstract: true, - name: "myMethod", - parameters: new[] - { - new Parameter - ( - name: "myParameter", - type: new TypeReference(fullyQualifiedName: "myParameterTypeFqn") - ) - } - ); - - Symbols.MapParameterName("myParameter", "myParameter"); - - Render(method); - - Namespaces.Received().Add(Arg.Is(t => t.FullyQualifiedName == "myParameterTypeFqn")); - } - - [Fact(DisplayName = Prefix + nameof(GeneratesVoidMethodWithNoParameters))] - public void GeneratesVoidMethodWithNoParameters() - { - Method method = new Method - ( - isProtected: false, - isAbstract: true, - name: "myMethod" - ); - - string actual = Render(method); - string expected = -@"[JsiiMethod(name: ""myMethod"")] -void MyMethod();"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(GeneratesPrimitiveParameters))] - public void GeneratesPrimitiveParameters() - { - Method method = new Method - ( - isProtected: false, - isAbstract: true, - name: "myMethod", - parameters: new[] - { - new Parameter - ( - name: "myParameter1", - type: new TypeReference(primitive: PrimitiveType.String) - ), - new Parameter - ( - name: "event", - type: new TypeReference(primitive: PrimitiveType.String) - ), - } - ); - - Symbols.MapParameterName("myParameter1", "myParameter1"); - Symbols.MapParameterName("event", "@event"); - - string actual = Render(method); - string expected = -@"[JsiiMethod(name: ""myMethod"", parametersJson: ""[{\""name\"":\""myParameter1\"",\""type\"":{\""primitive\"":\""string\""}},{\""name\"":\""event\"",\""type\"":{\""primitive\"":\""string\""}}]"")] -void MyMethod(string myParameter1, string @event);"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(GeneratesPrimitiveReturnType))] - public void GeneratesPrimitiveReturnType() - { - Method method = new Method - ( - isProtected: false, - isAbstract: true, - name: "myMethod", - returns: new OptionalValue(type: new TypeReference(primitive: PrimitiveType.String)) - ); - - string actual = Render(method); - string expected = -@"[JsiiMethod(name: ""myMethod"", returnsJson: ""{\""type\"":{\""primitive\"":\""string\""}}"")] -string MyMethod();"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Interface/InterfaceProxyGeneratorTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Interface/InterfaceProxyGeneratorTests.cs deleted file mode 100644 index 57e6cd6ed6..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Interface/InterfaceProxyGeneratorTests.cs +++ /dev/null @@ -1,278 +0,0 @@ -using Amazon.JSII.Generator.Interface; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Newtonsoft.Json; -using Xunit; -using TypeKind = Amazon.JSII.JsonModel.Spec.TypeKind; -using System.Collections.Generic; - -namespace Amazon.JSII.Generator.UnitTests.Interface -{ - public class InterfaceProxyGeneratorTests : GeneratorTestBase - { - const string Prefix = nameof(Generator) + "." + nameof(InterfaceProxyGenerator) + "."; - - string Render(InterfaceType interfaceType, string package = "myPackage", string @namespace = "MyNamespace", - string typeName = "MyInterface") - { - Symbols.MapTypeToPackage(interfaceType.FullyQualifiedName, package); - string suffix = interfaceType.Namespace != null ? "." + interfaceType.Namespace : ""; - Symbols.MapNamespace(interfaceType.Assembly + suffix, @namespace); - Symbols.MapTypeName(interfaceType.FullyQualifiedName, typeName, TypeKind.Interface); - - var generator = new InterfaceProxyGenerator(package, interfaceType, Symbols, Namespaces); - - SyntaxTree syntaxTree = generator.CreateSyntaxTree(); - return syntaxTree.ToString(); - } - - [Fact(DisplayName = Prefix + nameof(IncludesAttribute))] - public void IncludesAttribute() - { - InterfaceType interfaceType = new InterfaceType - ( - "myInterfaceFqn", - "myPackage", - "myInterface", - "myNamespace", - methods: new Method[] { } - ); - - string actual = Render(interfaceType); - string expected = - @"namespace MyNamespace -{ - [JsiiTypeProxy(nativeType: typeof(IMyInterface), fullyQualifiedName: ""myInterfaceFqn"")] - internal sealed class MyInterfaceProxy : DeputyBase, IMyInterface - { - private MyInterfaceProxy(ByRefValue reference): base(reference) - { - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesMethods))] - public void IncludesMethods() - { - InterfaceType interfaceType = new InterfaceType - ( - "myInterfaceFqn", - "myPackage", - "myInterface", - "myNamespace", - methods: new Method[] {new Method(isAbstract: true, name: "myMethod")} - ); - - Symbols.MapMethodName("myInterfaceFqn", "myMethod", "MyMethod"); - - string actual = Render(interfaceType); - string expected = - @"namespace MyNamespace -{ - [JsiiTypeProxy(nativeType: typeof(IMyInterface), fullyQualifiedName: ""myInterfaceFqn"")] - internal sealed class MyInterfaceProxy : DeputyBase, IMyInterface - { - private MyInterfaceProxy(ByRefValue reference): base(reference) - { - } - - [JsiiMethod(name: ""myMethod"")] - public void MyMethod() - { - InvokeInstanceVoidMethod(new object[]{}); - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesAncestorInterfaceMethods))] - public void IncludesAncestorInterfaceMethods() - { - InterfaceType ancestorInterface = new InterfaceType - ( - "myAncestorInterfaceFqn", - "myPackage", - "myAncestorInterface", - "myNamespace", - methods: new[] {new Method(isAbstract: true, name: "myAncestorMethod")} - ); - InterfaceType baseInterface = new InterfaceType - ( - "myBaseInterfaceFqn", - "myPackage", - "myBaseInterface", - "myNamespace", - methods: new[] {new Method(isAbstract: true, name: "myBaseMethod")}, - interfaces: new[] {"myAncestorInterfaceFqn"} - ); - InterfaceType interfaceType = new InterfaceType - ( - "myInterfaceFqn", - "myPackage", - "myInterface", - "myNamespace", - interfaces: new[] {"myBaseInterfaceFqn"} - ); - - Symbols.MapTypeName("myAncestorInterfaceFqn", "MyAncestorInterface", TypeKind.Interface); - Symbols.MapFullyQualifiedNameToType("myAncestorInterfaceFqn", ancestorInterface); - Symbols.MapMethodName("myInterfaceFqn", "myAncestorMethod", "MyAncestorMethod"); - - Symbols.MapTypeName("myBaseInterfaceFqn", "MyBaseInterface", TypeKind.Interface); - Symbols.MapFullyQualifiedNameToType("myBaseInterfaceFqn", baseInterface); - Symbols.MapMethodName("myInterfaceFqn", "myBaseMethod", "MyBaseMethod"); - - string actual = Render(interfaceType); - string expected = - @"namespace MyNamespace -{ - [JsiiTypeProxy(nativeType: typeof(IMyInterface), fullyQualifiedName: ""myInterfaceFqn"")] - internal sealed class MyInterfaceProxy : DeputyBase, IMyInterface - { - private MyInterfaceProxy(ByRefValue reference): base(reference) - { - } - - [JsiiMethod(name: ""myBaseMethod"")] - public void MyBaseMethod() - { - InvokeInstanceVoidMethod(new object[]{}); - } - - [JsiiMethod(name: ""myAncestorMethod"")] - public void MyAncestorMethod() - { - InvokeInstanceVoidMethod(new object[]{}); - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesDocs))] - public void IncludesDocs() - { - InterfaceType interfaceType = new InterfaceType - ( - "myInterfaceFqn", - "myPackage", - "myInterface", - "myNamespace", - docs: new Docs(custom: new Dictionary{{"foo", "bar"}}) - ); - - string actual = Render(interfaceType); - string expected = - @"namespace MyNamespace -{ - /// foo: bar - [JsiiTypeProxy(nativeType: typeof(IMyInterface), fullyQualifiedName: ""myInterfaceFqn"")] - internal sealed class MyInterfaceProxy : DeputyBase, IMyInterface - { - private MyInterfaceProxy(ByRefValue reference): base(reference) - { - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(EnvironmentRegression))] - public void EnvironmentRegression() - { - const string json = - @" { - ""docs"": { - ""summary"": ""Models an AWS execution environment, for use within the CDK toolkit."" - }, - ""kind"": ""interface"", - ""properties"": [ - { - ""docs"": { - ""summary"": ""The arbitrary name of this environment (user-set, or at least user-meaningful) "" - }, - ""abstract"": true, - ""name"": ""name"", - ""type"": { - ""primitive"": ""string"" - } - }, - { - ""docs"": { - ""summary"": ""The 12-digit AWS account ID for the account this environment deploys into "" - }, - ""abstract"": true, - ""name"": ""account"", - ""type"": { - ""primitive"": ""string"" - } - }, - { - ""docs"": { - ""summary"": ""The AWS region name where this environment deploys into "" - }, - ""abstract"": true, - ""name"": ""region"", - ""type"": { - ""primitive"": ""string"" - } - } - ], - ""fqn"": ""jsii$aws_cdk_cx_api$.Environment"", - ""assembly"": ""jsii$aws_cdk_cx_api$"", - ""namespace"": ""jsii$aws_cdk_cx_api$"", - ""name"": ""Environment"", - ""datatype"": true - }"; - - InterfaceType interfaceType = JsonConvert.DeserializeObject(json); - - Symbols.MapPropertyName("jsii$aws_cdk_cx_api$.Environment", "name", "Name"); - Symbols.MapPropertyName("jsii$aws_cdk_cx_api$.Environment", "account", "Account"); - Symbols.MapPropertyName("jsii$aws_cdk_cx_api$.Environment", "region", "Region"); - - string actual = Render(interfaceType, package: "aws-cdk-cx-api", @namespace: "Aws.Cdk.CxApi", - typeName: "Environment"); - string expected = - @"namespace Aws.Cdk.CxApi -{ - /// Models an AWS execution environment, for use within the CDK toolkit. - [JsiiTypeProxy(nativeType: typeof(IEnvironment), fullyQualifiedName: ""jsii$aws_cdk_cx_api$.Environment"")] - internal sealed class EnvironmentProxy : DeputyBase, IEnvironment - { - private EnvironmentProxy(ByRefValue reference): base(reference) - { - } - - /// The arbitrary name of this environment (user-set, or at least user-meaningful) - [JsiiProperty(name: ""name"", typeJson: ""{\""primitive\"":\""string\""}"")] - public string Name - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - - /// The 12-digit AWS account ID for the account this environment deploys into - [JsiiProperty(name: ""account"", typeJson: ""{\""primitive\"":\""string\""}"")] - public string Account - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - - /// The AWS region name where this environment deploys into - [JsiiProperty(name: ""region"", typeJson: ""{\""primitive\"":\""string\""}"")] - public string Region - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - } -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - } -} \ No newline at end of file diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Interface/InterfaceProxyMethodGeneratorTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Interface/InterfaceProxyMethodGeneratorTests.cs deleted file mode 100644 index e53cad895f..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/Interface/InterfaceProxyMethodGeneratorTests.cs +++ /dev/null @@ -1,124 +0,0 @@ -using Amazon.JSII.Generator.Interface; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Xunit; -using TypeKind = Amazon.JSII.JsonModel.Spec.TypeKind; -using System.Collections.Generic; - -namespace Amazon.JSII.Generator.UnitTests.Interface -{ - public class InterfaceProxyMethodGeneratorTests : GeneratorTestBase - { - const string Prefix = nameof(Generator) + "." + nameof(InterfaceProxyMethodGenerator) + "."; - - string Render(Method method) - { - InterfaceType interfaceType = new InterfaceType - ( - "myInterfaceFqn", - "myModule", - "myClass", - "myNamespace", - methods: new Method[] { method } - ); - - Symbols.MapTypeToPackage("myInterfaceFqn", "myPackage"); - Symbols.MapNamespace("", "MyNamespace"); - Symbols.MapTypeName("myInterfaceFqn", "MyInterface", TypeKind.Interface); - - var generator = new InterfaceProxyMethodGenerator(interfaceType, method, Symbols, Namespaces); - - MethodDeclarationSyntax methodSyntax = generator.CreateMethod(); - return methodSyntax.NormalizeWhitespace(elasticTrivia: true).ToString(); - } - - [Fact(DisplayName = Prefix + nameof(IncludesAttribute))] - public void IncludesAttribute() - { - Method method = new Method(isAbstract: true, name: "myMethod"); - - Symbols.MapMethodName("myInterfaceFqn", "myMethod", "MyMethod"); - - string actual = Render(method); - string expected = -@"[JsiiMethod(name: ""myMethod"")] -public void MyMethod() -{ - InvokeInstanceVoidMethod(new object[]{}); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncluesParameters))] - public void IncluesParameters() - { - Method method = new Method - ( - isAbstract: true, name: "myMethod", - parameters: new[] - { - new Parameter(name: "myParam", type: new TypeReference("myParamTypeFqn")), - new Parameter(name: "event", type: new TypeReference(primitive: PrimitiveType.String)) - } - ); - - Symbols.MapMethodName("myInterfaceFqn", "myMethod", "MyMethod"); - Symbols.MapTypeName("myParamTypeFqn", "MyParamType", TypeKind.Class); - Symbols.MapParameterName("myParam", "myParam"); - Symbols.MapParameterName("event", "@event"); - - string actual = Render(method); - string expected = -@"[JsiiMethod(name: ""myMethod"", parametersJson: ""[{\""name\"":\""myParam\"",\""type\"":{\""fqn\"":\""myParamTypeFqn\""}},{\""name\"":\""event\"",\""type\"":{\""primitive\"":\""string\""}}]"")] -public void MyMethod(MyParamType myParam, string @event) -{ - InvokeInstanceVoidMethod(new object[]{myParam, @event}); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(DoesNotIncludeDocs))] - public void DoesNotIncludeDocs() - { - Method method = new Method - ( - isAbstract: true, name: "myMethod", - docs: new Docs(custom: new Dictionary{{"foo", "bar"}}) - ); - - Symbols.MapMethodName("myInterfaceFqn", "myMethod", "MyMethod"); - - string actual = Render(method); - string expected = -@"[JsiiMethod(name: ""myMethod"")] -public void MyMethod() -{ - InvokeInstanceVoidMethod(new object[]{}); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(IncludesReturnTypeForNonVoid))] - public void IncludesReturnTypeForNonVoid() - { - Method method = new Method - ( - isAbstract: true, name: "myMethod", - returns: new OptionalValue(type: new TypeReference("myReturnTypeFqn")) - ); - - Symbols.MapMethodName("myInterfaceFqn", "myMethod", "MyMethod"); - Symbols.MapTypeName("myReturnTypeFqn", "MyReturnType", TypeKind.Class); - - string actual = Render(method); - string expected = -@"[JsiiMethod(name: ""myMethod"", returnsJson: ""{\""type\"":{\""fqn\"":\""myReturnTypeFqn\""}}"")] -public MyReturnType MyMethod() -{ - return InvokeInstanceMethod(new object[]{}); -}"; - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/MethodExtensionsTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/MethodExtensionsTests.cs deleted file mode 100644 index 55514bc488..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/MethodExtensionsTests.cs +++ /dev/null @@ -1,173 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using System.Collections.Generic; -using NSubstitute; -using Xunit; - -namespace Amazon.JSII.Generator.UnitTests -{ - public class MethodExtensionsTests - { - const string Prefix = nameof(Generator) + "." + nameof(CallableExtensions) + "."; - - public class GetParameterListSyntax : GeneratorTestBase - { - const string _Prefix = Prefix + nameof(CallableExtensions.GetParameterListSyntax) + "."; - - [Fact(DisplayName = _Prefix + nameof(IncludesAllParameters))] - public void IncludesAllParameters() - { - Method method = new Method - ( - name: "myMethod", - parameters: new[] - { - new Parameter(name: "myParam1", type: new TypeReference("myParamTypeFqn1")), - new Parameter(name: "myParam2", type: new TypeReference("myParamTypeFqn2")), - } - ); - - Symbols.MapTypeName("myParamTypeFqn1", "MyParamType1", JsonModel.Spec.TypeKind.Class); - Symbols.MapTypeName("myParamTypeFqn2", "MyParamType2", JsonModel.Spec.TypeKind.Class); - Symbols.MapParameterName("myParam1", "myParam1"); - Symbols.MapParameterName("myParam2", "myParam2"); - - ParameterListSyntax syntax = method.GetParameterListSyntax(Namespaces, Symbols); - - string actual = syntax.NormalizeWhitespace(elasticTrivia: true).ToString(); - string expected = @"(MyParamType1 myParam1, MyParamType2 myParam2)"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = _Prefix + nameof(DoesNotThrowOnMissingParameterList))] - public void DoesNotThrowOnMissingParameterList() - { - Method method = new Method - ( - name: "myMethod" - ); - - ParameterListSyntax syntax = method.GetParameterListSyntax(Namespaces, Symbols); - - string actual = syntax.NormalizeWhitespace(elasticTrivia: true).ToString(); - string expected = @"()"; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = _Prefix + nameof(AddsNamespacesToSet))] - public void AddsNamespacesToSet() - { - Type paramType1 = new EnumType - ( - fullyQualifiedName: "myParamTypeFqn1", - assembly: "myPackage", - name: "myParamType", - members: new EnumMember[] { } - ); - Type paramType2 = new EnumType - ( - fullyQualifiedName: "myParamTypeFqn2", - assembly: "myPackage", - name: "myParamType", - members: new EnumMember[] { } - ); - Method method = new Method - ( - name: "myMethod", - parameters: new[] - { - new Parameter(name: "myParam1", type: new TypeReference("myParamTypeFqn1")), - new Parameter(name: "myParam2", type: new TypeReference("myParamTypeFqn2")), - } - ); - - Symbols.MapTypeName("myParamTypeFqn1", "MyParamType1", JsonModel.Spec.TypeKind.Enum); - Symbols.MapTypeName("myParamTypeFqn2", "MyParamType2", JsonModel.Spec.TypeKind.Enum); - Symbols.MapFullyQualifiedNameToType("myParamTypeFqn1", paramType1); - Symbols.MapFullyQualifiedNameToType("myParamTypeFqn2", paramType2); - Symbols.MapNamespace("myNamespace1", "MyNamespace1"); - Symbols.MapNamespace("myNamespace2", "MyNamespace2"); - Symbols.MapParameterName("myParam1", "myParam1"); - Symbols.MapParameterName("myParam2", "myParam2"); - - method.GetParameterListSyntax(Namespaces, Symbols); - - Namespaces.Received().Add(Arg.Is(r => r.FullyQualifiedName == "myParamTypeFqn1")); - Namespaces.Received().Add(Arg.Is(r => r.FullyQualifiedName == "myParamTypeFqn2")); - } - } - - public class GetParametersJsonSyntaxToken : GeneratorTestBase - { - const string _Prefix = Prefix + nameof(CallableExtensions.GetParametersJsonSyntaxToken) + "."; - - [Fact(DisplayName = _Prefix + nameof(StripsDocs))] - public void StripsDocs() - { - Method method = new Method - ( - isProtected: false, - isAbstract: false, - name: "myMethod", - parameters: new[] - { - new Parameter - ( - name: "myParam1", - type: new TypeReference("myParamTypeFqn1"), - docs: new Docs(custom: new Dictionary{{"foo", "bar"}}) - ), - new Parameter - ( - name: "myParam2", - type: new TypeReference("myParamTypeFqn2"), - docs: new Docs(custom: new Dictionary{{"foo", "bar"}}) - ) - } - ); - - SyntaxToken token = method.GetParametersJsonSyntaxToken(); - - string actual = token.ToString(); - string expected = @"""[{\""name\"":\""myParam1\"",\""type\"":{\""fqn\"":\""myParamTypeFqn1\""}},{\""name\"":\""myParam2\"",\""type\"":{\""fqn\"":\""myParamTypeFqn2\""}}]"""; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = _Prefix + nameof(PreservesOptionality))] - public void PreservesOptionality() - { - Method method = new Method - ( - isProtected: false, - isAbstract: false, - name: "myMethod", - parameters: new[] - { - new Parameter - ( - name: "myParam1", - type: new TypeReference("myParamTypeFqn1") - ), - new Parameter - ( - name: "myParam2", - type: new TypeReference("myParamTypeFqn2"), - isOptional: true - ) - } - ); - - SyntaxToken token = method.GetParametersJsonSyntaxToken(); - - string actual = token.ToString(); - string expected = @"""[{\""name\"":\""myParam1\"",\""type\"":{\""fqn\"":\""myParamTypeFqn1\""}},{\""name\"":\""myParam2\"",\""type\"":{\""fqn\"":\""myParamTypeFqn2\""},\""optional\"":true}]"""; - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/NameUtilsTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/NameUtilsTests.cs deleted file mode 100644 index 56268e8a5b..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/NameUtilsTests.cs +++ /dev/null @@ -1,181 +0,0 @@ -using System; -using Xunit; - -namespace Amazon.JSII.Generator.UnitTests -{ - public class NameUtilsTests - { - const string Prefix = nameof(Generator) + "." + nameof(NameUtils) + "."; - - public class ConvertPackageName - { - const string _Prefix = Prefix + nameof(NameUtils.ConvertPackageName) + "."; - - [Theory(DisplayName = _Prefix + nameof(ConvertsValid))] - [InlineData("aws-cdk", "Aws.Cdk")] - [InlineData("aws-cdk-resources", "Aws.Cdk.Resources")] - [InlineData("aws_cdk_resources", "Aws_cdk_resources")] - public void ConvertsValid(string original, string expected) - { - string actual = NameUtils.ConvertPackageName(original); - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Theory(DisplayName = _Prefix + nameof(ThrowsOnInvalid))] - [InlineData("jsii$aws_cdk_resources$")] - [InlineData("")] - public void ThrowsOnInvalid(string original) - { - Assert.Throws(() => NameUtils.ConvertPackageName(original)); - } - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnNull))] - public void ThrowsOnNull() - { - Assert.Throws(() => NameUtils.ConvertPackageName(null)); - } - } - - public class ConvertTypeName - { - const string _Prefix = Prefix + nameof(NameUtils.ConvertTypeName) + "."; - - [Theory(DisplayName = _Prefix + nameof(ConvertsValid))] - [InlineData("myTypeName", "MyTypeName")] - public void ConvertsValid(string original, string expected) - { - string actual = NameUtils.ConvertTypeName(original); - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Theory(DisplayName = _Prefix + nameof(ThrowsOnInvalid))] - [InlineData("jsii$myTypeName")] - [InlineData("")] - public void ThrowsOnInvalid(string original) - { - Assert.Throws(() => NameUtils.ConvertTypeName(original)); - } - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnNull))] - public void ThrowsOnNull() - { - Assert.Throws(() => NameUtils.ConvertTypeName(null)); - } - } - - public class ConvertPropertyName - { - const string _Prefix = Prefix + nameof(NameUtils.ConvertPropertyName) + "."; - - [Theory(DisplayName = _Prefix + nameof(ConvertsValid))] - [InlineData("myPropertyName", "MyPropertyName")] - public void ConvertsValid(string original, string expected) - { - string actual = NameUtils.ConvertPropertyName(original); - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Theory(DisplayName = _Prefix + nameof(ThrowsOnInvalid))] - [InlineData("jsii$myPropertyName")] - [InlineData("")] - public void ThrowsOnInvalid(string original) - { - Assert.Throws(() => NameUtils.ConvertPropertyName(original)); - } - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnNull))] - public void ThrowsOnNull() - { - Assert.Throws(() => NameUtils.ConvertPropertyName(null)); - } - } - - public class ConvertMethodName - { - const string _Prefix = Prefix + nameof(NameUtils.ConvertMethodName) + "."; - - [Theory(DisplayName = _Prefix + nameof(ConvertsValid))] - [InlineData("myMethodName", "MyMethodName")] - public void ConvertsValid(string original, string expected) - { - string actual = NameUtils.ConvertMethodName(original); - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Theory(DisplayName = _Prefix + nameof(ThrowsOnInvalid))] - [InlineData("jsii$myMethodName")] - [InlineData("")] - public void ThrowsOnInvalid(string original) - { - Assert.Throws(() => NameUtils.ConvertMethodName(original)); - } - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnNull))] - public void ThrowsOnNull() - { - Assert.Throws(() => NameUtils.ConvertMethodName(null)); - } - } - - public class ConvertEnumMemberName - { - const string _Prefix = Prefix + nameof(NameUtils.ConvertEnumMemberName) + "."; - - [Theory(DisplayName = _Prefix + nameof(ConvertsValid))] - [InlineData("myEnumMemberName", "MyEnumMemberName")] - public void ConvertsValid(string original, string expected) - { - string actual = NameUtils.ConvertEnumMemberName(original); - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Theory(DisplayName = _Prefix + nameof(ThrowsOnInvalid))] - [InlineData("jsii$myEnumMemberName")] - [InlineData("")] - public void ThrowsOnInvalid(string original) - { - Assert.Throws(() => NameUtils.ConvertEnumMemberName(original)); - } - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnNull))] - public void ThrowsOnNull() - { - Assert.Throws(() => NameUtils.ConvertEnumMemberName(null)); - } - } - - public class ConvertParameterName - { - const string _Prefix = Prefix + nameof(NameUtils.ConvertParameterName) + "."; - - [Theory(DisplayName = _Prefix + nameof(ConvertsValid))] - [InlineData("myParameterName", "myParameterName")] - [InlineData("event", "@event")] - public void ConvertsValid(string original, string expected) - { - string actual = NameUtils.ConvertParameterName(original); - - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Theory(DisplayName = _Prefix + nameof(ThrowsOnInvalid))] - [InlineData("jsii$myParameterName")] - [InlineData("")] - public void ThrowsOnInvalid(string original) - { - Assert.Throws(() => NameUtils.ConvertParameterName(original)); - } - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnNull))] - public void ThrowsOnNull() - { - Assert.Throws(() => NameUtils.ConvertParameterName(null)); - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/NamespaceSetTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/NamespaceSetTests.cs deleted file mode 100644 index d02995b89a..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/NamespaceSetTests.cs +++ /dev/null @@ -1,242 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using System.Linq; -using Xunit; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.UnitTests -{ - public class NamespaceSetTests : GeneratorTestBase - { - const string Prefix = nameof(Generator) + "." + nameof(NamespaceSet) + "."; - - void AssertUsings(SyntaxList usings, params string[] expectations) - { - Assert.Collection(usings, expectations.Select(GetInspector).ToArray()); - - System.Action GetInspector(string expected) - { - return u => Assert.Equal( - expected, - u.NormalizeWhitespace(elasticTrivia: true).ToString(), - ignoreLineEndingDifferences: true - ); - } - } - - [Fact(DisplayName = Prefix + nameof(CreatesUsingStatementForObjectReference))] - public void CreatesUsingStatementForObjectReference() - { - Symbols.MapTypeToNamespace("myFqn", "MyNamespace"); - - NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); - namespaces.Add(new TypeReference("myFqn")); - - SyntaxList usings = namespaces.GetUsings(); - AssertUsings - ( - usings, - "using Amazon.JSII.Runtime.Deputy;" - ); - } - - [Fact(DisplayName = Prefix + nameof(CreatesUsingStatementForDateReference))] - public void CreatesUsingStatementForDateReference() - { - NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); - namespaces.Add(new TypeReference(primitive: PrimitiveType.Date)); - - SyntaxList usings = namespaces.GetUsings(); - AssertUsings - ( - usings, - "using Amazon.JSII.Runtime.Deputy;", - "using System;" - ); - } - - [Fact(DisplayName = Prefix + nameof(CreatesUsingStatementForJsonReference))] - public void CreatesUsingStatementForJsonReference() - { - NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); - namespaces.Add(new TypeReference(primitive: PrimitiveType.Json)); - - SyntaxList usings = namespaces.GetUsings(); - AssertUsings - ( - usings, - "using Amazon.JSII.Runtime.Deputy;", - "using Newtonsoft.Json.Linq;" - ); - } - - [Fact(DisplayName = Prefix + nameof(DoesNotCreateUsingStatementForSystemPrimitive))] - public void DoesNotCreateUsingStatementForSystemPrimitive() - { - NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); - namespaces.Add(new TypeReference(primitive: PrimitiveType.Any)); - namespaces.Add(new TypeReference(primitive: PrimitiveType.Boolean)); - namespaces.Add(new TypeReference(primitive: PrimitiveType.Number)); - namespaces.Add(new TypeReference(primitive: PrimitiveType.String)); - - SyntaxList usings = namespaces.GetUsings(); - AssertUsings - ( - usings, - "using Amazon.JSII.Runtime.Deputy;" - ); - } - - [Fact(DisplayName = Prefix + nameof(CreatesUsingStatementForMapReference))] - public void CreatesUsingStatementForMapReference() - { - NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); - namespaces.Add(new TypeReference(collection: new CollectionTypeReference( - kind: CollectionKind.Map, - elementType: new TypeReference(primitive: PrimitiveType.String) - ))); - - SyntaxList usings = namespaces.GetUsings(); - AssertUsings - ( - usings, - "using Amazon.JSII.Runtime.Deputy;", - "using System.Collections.Generic;" - ); - } - - [Fact(DisplayName = Prefix + nameof(RecursivelyCreatesUsingStatementForMapElementReference))] - public void RecursivelyCreatesUsingStatementForMapElementReference() - { - NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); - namespaces.Add(new TypeReference(collection: new CollectionTypeReference( - CollectionKind.Map, - new TypeReference(collection: new CollectionTypeReference( - kind: CollectionKind.Map, - elementType: new TypeReference(primitive: PrimitiveType.Json) - ) - )))); - - SyntaxList usings = namespaces.GetUsings(); - AssertUsings - ( - usings, - "using Amazon.JSII.Runtime.Deputy;", - "using Newtonsoft.Json.Linq;", - "using System.Collections.Generic;" - ); - } - - [Fact(DisplayName = Prefix + nameof(DoesNotCreateUsingStatementForArrayReference))] - public void DoesNotCreateUsingStatementForArrayReference() - { - NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); - namespaces.Add(new TypeReference(collection: new CollectionTypeReference( - kind: CollectionKind.Array, - elementType: new TypeReference(primitive: PrimitiveType.String) - ))); - - SyntaxList usings = namespaces.GetUsings(); - AssertUsings - ( - usings, - "using Amazon.JSII.Runtime.Deputy;" - ); - } - - [Fact(DisplayName = Prefix + nameof(RecursivelyCreatesUsingStatementForArrayElementReference))] - public void RecursivelyCreatesUsingStatementForArrayElementReference() - { - NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); - namespaces.Add(new TypeReference(collection: new CollectionTypeReference( - kind: CollectionKind.Array, - elementType: new TypeReference(collection: new CollectionTypeReference( - kind: CollectionKind.Array, - elementType: new TypeReference(primitive: PrimitiveType.Json) - ) - )))); - - SyntaxList usings = namespaces.GetUsings(); - AssertUsings - ( - usings, - "using Amazon.JSII.Runtime.Deputy;", - "using Newtonsoft.Json.Linq;" - ); - } - - [Fact(DisplayName = Prefix + nameof(RecursivelyCreatesUsingStatementForEachTypeInUnionReference))] - public void RecursivelyCreatesUsingStatementForEachTypeInUnionReference() - { - NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); - namespaces.Add(new TypeReference(union: new UnionTypeReference(new[] { - new TypeReference(collection: new CollectionTypeReference( - kind: CollectionKind.Array, - elementType: new TypeReference(collection: new CollectionTypeReference( - kind: CollectionKind.Array, - elementType: new TypeReference(primitive: PrimitiveType.Json) - ) - ))), - new TypeReference(primitive: PrimitiveType.Date) - }))); - - SyntaxList usings = namespaces.GetUsings(); - AssertUsings - ( - usings, - "using Amazon.JSII.Runtime.Deputy;", - "using Newtonsoft.Json.Linq;", - "using System;" - ); - } - - [Fact(DisplayName = Prefix + nameof(DoesNotCreateDuplicateUsingStatements))] - public void DoesNotCreateDuplicateUsingStatements() - { - NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); - namespaces.Add(new TypeReference(primitive: PrimitiveType.Json)); - namespaces.Add(new TypeReference(primitive: PrimitiveType.Json)); - - SyntaxList usings = namespaces.GetUsings(); - AssertUsings - ( - usings, - "using Amazon.JSII.Runtime.Deputy;", - "using Newtonsoft.Json.Linq;" - ); - } - - [Fact(DisplayName = Prefix + nameof(DoesNotCreateUsingStatementForCurrentNamespace))] - public void DoesNotCreateUsingStatementForCurrentNamespace() - { - Symbols.MapTypeToNamespace("myFqn", "MyCurrentNamespace"); - - NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); - namespaces.Add(new TypeReference("myFqn")); - - SyntaxList usings = namespaces.GetUsings(); - AssertUsings - ( - usings, - "using Amazon.JSII.Runtime.Deputy;" - ); - } - - [Fact(DisplayName = Prefix + nameof(SortsUsingStatementsAlphaNumerically))] - public void SortsUsingStatementsAlphaNumerically() - { - Symbols.MapTypeToNamespace("myFqn", "AAA"); - - NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); - namespaces.Add(new TypeReference("myFqn")); - - SyntaxList usings = namespaces.GetUsings(); - AssertUsings - ( - usings, - "using Amazon.JSII.Runtime.Deputy;" - ); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/SymbolMapExtensions.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/SymbolMapExtensions.cs deleted file mode 100644 index 1eb07c579a..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/SymbolMapExtensions.cs +++ /dev/null @@ -1,195 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using NSubstitute; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.UnitTests -{ - static class SymbolMapExtensions - { - public static void MapPropertyName(this ISymbolMap symbols, string ownerFullyQualifiedName, string jsiiName, string frameworkName) - { - symbols.GetName( - Arg.Is(t => t.FullyQualifiedName == ownerFullyQualifiedName), - Arg.Is(p => p.Name == jsiiName) - ).Returns(frameworkName); - symbols.GetNameSyntaxToken( - Arg.Is(t => t.FullyQualifiedName == ownerFullyQualifiedName), - Arg.Is(p => p.Name == jsiiName) - ).Returns(SF.ParseToken(frameworkName)); - symbols.GetNameSyntax( - Arg.Is(t => t.FullyQualifiedName == ownerFullyQualifiedName), - Arg.Is(p => p.Name == jsiiName) - ).Returns(SF.ParseName(frameworkName)); - } - - public static void MapMethodName(this ISymbolMap symbols, string ownerFullyQualifiedName, string jsiiName, string frameworkName) - { - symbols.GetName( - Arg.Is(t => t.FullyQualifiedName == ownerFullyQualifiedName), - Arg.Is(m => m.Name == jsiiName) - ).Returns(frameworkName); - symbols.GetNameSyntaxToken( - Arg.Is(t => t.FullyQualifiedName == ownerFullyQualifiedName), - Arg.Is(m => m.Name == jsiiName) - ).Returns(SF.ParseToken(frameworkName)); - symbols.GetNameSyntax( - Arg.Is(t => t.FullyQualifiedName == ownerFullyQualifiedName), - Arg.Is(m => m.Name == jsiiName) - ).Returns(SF.ParseName(frameworkName)); - } - - public static void MapEnumMemberName(this ISymbolMap symbols, string ownerFullyQualifiedName, string jsiiName, string frameworkName) - { - symbols.GetName( - Arg.Is(t => t.FullyQualifiedName == ownerFullyQualifiedName), - Arg.Is(m => m.Name == jsiiName) - ).Returns(frameworkName); - symbols.GetNameSyntaxToken( - Arg.Is(t => t.FullyQualifiedName == ownerFullyQualifiedName), - Arg.Is(m => m.Name == jsiiName) - ).Returns(SF.ParseToken(frameworkName)); - symbols.GetNameSyntax( - Arg.Is(t => t.FullyQualifiedName == ownerFullyQualifiedName), - Arg.Is(m => m.Name == jsiiName) - ).Returns(SF.ParseName(frameworkName)); - } - - public static void MapParameterName(this ISymbolMap symbols, string jsiiName, string frameworkName) - { - symbols.GetName(Arg.Is(t => t.Name == jsiiName)).Returns(frameworkName); - symbols.GetNameSyntaxToken(Arg.Is(t => t.Name == jsiiName)).Returns(SF.ParseToken(frameworkName)); - symbols.GetNameSyntax(Arg.Is(t => t.Name == jsiiName)).Returns(SF.ParseName(frameworkName)); - } - - public static void MapTypeName(this ISymbolMap symbols, string fullyQualifiedName, string frameworkName, TypeKind kind) - { - var proxyName = $"{frameworkName}Proxy"; - switch (kind) - { - case TypeKind.Interface: - var defaultName = frameworkName; - - symbols - .GetInterfaceProxyName(Arg.Is(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any()) - .Returns(proxyName); - symbols - .GetInterfaceDefaultName(Arg.Is(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any()) - .Returns(defaultName); - symbols - .GetInterfaceProxyNameSyntaxToken(Arg.Is(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any()) - .Returns(SF.ParseToken(proxyName)); - symbols - .GetInterfaceDefaultNameSyntaxToken(Arg.Is(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any()) - .Returns(SF.ParseToken(defaultName)); - symbols - .GetInterfaceProxyNameSyntax(Arg.Is(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any()) - .Returns(SF.ParseName(proxyName)); - symbols - .GetInterfaceDefaultNameSyntax(Arg.Is(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any()) - .Returns(SF.ParseName(defaultName)); - - frameworkName = $"I{frameworkName}"; - break; - case TypeKind.Class: - symbols - .GetAbstractClassProxyName(Arg.Is(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any()) - .Returns(proxyName); - break; - } - - symbols - .GetName(Arg.Is(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any()) - .Returns(frameworkName); - symbols - .GetName(Arg.Is(fqn => fqn == fullyQualifiedName), qualified: Arg.Any()) - .Returns(frameworkName); - symbols - .GetNameSyntaxToken(Arg.Is(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any()) - .Returns(SF.ParseToken(frameworkName)); - symbols - .GetNameSyntaxToken(Arg.Is(fqn => fqn == fullyQualifiedName), qualified: Arg.Any()) - .Returns(SF.ParseToken(frameworkName)); - symbols - .GetNameSyntax(Arg.Is(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any()) - .Returns(SF.ParseName(frameworkName)); - symbols - .GetNameSyntax(Arg.Is(fqn => fqn == fullyQualifiedName), qualified: Arg.Any()) - .Returns(SF.ParseName(frameworkName)); - symbols - .GetTypeSyntax(Arg.Is(t => t.FullyQualifiedName == fullyQualifiedName), false) - .Returns(SF.ParseTypeName(frameworkName)); - } - - public static void MapAssemblyName(this ISymbolMap symbols, string jsiiName, string frameworkName) - { - symbols - .GetName(Arg.Is(a => a.Name == jsiiName)) - .Returns(frameworkName); - symbols - .GetNameSyntaxToken(Arg.Is(a => a.Name == jsiiName)) - .Returns(SF.ParseToken(frameworkName)); - symbols - .GetNameSyntax(Arg.Is(a => a.Name == jsiiName)) - .Returns(SF.ParseName(frameworkName)); - - symbols - .GetAssemblyName(Arg.Is(n => n == jsiiName)) - .Returns(frameworkName); - } - - public static void MapNamespace(this ISymbolMap symbols, string jsiiNamespace, string frameworkNamespace) - { - symbols - .GetNamespace(Arg.Is(t => t.QualifiedNamespace == jsiiNamespace)) - .Returns(frameworkNamespace); - symbols - .GetNamespaceSyntaxToken(Arg.Is(t => t.QualifiedNamespace == jsiiNamespace)) - .Returns(SF.ParseToken(frameworkNamespace)); - symbols - .GetNamespaceSyntax(Arg.Is(t => t.QualifiedNamespace == jsiiNamespace)) - .Returns(SF.ParseName(frameworkNamespace)); - } - - public static void MapTypeToNamespace(this ISymbolMap symbols, string fullyQualifiedName, string frameworkNamespace) - { - symbols - .GetNamespace(Arg.Is(n => n == fullyQualifiedName)) - .Returns(frameworkNamespace); - symbols - .GetNamespaceSyntaxToken(Arg.Is(n => n == fullyQualifiedName)) - .Returns(SF.ParseToken(frameworkNamespace)); - symbols - .GetNamespaceSyntax(Arg.Is(n => n == fullyQualifiedName)) - .Returns(SF.ParseName(frameworkNamespace)); - } - - public static void MapTypeToPackage(this ISymbolMap symbols, string fullyQualifiedName, string package) - { - symbols - .GetPackage(Arg.Is(t => t.FullyQualifiedName == fullyQualifiedName)) - .Returns(package); - symbols - .GetPackage(Arg.Is(n => n == fullyQualifiedName)) - .Returns(package); - symbols - .GetPackageSyntaxToken(Arg.Is(t => t.FullyQualifiedName == fullyQualifiedName)) - .Returns(SF.ParseToken(package)); - symbols - .GetPackageSyntaxToken(Arg.Is(n => n == fullyQualifiedName)) - .Returns(SF.ParseToken(package)); - symbols - .GetPackageSyntax(Arg.Is(t => t.FullyQualifiedName == fullyQualifiedName)) - .Returns(SF.ParseName(package)); - symbols - .GetPackageSyntax(Arg.Is(n => n == fullyQualifiedName)) - .Returns(SF.ParseName(package)); - } - - public static void MapFullyQualifiedNameToType(this ISymbolMap symbols, string fullyQualifiedName, Type type) - { - symbols - .GetTypeFromFullyQualifiedName(Arg.Is(n => n == fullyQualifiedName)) - .Returns(type); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/SymbolMapTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/SymbolMapTests.cs deleted file mode 100644 index c0aaa5301e..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/SymbolMapTests.cs +++ /dev/null @@ -1,1344 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using System.Collections.Generic; -using System.Linq; -using Xunit; - -namespace Amazon.JSII.Generator.UnitTests -{ - public class SymbolMapTests - { - const string Prefix = nameof(Generator) + "." + nameof(SymbolMap) + "."; - - static ISymbolMap GetSymbolMap(params Type[] types) - { - return GetSymbolMap(out Assembly assembly, types); - } - - static ISymbolMap GetSymbolMap(out Assembly assembly, params Type[] types) - { - assembly = new Assembly - ( - name: "my-package", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace", - packageId: "My.PackageId" - )), - version: "myVersion", - types: types.ToDictionary(t => t.FullyQualifiedName) - ); - - ISymbolMap symbolMap = new SymbolMap(); - symbolMap.Add(assembly); - - return symbolMap; - } - - public class Add - { - const string _Prefix = Prefix + nameof(SymbolMap.Add) + "."; - - [Fact(DisplayName = Prefix + nameof(LoadsEmptyAssembly))] - public void LoadsEmptyAssembly() - { - ISymbolMap symbolMap = GetSymbolMap(out Assembly assembly); - - string actual = symbolMap.GetName(assembly); - Assert.Equal("My.PackageId", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(RenamesTypeOnNamespaceConflict))] - public void RenamesTypeOnNamespaceConflict() - { - Type type1 = new ClassType - ( - fullyQualifiedName: "myFqn1", - assembly: "my-package", - name: "MyType", - isAbstract: false - ); - Type type2 = new ClassType - ( - fullyQualifiedName: "myFqn2", - assembly: "my-package", - name: "myType2", - @namespace: "MyType", - isAbstract: false - ); - - Assembly assembly = new Assembly - ( - name: "my-package", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace", - packageId: "My.PackageId" - )), - version: "myVersion", - types: new Dictionary - { - { type1.FullyQualifiedName, type1 }, - { type2.FullyQualifiedName, type2 }, - } - ); - - ISymbolMap symbolMap = new SymbolMap(); - symbolMap.Add(assembly); - - string actual = symbolMap.GetName(type1); - Assert.Equal("MyType_", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(RenamesTypeOnMemberConflict))] - public void RenamesTypeOnMemberConflict() - { - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - isAbstract: false, - properties: new[] - { - new Property( - name: "myType", - type: new TypeReference("myFqn"), - isImmutable: false, - isProtected: false, - isStatic: false - ) - } - ); - - Assembly assembly = new Assembly - ( - name: "my-package", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace", - packageId: "My.PackageId" - )), - version: "myVersion", - types: new Dictionary - { - { type.FullyQualifiedName, type } - } - ); - - ISymbolMap symbolMap = new SymbolMap(); - symbolMap.Add(assembly); - - string actual = symbolMap.GetName(type); - Assert.Equal("MyType_", actual, ignoreLineEndingDifferences: true); - } - } - - public class GetName - { - const string _Prefix = Prefix + nameof(SymbolMap.GetName) + "."; - - [Fact(DisplayName = Prefix + nameof(GetsFrameworkNameFromType))] - public void GetsFrameworkNameFromType() - { - Type type = new EnumType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - members: new EnumMember[] { } - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetName(type); - Assert.Equal("MyType", actual, ignoreLineEndingDifferences: true); - - actual = symbolMap.GetName("myFqn"); - Assert.Equal("MyType", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(DisambiguatesTypeNameOnConflict))] - public void DisambiguatesTypeNameOnConflict() - { - Type type1 = new EnumType - ( - fullyQualifiedName: "myFqn1", - assembly: "my-package-1", - name: "myType", - members: new EnumMember[] { } - ); - Type type2 = new EnumType - ( - fullyQualifiedName: "myFqn2", - assembly: "my-package-2", - name: "myType", - members: new EnumMember[] { } - ); - - Assembly assembly1 = new Assembly - ( - name: "my-package-1", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace1", - packageId: "My.PackageId1" - )), - version: "myVersion", - types: new Dictionary { { type1.FullyQualifiedName, type1 } }, - dependencies: new Dictionary - { - { - "my-package-2", - new PackageVersion( - version: "myVersion", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace2", - packageId: "My.PackageId2" - )) - ) - } - } - ); - Assembly assembly2 = new Assembly - ( - name: "my-package-2", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace2", - packageId: "My.PackageId2" - )), - version: "myVersion", - types: new Dictionary { { type2.FullyQualifiedName, type2 } } - ); - - ISymbolMap symbolMap = new SymbolMap(); - symbolMap.Add(assembly1); - symbolMap.Add(assembly2); - - // GetName(Type type) - string actual1 = symbolMap.GetName(type1, true); - string actual2 = symbolMap.GetName(type2, true); - Assert.Equal("My.Namespace1.MyType", actual1, ignoreLineEndingDifferences: true); - Assert.Equal("My.Namespace2.MyType", actual2, ignoreLineEndingDifferences: true); - - // GetName(string fullyQualifiedName) - actual1 = symbolMap.GetName("myFqn1", true); - actual2 = symbolMap.GetName("myFqn2", true); - Assert.Equal("My.Namespace1.MyType", actual1, ignoreLineEndingDifferences: true); - Assert.Equal("My.Namespace2.MyType", actual2, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(DoesNotDisambiguateTypeNameIfFlagNotSet))] - public void DoesNotDisambiguateTypeNameIfFlagNotSet() - { - Type type1 = new EnumType - ( - fullyQualifiedName: "myFqn1", - assembly: "my-package-1", - name: "myType", - members: new EnumMember[] { } - ); - Type type2 = new EnumType - ( - fullyQualifiedName: "myFqn2", - assembly: "my-package-2", - name: "myType", - members: new EnumMember[] { } - ); - - Assembly assembly1 = new Assembly - ( - name: "my-package-1", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace1", - packageId: "My.PackageId1" - )), - version: "myVersion", - types: new Dictionary { { type1.FullyQualifiedName, type1 } }, - dependencies: new Dictionary - { - { - "my-package-2", - new PackageVersion( - version: "myVersion", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace2", - packageId: "My.PackageId2" - )) - ) - } - } - ); - Assembly assembly2 = new Assembly - ( - name: "my-package-2", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace2", - packageId: "My.PackageId2" - )), - version: "myVersion", - types: new Dictionary { { type2.FullyQualifiedName, type2 } } - ); - - ISymbolMap symbolMap = new SymbolMap(); - symbolMap.Add(assembly1); - symbolMap.Add(assembly2); - - // GetName(Type type) - string actual1 = symbolMap.GetName(type1); - string actual2 = symbolMap.GetName(type2); - Assert.Equal("MyType", actual1, ignoreLineEndingDifferences: true); - Assert.Equal("MyType", actual2, ignoreLineEndingDifferences: true); - - // GetName(string fullyQualifiedName) - actual1 = symbolMap.GetName("myFqn1"); - actual2 = symbolMap.GetName("myFqn2"); - Assert.Equal("MyType", actual1, ignoreLineEndingDifferences: true); - Assert.Equal("MyType", actual2, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(GetsFrameworkNameFromMethod))] - public void GetsFrameworkNameFromMethod() - { - Method method = new Method - ( - isProtected: false, - isAbstract: false, - name: "myMethod" - ); - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - isAbstract: false, - methods: new[] { method } - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetName(type, method); - Assert.Equal("MyMethod", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(GetsFrameworkNameFromProperty))] - public void GetsFrameworkNameFromProperty() - { - Property property = new Property - ( - name: "myProp", - type: new TypeReference("myFqn"), - isImmutable: false, - isProtected: false, - isAbstract: false - ); - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - isAbstract: false, - properties: new[] { property } - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetName(type, property); - Assert.Equal("MyProp", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(GetsFrameworkNameFromEnumMember))] - public void GetsFrameworkNameFromEnumMember() - { - EnumMember member = new EnumMember("myMember"); - Type type = new EnumType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - members: new[] { member } - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetName(type, member); - Assert.Equal("MyMember", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(GetsFrameworkNameFromParameter))] - public void GetsFrameworkNameFromParameter() - { - Parameter parameter = new Parameter(name: "myParam", type: new TypeReference("myFqn")); - Method method = new Method - ( - isProtected: false, - isAbstract: false, - parameters: new[] { parameter }, - name: "myMethod" - ); - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - isAbstract: false, - methods: new[] { method } - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetName(parameter); - Assert.Equal("myParam", actual, ignoreLineEndingDifferences: true); - } - } - - public class GetNameSyntaxToken - { - const string _Prefix = Prefix + nameof(SymbolMap.GetNameSyntaxToken) + "."; - - [Fact(DisplayName = Prefix + nameof(GetsFrameworkNameFromType))] - public void GetsFrameworkNameFromType() - { - Type type = new EnumType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - members: new EnumMember[] { } - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNameSyntaxToken(type).ToString(); - Assert.Equal("MyType", actual, ignoreLineEndingDifferences: true); - - actual = symbolMap.GetName("myFqn"); - Assert.Equal("MyType", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(DisambiguatesTypeNameOnConflict))] - public void DisambiguatesTypeNameOnConflict() - { - Type type1 = new EnumType - ( - fullyQualifiedName: "myFqn1", - assembly: "my-package-1", - name: "myType", - members: new EnumMember[] { } - ); - Type type2 = new EnumType - ( - fullyQualifiedName: "myFqn2", - assembly: "my-package-2", - name: "myType", - members: new EnumMember[] { } - ); - - Assembly assembly1 = new Assembly - ( - name: "my-package-1", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace1", - packageId: "My.PackageId1" - )), - version: "myVersion", - types: new Dictionary { { type1.FullyQualifiedName, type1 } }, - dependencies: new Dictionary - { - { - "my-package-2", - new PackageVersion( - version: "myVersion", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace2", - packageId: "My.PackageId2" - )) - ) - } - } - ); - Assembly assembly2 = new Assembly - ( - name: "my-package-2", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace2", - packageId: "My.PackageId2" - )), - version: "myVersion", - types: new Dictionary { { type2.FullyQualifiedName, type2 } } - ); - - ISymbolMap symbolMap = new SymbolMap(); - symbolMap.Add(assembly1); - symbolMap.Add(assembly2); - - // GetNameSyntaxToken(Type type) - string actual1 = symbolMap.GetNameSyntaxToken(type1, true).ToString(); - string actual2 = symbolMap.GetNameSyntaxToken(type2, true).ToString(); - Assert.Equal("My.Namespace1.MyType", actual1, ignoreLineEndingDifferences: true); - Assert.Equal("My.Namespace2.MyType", actual2, ignoreLineEndingDifferences: true); - - // GetNameSyntaxToken(string fullyQualifiedName) - actual1 = symbolMap.GetNameSyntaxToken("myFqn1", true).ToString(); - actual2 = symbolMap.GetNameSyntaxToken("myFqn2", true).ToString(); - Assert.Equal("My.Namespace1.MyType", actual1, ignoreLineEndingDifferences: true); - Assert.Equal("My.Namespace2.MyType", actual2, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(DoesNotDisambiguateTypeNameIfFlagNotSet))] - public void DoesNotDisambiguateTypeNameIfFlagNotSet() - { - Type type1 = new EnumType - ( - fullyQualifiedName: "myFqn1", - assembly: "my-package-1", - name: "myType", - members: new EnumMember[] { } - ); - Type type2 = new EnumType - ( - fullyQualifiedName: "myFqn2", - assembly: "my-package-2", - name: "myType", - members: new EnumMember[] { } - ); - - Assembly assembly1 = new Assembly - ( - name: "my-package-1", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace1", - packageId: "My.PackageId1" - )), - version: "myVersion", - types: new Dictionary { { type1.FullyQualifiedName, type1 } }, - dependencies: new Dictionary - { - { - "my-package-2", - new PackageVersion( - version: "myVersion", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace2", - packageId: "My.PackageId2" - )) - ) - } - } - ); - Assembly assembly2 = new Assembly - ( - name: "my-package-2", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace2", - packageId: "My.PackageId2" - )), - version: "myVersion", - types: new Dictionary { { type2.FullyQualifiedName, type2 } } - ); - - ISymbolMap symbolMap = new SymbolMap(); - symbolMap.Add(assembly1); - symbolMap.Add(assembly2); - - // GetNameSyntaxToken(Type type) - string actual1 = symbolMap.GetNameSyntaxToken(type1).ToString(); - string actual2 = symbolMap.GetNameSyntaxToken(type2).ToString(); - Assert.Equal("MyType", actual1, ignoreLineEndingDifferences: true); - Assert.Equal("MyType", actual2, ignoreLineEndingDifferences: true); - - // GetNameSyntaxToken(string fullyQualifiedName) - actual1 = symbolMap.GetNameSyntaxToken("myFqn1").ToString(); - actual2 = symbolMap.GetNameSyntaxToken("myFqn2").ToString(); - Assert.Equal("MyType", actual1, ignoreLineEndingDifferences: true); - Assert.Equal("MyType", actual2, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(GetsFrameworkNameFromMethod))] - public void GetsFrameworkNameFromMethod() - { - Method method = new Method - ( - isProtected: false, - isAbstract: false, - name: "myMethod" - ); - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - isAbstract: false, - methods: new[] { method } - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNameSyntaxToken(type, method).ToString(); - Assert.Equal("MyMethod", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(GetsFrameworkNameFromProperty))] - public void GetsFrameworkNameFromProperty() - { - Property property = new Property - ( - name: "myProp", - type: new TypeReference("myFqn"), - isImmutable: false, - isProtected: false, - isAbstract: false - ); - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - isAbstract: false, - properties: new[] { property } - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNameSyntaxToken(type, property).ToString(); - Assert.Equal("MyProp", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(GetsFrameworkNameFromEnumMember))] - public void GetsFrameworkNameFromEnumMember() - { - EnumMember member = new EnumMember("myMember"); - Type type = new EnumType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - members: new[] { member } - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNameSyntaxToken(type, member).ToString(); - Assert.Equal("MyMember", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(GetsFrameworkNameFromParameter))] - public void GetsFrameworkNameFromParameter() - { - Parameter parameter = new Parameter(name: "myParam", type: new TypeReference("myFqn")); - Method method = new Method - ( - isProtected: false, - isAbstract: false, - parameters: new[] { parameter }, - name: "myMethod" - ); - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - isAbstract: false, - methods: new[] { method } - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNameSyntaxToken(parameter).ToString(); - Assert.Equal("myParam", actual, ignoreLineEndingDifferences: true); - } - } - - public class GetNameSyntax - { - const string _Prefix = Prefix + nameof(SymbolMap.GetNameSyntax) + "."; - - [Fact(DisplayName = Prefix + nameof(GetsFrameworkNameFromType))] - public void GetsFrameworkNameFromType() - { - Type type = new EnumType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - members: new EnumMember[] { } - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNameSyntax(type).ToString(); - Assert.Equal("MyType", actual, ignoreLineEndingDifferences: true); - - actual = symbolMap.GetName("myFqn"); - Assert.Equal("MyType", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(DisambiguatesTypeNameOnConflict))] - public void DisambiguatesTypeNameOnConflict() - { - Type type1 = new EnumType - ( - fullyQualifiedName: "myFqn1", - assembly: "my-package-1", - name: "myType", - members: new EnumMember[] { } - ); - Type type2 = new EnumType - ( - fullyQualifiedName: "myFqn2", - assembly: "my-package-2", - name: "myType", - members: new EnumMember[] { } - ); - - Assembly assembly1 = new Assembly - ( - name: "my-package-1", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace1", - packageId: "My.PackageId1" - )), - version: "myVersion", - types: new Dictionary { { type1.FullyQualifiedName, type1 } }, - dependencies: new Dictionary - { - { - "my-package-2", - new PackageVersion( - version: "myVersion", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace2", - packageId: "My.PackageId2" - )) - ) - } - } - ); - Assembly assembly2 = new Assembly - ( - name: "my-package-2", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace2", - packageId: "My.PackageId2" - )), - version: "myVersion", - types: new Dictionary { { type2.FullyQualifiedName, type2 } } - ); - - ISymbolMap symbolMap = new SymbolMap(); - symbolMap.Add(assembly1); - symbolMap.Add(assembly2); - - // GetNameSyntax(Type type) - string actual1 = symbolMap.GetNameSyntax(type1, true).ToString(); - string actual2 = symbolMap.GetNameSyntax(type2, true).ToString(); - Assert.Equal("My.Namespace1.MyType", actual1, ignoreLineEndingDifferences: true); - Assert.Equal("My.Namespace2.MyType", actual2, ignoreLineEndingDifferences: true); - - // GetNameSyntax(string fullyQualifiedName) - actual1 = symbolMap.GetNameSyntax("myFqn1", true).ToString(); - actual2 = symbolMap.GetNameSyntax("myFqn2", true).ToString(); - Assert.Equal("My.Namespace1.MyType", actual1, ignoreLineEndingDifferences: true); - Assert.Equal("My.Namespace2.MyType", actual2, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(DoesNotDisambiguateTypeNameIfFlagNotSet))] - public void DoesNotDisambiguateTypeNameIfFlagNotSet() - { - Type type1 = new EnumType - ( - fullyQualifiedName: "myFqn1", - assembly: "my-package-1", - name: "myType", - members: new EnumMember[] { } - ); - Type type2 = new EnumType - ( - fullyQualifiedName: "myFqn2", - assembly: "my-package-2", - name: "myType", - members: new EnumMember[] { } - ); - - Assembly assembly1 = new Assembly - ( - name: "my-package-1", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace1", - packageId: "My.PackageId1" - )), - version: "myVersion", - types: new Dictionary { { type1.FullyQualifiedName, type1 } }, - dependencies: new Dictionary - { - { - "my-package-2", - new PackageVersion( - "myVersion", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace2", - packageId: "My.PackageId2" - )) - ) - } - } - ); - Assembly assembly2 = new Assembly - ( - name: "my-package-2", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(dotnet: new AssemblyTargets.DotNetTarget( - @namespace: "My.Namespace2", - packageId: "My.PackageId2" - )), - version: "myVersion", - types: new Dictionary { { type2.FullyQualifiedName, type2 } } - ); - - ISymbolMap symbolMap = new SymbolMap(); - symbolMap.Add(assembly1); - symbolMap.Add(assembly2); - - // GetNameSyntax(Type type) - string actual1 = symbolMap.GetNameSyntax(type1).ToString(); - string actual2 = symbolMap.GetNameSyntax(type2).ToString(); - Assert.Equal("MyType", actual1, ignoreLineEndingDifferences: true); - Assert.Equal("MyType", actual2, ignoreLineEndingDifferences: true); - - // GetNameSyntax(string fullyQualifiedName) - actual1 = symbolMap.GetNameSyntax("myFqn1").ToString(); - actual2 = symbolMap.GetNameSyntax("myFqn2").ToString(); - Assert.Equal("MyType", actual1, ignoreLineEndingDifferences: true); - Assert.Equal("MyType", actual2, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(GetsFrameworkNameFromMethod))] - public void GetsFrameworkNameFromMethod() - { - Method method = new Method - ( - isProtected: false, - isAbstract: false, - name: "myMethod" - ); - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - isAbstract: false, - methods: new[] { method } - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNameSyntax(type, method).ToString(); - Assert.Equal("MyMethod", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(GetsFrameworkNameFromProperty))] - public void GetsFrameworkNameFromProperty() - { - Property property = new Property - ( - name: "myProp", - type: new TypeReference("myFqn"), - isImmutable: false, - isProtected: false, - isAbstract: false - ); - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - isAbstract: false, - properties: new[] { property } - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNameSyntax(type, property).ToString(); - Assert.Equal("MyProp", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(GetsFrameworkNameFromEnumMember))] - public void GetsFrameworkNameFromEnumMember() - { - EnumMember member = new EnumMember("myMember"); - Type type = new EnumType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - members: new[] { member } - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNameSyntax(type, member).ToString(); - Assert.Equal("MyMember", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = Prefix + nameof(GetsFrameworkNameFromParameter))] - public void GetsFrameworkNameFromParameter() - { - Parameter parameter = new Parameter(name: "myParam", type: new TypeReference("myFqn")); - Method method = new Method - ( - isProtected: false, - isAbstract: false, - parameters: new[] { parameter }, - name: "myMethod" - ); - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myType", - isAbstract: false, - methods: new[] { method } - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNameSyntax(parameter).ToString(); - Assert.Equal("myParam", actual, ignoreLineEndingDifferences: true); - } - } - - public class GetNamespace - { - const string _Prefix = Prefix + nameof(SymbolMap.GetNamespace) + "."; - - [Fact(DisplayName = _Prefix + nameof(GetsFrameworkNamespaceFromType))] - public void GetsFrameworkNamespaceFromType() - { - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myName", - isAbstract: false - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNamespace(type); - Assert.Equal("My.Namespace", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = _Prefix + nameof(GetsFrameworkNamespaceFromFqn))] - public void GetsFrameworkNamespaceFromFqn() - { - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myName", - isAbstract: false - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNamespace("myFqn"); - Assert.Equal("My.Namespace", actual, ignoreLineEndingDifferences: true); - } - } - - public class GetNamespaceSyntaxToken - { - const string _Prefix = Prefix + nameof(SymbolMap.GetNamespaceSyntaxToken) + "."; - - [Fact(DisplayName = _Prefix + nameof(GetsFrameworkNamespaceFromType))] - public void GetsFrameworkNamespaceFromType() - { - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myName", - isAbstract: false - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNamespaceSyntaxToken(type).ToString(); - Assert.Equal("My.Namespace", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = _Prefix + nameof(GetsFrameworkNamespaceFromFqn))] - public void GetsFrameworkNamespaceFromFqn() - { - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myName", - isAbstract: false - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNamespaceSyntaxToken("myFqn").ToString(); - Assert.Equal("My.Namespace", actual, ignoreLineEndingDifferences: true); - } - } - - public class GetNamespaceSyntax - { - const string _Prefix = Prefix + nameof(SymbolMap.GetNamespaceSyntax) + "."; - - [Fact(DisplayName = _Prefix + nameof(GetsFrameworkNamespaceFromType))] - public void GetsFrameworkNamespaceFromType() - { - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myName", - isAbstract: false - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNamespaceSyntax(type).ToString(); - Assert.Equal("My.Namespace", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = _Prefix + nameof(GetsFrameworkNamespaceFromFqn))] - public void GetsFrameworkNamespaceFromFqn() - { - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myName", - isAbstract: false - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetNamespaceSyntax("myFqn").ToString(); - Assert.Equal("My.Namespace", actual, ignoreLineEndingDifferences: true); - } - } - - public class GetPackage - { - const string _Prefix = Prefix + nameof(SymbolMap.GetPackage) + "."; - - [Fact(DisplayName = _Prefix + nameof(GetsFrameworkPackageFromType))] - public void GetsFrameworkPackageFromType() - { - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myName", - isAbstract: false - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetPackage(type); - Assert.Equal("my-package", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = _Prefix + nameof(GetsFrameworkPackageFromFqn))] - public void GetsFrameworkPackageFromFqn() - { - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myName", - isAbstract: false - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetPackage("myFqn"); - Assert.Equal("my-package", actual, ignoreLineEndingDifferences: true); - } - } - - public class GetPackageSyntaxToken - { - const string _Prefix = Prefix + nameof(SymbolMap.GetPackageSyntaxToken) + "."; - - [Fact(DisplayName = _Prefix + nameof(GetsFrameworkPackageFromType))] - public void GetsFrameworkPackageFromType() - { - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myName", - isAbstract: false - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetPackageSyntaxToken(type).ToString(); - Assert.Equal("my-package", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = _Prefix + nameof(GetsFrameworkPackageFromFqn))] - public void GetsFrameworkPackageFromFqn() - { - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myName", - isAbstract: false - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetPackageSyntaxToken("myFqn").ToString(); - Assert.Equal("my-package", actual, ignoreLineEndingDifferences: true); - } - } - - public class GetPackageSyntax - { - const string _Prefix = Prefix + nameof(SymbolMap.GetPackageSyntax) + "."; - - [Fact(DisplayName = _Prefix + nameof(GetsFrameworkPackageFromType))] - public void GetsFrameworkPackageFromType() - { - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myName", - isAbstract: false - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetPackageSyntax(type).ToString(); - Assert.Equal("my-package", actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = _Prefix + nameof(GetsFrameworkPackageFromFqn))] - public void GetsFrameworkPackageFromFqn() - { - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myName", - isAbstract: false - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - - string actual = symbolMap.GetPackageSyntax("myFqn").ToString(); - Assert.Equal("my-package", actual, ignoreLineEndingDifferences: true); - } - } - - public class GetTypeSyntax - { - const string _Prefix = Prefix + nameof(SymbolMap.GetTypeSyntax) + "."; - - [Theory(DisplayName = _Prefix + nameof(GetsPrimitiveFrameworkType))] - [InlineData(PrimitiveType.Any, false, "object")] - [InlineData(PrimitiveType.Any, true, "object")] - [InlineData(PrimitiveType.Boolean, false, "bool")] - [InlineData(PrimitiveType.Boolean, true, "bool?")] - [InlineData(PrimitiveType.Date, false, "DateTime")] - [InlineData(PrimitiveType.Date, true, "DateTime?")] - [InlineData(PrimitiveType.Json, false, "JObject")] - [InlineData(PrimitiveType.Json, true, "JObject")] - [InlineData(PrimitiveType.Number, false, "double")] - [InlineData(PrimitiveType.Number, true, "double?")] - [InlineData(PrimitiveType.String, false, "string")] - [InlineData(PrimitiveType.String, true, "string")] - public void GetsPrimitiveFrameworkType(PrimitiveType type, bool isOptional, string expected) - { - ISymbolMap symbolMap = new SymbolMap(); - - var reference = new TypeReference(primitive: type); - - var actual = symbolMap.GetTypeSyntax(reference, isOptional).ToString(); - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Theory(DisplayName = _Prefix + nameof(GetsRecursiveCollectionFrameworkType))] - [InlineData(CollectionKind.Array, false, "double[][]")] - [InlineData(CollectionKind.Array, true, "double[][]")] - [InlineData(CollectionKind.Map, false, "IDictionary>")] - [InlineData(CollectionKind.Map, true, "IDictionary>")] - public void GetsRecursiveCollectionFrameworkType(CollectionKind kind, bool isOptional, string expected) - { - ISymbolMap symbolMap = new SymbolMap(); - - var reference = new TypeReference - ( - collection: new CollectionTypeReference - ( - kind: kind, - elementType: new TypeReference( - collection: new CollectionTypeReference(kind, new TypeReference(primitive: PrimitiveType.Number)) - ) - ) - ); - - string actual = symbolMap.GetTypeSyntax(reference, isOptional).ToString(); - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Theory(DisplayName = _Prefix + nameof(GetsUnionFrameworkType))] - [InlineData(false, "object")] - [InlineData(true, "object")] - public void GetsUnionFrameworkType(bool isOptional, string expected) - { - ISymbolMap symbolMap = new SymbolMap(); - - var reference = new TypeReference - ( - union: new UnionTypeReference(new[] { - new TypeReference(primitive: PrimitiveType.Number) - }) - ); - - string actual = symbolMap.GetTypeSyntax(reference, isOptional).ToString(); - Assert.Equal(expected, actual, ignoreLineEndingDifferences: true); - } - - [Fact(DisplayName = _Prefix + nameof(GetsObjectFrameworkType))] - public void GetsObjectFrameworkType() - { - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myName", - isAbstract: false - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - TypeReference reference = new TypeReference("myFqn"); - - string actual = symbolMap.GetTypeSyntax(reference, false).ToString(); - Assert.Equal("My.Namespace.MyName", actual, ignoreLineEndingDifferences: true); - - } - } - - public class GetTypeFromFullyQualifiedName - { - const string _Prefix = Prefix + nameof(SymbolMap.GetTypeFromFullyQualifiedName) + "."; - - public void GetsObjectFrameworkType() - { - Type type = new ClassType - ( - fullyQualifiedName: "myFqn", - assembly: "my-package", - name: "myName", - isAbstract: false - ); - - ISymbolMap symbolMap = GetSymbolMap(type); - TypeReference reference = new TypeReference("myFqn"); - - ClassType actual = symbolMap.GetTypeFromFullyQualifiedName("myFqn") as ClassType; - Assert.NotNull(actual); - Assert.Equal("myFqn", actual.FullyQualifiedName, ignoreLineEndingDifferences: true); - Assert.Equal("my-package", actual.Assembly, ignoreLineEndingDifferences: true); - Assert.Equal("myName", actual.Name, ignoreLineEndingDifferences: true); - Assert.Equal("my-package", actual.Namespace, ignoreLineEndingDifferences: true); - Assert.False(actual.IsAbstract); - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/TypeExtensionsTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/TypeExtensionsTests.cs deleted file mode 100644 index 8f19a32c7a..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/TypeExtensionsTests.cs +++ /dev/null @@ -1,132 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using NSubstitute; -using Xunit; - -namespace Amazon.JSII.Generator.UnitTests -{ - public class TypeExtensionsTests - { - const string Prefix = nameof(Generator) + "." + nameof(TypeExtensions) + "."; - - public class AnyAncestor : GeneratorTestBase - { - const string _Prefix = Prefix + nameof(TypeExtensions.AnyAncestor); - - ClassType CreateType(bool includeParent, bool includeGrandparent) - { - ClassType grandParentType = null; - if (includeGrandparent) - { - grandParentType = new ClassType - ( - fullyQualifiedName: "myGrandParentTypeFqn", - assembly: "myPackage", - name: "myGrandParentType", - isAbstract: false - ); - - Symbols.MapFullyQualifiedNameToType("myGrandParentTypeFqn", grandParentType); - } - - ClassType parentType = null; - if (includeParent) - { - parentType = new ClassType - ( - fullyQualifiedName: "myParentTypeFqn", - assembly: "myPackage", - name: "myParentType", - isAbstract: false, - @base: includeGrandparent ? "myGrandParentTypeFqn" : null - ); - Symbols.MapFullyQualifiedNameToType("myParentTypeFqn", parentType); - } - - ClassType classType = new ClassType - ( - fullyQualifiedName: "myClassFqn", - assembly: "myPackage", - name: "myClass", - isAbstract: false, - @base: includeParent ? "myParentTypeFqn" : null - ); - Symbols.MapFullyQualifiedNameToType("myClassFqn", classType); - - return classType; - } - - [Fact(DisplayName = _Prefix + nameof(ReturnsFalseIfNoAncestorExists))] - public void ReturnsFalseIfNoAncestorExists() - { - ClassType classType = CreateType(false, false); - - bool actual = classType.AnyAncestor(Symbols, t => t.Name != string.Empty); - Assert.False(actual); - } - - [Fact(DisplayName = _Prefix + nameof(ReturnsFalseIfNoAncestorMatches))] - public void ReturnsFalseIfNoAncestorMatches() - { - ClassType classType = CreateType(true, true); - - bool actual = classType.AnyAncestor(Symbols, t => t.Name == "myNephewType"); - Assert.False(actual); - } - - [Fact(DisplayName = _Prefix + nameof(ReturnsTrueIfBaseMatches))] - public void ReturnsTrueIfBaseMatches() - { - ClassType classType = CreateType(true, true); - - bool actual = classType.AnyAncestor(Symbols, t => t.Name == "myParentType"); - Assert.True(actual); - } - - [Fact(DisplayName = _Prefix + nameof(ReturnsTrueIfAncestorMatches))] - public void ReturnsTrueIfAncestorMatches() - { - ClassType classType = CreateType(true, true); - - bool actual = classType.AnyAncestor(Symbols, t => t.Name == "myGrandParentType"); - Assert.True(actual); - } - - [Fact(DisplayName = _Prefix + nameof(DoesNotAttemptToMatchSelf))] - public void DoesNotAttemptToMatchSelf() - { - ClassType classType = CreateType(true, true); - - bool actual = classType.AnyAncestor(Symbols, t => t.Name == "myClass"); - Assert.False(actual); - } - - [Fact(DisplayName = _Prefix + nameof(DoesNotAttemptToMatchInterfaces))] - public void DoesNotAttemptToMatchInterfaces() - { - InterfaceType interfaceType = new InterfaceType - ( - fullyQualifiedName: "myInterfaceFqn", - assembly: "myPackage", - name: "myInterface" - ); - Symbols.MapFullyQualifiedNameToType("myInterfaceFqn", interfaceType); - - ClassType classType = new ClassType - ( - fullyQualifiedName: "myClassFqn", - assembly: "myPackage", - name: "myClass", - isAbstract: false, - interfaces: new[] { "myInterfaceFqn" } - ); - Symbols.MapFullyQualifiedNameToType("myClassFqn", classType); - - bool actual = classType.AnyAncestor(Symbols, t => t.Name == "myInterface"); - Assert.False(actual); - } - } - - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/TypeMetadataTests.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/TypeMetadataTests.cs deleted file mode 100644 index 895ef7aff5..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.UnitTests/TypeMetadataTests.cs +++ /dev/null @@ -1,462 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; - -namespace Amazon.JSII.Generator.UnitTests -{ - public class TypeMetadataTests - { - const string Prefix = nameof(Generator) + "." + nameof(TypeMetadata) + "."; - - public class Class - { - const string _Prefix = Prefix + nameof(Class) + "."; - - readonly Assembly _assembly = new Assembly( - name: "myName", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: "myNativeName", - packageId: "myPackageId1" - )), - dependencies: new Dictionary - { - { - "myModule", - new PackageVersion( - "0.0.1", - new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: "myPackageNativeName", - packageId: "myPackageId2" - )) - ) - } - }, - version: "myVersion", - types: new Dictionary() - ); - - readonly ClassType _type = new ClassType( - fullyQualifiedName: "myFqn", - assembly: "myModule", - name: "myName", - @namespace: "myNamespace", - isAbstract: false - ); - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnNullType))] - public void ThrowsOnNullType() - { - ArgumentNullException exception = Assert.Throws(() => new ClassTypeMetadata(null, _assembly)); - Assert.Equal("type", exception.ParamName); - } - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnNullAssembly))] - public void ThrowsOnNullAssembly() - { - ArgumentNullException exception = Assert.Throws(() => new ClassTypeMetadata(_type, null)); - Assert.Equal("assembly", exception.ParamName); - } - - [Fact(DisplayName = _Prefix + nameof(SetsName))] - public void SetsName() - { - ClassTypeMetadata metadata = new ClassTypeMetadata(_type, _assembly); - - Assert.Equal("MyName", metadata.Name); - } - - [Fact(DisplayName = _Prefix + nameof(SetsFrameworkFullyQualifiedName))] - public void SetsFrameworkFullyQualifiedName() - { - ClassTypeMetadata metadata = new ClassTypeMetadata(_type, _assembly); - - Assert.Equal("myPackageNativeName.myNamespace.MyName", metadata.FrameworkFullyQualifiedName); - } - - [Fact(DisplayName = _Prefix + nameof(SetsPackage))] - public void SetsPackage() - { - ClassTypeMetadata metadata = new ClassTypeMetadata(_type, _assembly); - - Assert.Equal("myModule", metadata.Package); - } - - [Fact(DisplayName = _Prefix + nameof(SetsNamespace))] - public void SetsNamespace() - { - ClassTypeMetadata metadata = new ClassTypeMetadata(_type, _assembly); - - Assert.Equal("myPackageNativeName.myNamespace", metadata.Namespace); - } - - [Fact(DisplayName = _Prefix + nameof(DisambiguatesNamespaceConflicts))] - public void DisambiguatesNamespaceConflicts() - { - ClassTypeMetadata metadata = new ClassTypeMetadata(_type, _assembly); - metadata.ResolveTypeNameConflicts(new HashSet(new[] { - "myPackageNativeName.myNamespace.MyName" - })); - - Assert.Equal("MyName_", metadata.Name); - } - - [Fact(DisplayName = _Prefix + nameof(DisambiguatesPropertyConflicts))] - public void DisambiguatesPropertyConflicts() - { - ClassType type = new ClassType( - fullyQualifiedName: "myFqn", - assembly: "myModule", - name: "myName", - @namespace: "myNamespace", - isAbstract: false, - properties: new[] { - new Property( - name: "myName", - type: new TypeReference(primitive: PrimitiveType.String) - ) - } - ); - - ClassTypeMetadata metadata = new ClassTypeMetadata(type, _assembly); - metadata.ResolveTypeNameConflicts(new HashSet()); - - Assert.Equal("MyName_", metadata.Name); - } - - [Fact(DisplayName = _Prefix + nameof(DisambiguatesMethodConflicts))] - public void DisambiguatesMethodConflicts() - { - ClassType type = new ClassType( - fullyQualifiedName: "myFqn", - assembly: "myModule", - name: "myName", - @namespace: "myNamespace", - isAbstract: false, - methods: new[] { - new Method( - isProtected: false, - isAbstract: false, - name: "myName", - returns: new OptionalValue(type: new TypeReference(primitive: PrimitiveType.String)) - ) - } - ); - - ClassTypeMetadata metadata = new ClassTypeMetadata(type, _assembly); - metadata.ResolveTypeNameConflicts(new HashSet()); - - Assert.Equal("MyName_", metadata.Name); - } - } - - public class Enum - { - const string _Prefix = Prefix + nameof(Enum) + "."; - - readonly Assembly _assembly = new Assembly( - name: "myName", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: "myNativeName", - packageId: "myPackageId1" - )), - dependencies: new Dictionary - { - { - "myModule", - new PackageVersion( - "0.0.1", - new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: "myPackageNativeName", - packageId: "myPackageId2" - )) - ) - } - }, - version: "myVersion", - types: new Dictionary() - ); - - readonly EnumType _type = new EnumType( - fullyQualifiedName: "myFqn", - assembly: "myModule", - name: "myName", - @namespace: "myNamespace", - members: new EnumMember[] { } - ); - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnNullType))] - public void ThrowsOnNullType() - { - ArgumentNullException exception = Assert.Throws(() => new EnumTypeMetadata(null, _assembly)); - Assert.Equal("type", exception.ParamName); - } - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnNullAssembly))] - public void ThrowsOnNullAssembly() - { - ArgumentNullException exception = Assert.Throws(() => new EnumTypeMetadata(_type, null)); - Assert.Equal("assembly", exception.ParamName); - } - - [Fact(DisplayName = _Prefix + nameof(SetsName))] - public void SetsName() - { - EnumTypeMetadata metadata = new EnumTypeMetadata(_type, _assembly); - - Assert.Equal("MyName", metadata.Name); - } - - [Fact(DisplayName = _Prefix + nameof(SetsFrameworkFullyQualifiedName))] - public void SetsFrameworkFullyQualifiedName() - { - EnumTypeMetadata metadata = new EnumTypeMetadata(_type, _assembly); - - Assert.Equal("myPackageNativeName.myNamespace.MyName", metadata.FrameworkFullyQualifiedName); - } - - [Fact(DisplayName = _Prefix + nameof(SetsPackage))] - public void SetsPackage() - { - EnumTypeMetadata metadata = new EnumTypeMetadata(_type, _assembly); - - Assert.Equal("myModule", metadata.Package); - } - - [Fact(DisplayName = _Prefix + nameof(SetsNamespace))] - public void SetsNamespace() - { - EnumTypeMetadata metadata = new EnumTypeMetadata(_type, _assembly); - - Assert.Equal("myPackageNativeName.myNamespace", metadata.Namespace); - } - - [Fact(DisplayName = _Prefix + nameof(DisambiguatesNamespaceConflicts))] - public void DisambiguatesNamespaceConflicts() - { - EnumTypeMetadata metadata = new EnumTypeMetadata(_type, _assembly); - metadata.ResolveTypeNameConflicts(new HashSet(new[] { - "myPackageNativeName.myNamespace.MyName" - })); - - Assert.Equal("MyName_", metadata.Name); - } - - [Fact(DisplayName = _Prefix + nameof(DisambiguatesMemberConflicts))] - public void DisambiguatesMemberConflicts() - { - EnumType type = new EnumType( - fullyQualifiedName: "myFqn", - assembly: "myModule", - name: "myName", - @namespace: "myNamespace", - members: new[] { - new EnumMember("myName") - } - ); - - EnumTypeMetadata metadata = new EnumTypeMetadata(type, _assembly); - metadata.ResolveTypeNameConflicts(new HashSet()); - - Assert.Equal("MyName_", metadata.Name); - } - } - - public class Interface - { - const string _Prefix = Prefix + nameof(Interface) + "."; - - readonly Assembly _assembly = new Assembly( - name: "myName", - description: "", - homepage: "", - repository: new Assembly.AssemblyRepository(type: "", url: ""), - author: new Person(name: "", roles: new string[] { }), - fingerprint: "", - license: "", - targets: new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: "myNativeName", - packageId: "myPackageId1" - )), - dependencies: new Dictionary - { - { - "myModule", - new PackageVersion( - "0.0.1", - new AssemblyTargets(new AssemblyTargets.DotNetTarget( - @namespace: "myPackageNativeName", - packageId: "myPackageId2" - )) - ) - } - }, - version: "myVersion", - types: new Dictionary() - ); - - readonly InterfaceType _type = new InterfaceType( - fullyQualifiedName: "myFqn", - assembly: "myModule", - name: "myName", - @namespace: "myNamespace", - isDataType: true - ); - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnNullType))] - public void ThrowsOnNullType() - { - ArgumentNullException exception = Assert.Throws(() => new InterfaceTypeMetadata(null, _assembly)); - Assert.Equal("type", exception.ParamName); - } - - [Fact(DisplayName = _Prefix + nameof(ThrowsOnNullAssembly))] - public void ThrowsOnNullAssembly() - { - InterfaceType type = new InterfaceType( - fullyQualifiedName: "myFqn", - assembly: "myModule", - name: "myName", - @namespace: "myNamespace" - ); - - ArgumentNullException exception = Assert.Throws(() => new InterfaceTypeMetadata(_type, null)); - Assert.Equal("assembly", exception.ParamName); - } - - [Fact(DisplayName = _Prefix + nameof(SetsName))] - public void SetsName() - { - InterfaceTypeMetadata metadata = new InterfaceTypeMetadata(_type, _assembly); - - Assert.Equal("IMyName", metadata.Name); - } - - [Fact(DisplayName = _Prefix + nameof(SetsProxyName))] - public void SetsProxyName() - { - InterfaceTypeMetadata metadata = new InterfaceTypeMetadata(_type, _assembly); - - Assert.Equal("MyNameProxy", metadata.ProxyName); - } - - [Fact(DisplayName = _Prefix + nameof(SetsDefaultName))] - public void SetsDefaultName() - { - InterfaceTypeMetadata metadata = new InterfaceTypeMetadata(_type, _assembly); - - Assert.Equal("MyName", metadata.DefaultName); - } - - [Fact(DisplayName = _Prefix + nameof(SetsFrameworkFullyQualifiedName))] - public void SetsFrameworkFullyQualifiedName() - { - InterfaceTypeMetadata metadata = new InterfaceTypeMetadata(_type, _assembly); - - Assert.Equal("myPackageNativeName.myNamespace.IMyName", metadata.FrameworkFullyQualifiedName); - } - - [Fact(DisplayName = _Prefix + nameof(SetsFrameworkFullyQualifiedProxyName))] - public void SetsFrameworkFullyQualifiedProxyName() - { - InterfaceTypeMetadata metadata = new InterfaceTypeMetadata(_type, _assembly); - - Assert.Equal("myPackageNativeName.myNamespace.MyNameProxy", metadata.FrameworkFullyQualifiedProxyName); - } - - [Fact(DisplayName = _Prefix + nameof(SetsFrameworkFullyQualifiedDefaultName))] - public void SetsFrameworkFullyQualifiedDefaultName() - { - InterfaceTypeMetadata metadata = new InterfaceTypeMetadata(_type, _assembly); - - Assert.Equal("myPackageNativeName.myNamespace.MyName", metadata.FrameworkFullyQualifiedDefaultName); - } - - [Fact(DisplayName = _Prefix + nameof(SetsPackage))] - public void SetsPackage() - { - InterfaceTypeMetadata metadata = new InterfaceTypeMetadata(_type, _assembly); - - Assert.Equal("myModule", metadata.Package); - } - - [Fact(DisplayName = _Prefix + nameof(SetsNamespace))] - public void SetsNamespace() - { - InterfaceTypeMetadata metadata = new InterfaceTypeMetadata(_type, _assembly); - - Assert.Equal("myPackageNativeName.myNamespace", metadata.Namespace); - } - - [Fact(DisplayName = _Prefix + nameof(DisambiguatesNamespaceConflicts))] - public void DisambiguatesNamespaceConflicts() - { - InterfaceTypeMetadata metadata = new InterfaceTypeMetadata(_type, _assembly); - metadata.ResolveTypeNameConflicts(new HashSet(new[] { - "myPackageNativeName.myNamespace.IMyName" - })); - - Assert.Equal("IMyName_", metadata.Name); - } - - [Fact(DisplayName = _Prefix + nameof(DisambiguatesPropertyConflicts))] - public void DisambiguatesPropertyConflicts() - { - InterfaceType type = new InterfaceType( - fullyQualifiedName: "myFqn", - assembly: "myModule", - name: "myName", - @namespace: "myNamespace", - properties: new[] { - new Property( - name: "iMyName", - type: new TypeReference(primitive: PrimitiveType.String) - ) - } - ); - - InterfaceTypeMetadata metadata = new InterfaceTypeMetadata(type, _assembly); - metadata.ResolveTypeNameConflicts(new HashSet()); - - Assert.Equal("IMyName_", metadata.Name); - } - - [Fact(DisplayName = _Prefix + nameof(DisambiguatesMethodConflicts))] - public void DisambiguatesMethodConflicts() - { - InterfaceType type = new InterfaceType( - fullyQualifiedName: "myFqn", - assembly: "myModule", - name: "myName", - @namespace: "myNamespace", - methods: new[] { - new Method( - isProtected: false, - isAbstract: false, - name: "iMyName", - returns: new OptionalValue(type: new TypeReference(primitive: PrimitiveType.String)) - ) - } - ); - - InterfaceTypeMetadata metadata = new InterfaceTypeMetadata(type, _assembly); - metadata.ResolveTypeNameConflicts(new HashSet()); - - Assert.Equal("IMyName_", metadata.Name); - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.sln b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.sln deleted file mode 100644 index 9c753ffff9..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator.sln +++ /dev/null @@ -1,62 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Amazon.JSII.Generator", "Amazon.JSII.Generator\Amazon.JSII.Generator.csproj", "{6C634941-79D4-43F1-95F6-98CFF070BA3D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Amazon.JSII.Generator.UnitTests", "Amazon.JSII.Generator.UnitTests\Amazon.JSII.Generator.UnitTests.csproj", "{D1F82EE2-73F3-4001-BD53-EA407E7DE180}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Amazon.JSII.Generator.CLI", "Amazon.JSII.Generator.CLI\Amazon.JSII.Generator.CLI.csproj", "{9613D697-2F57-4818-916C-F97F1407D8C1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6C634941-79D4-43F1-95F6-98CFF070BA3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6C634941-79D4-43F1-95F6-98CFF070BA3D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6C634941-79D4-43F1-95F6-98CFF070BA3D}.Debug|x64.ActiveCfg = Debug|Any CPU - {6C634941-79D4-43F1-95F6-98CFF070BA3D}.Debug|x64.Build.0 = Debug|Any CPU - {6C634941-79D4-43F1-95F6-98CFF070BA3D}.Debug|x86.ActiveCfg = Debug|Any CPU - {6C634941-79D4-43F1-95F6-98CFF070BA3D}.Debug|x86.Build.0 = Debug|Any CPU - {6C634941-79D4-43F1-95F6-98CFF070BA3D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6C634941-79D4-43F1-95F6-98CFF070BA3D}.Release|Any CPU.Build.0 = Release|Any CPU - {6C634941-79D4-43F1-95F6-98CFF070BA3D}.Release|x64.ActiveCfg = Release|Any CPU - {6C634941-79D4-43F1-95F6-98CFF070BA3D}.Release|x64.Build.0 = Release|Any CPU - {6C634941-79D4-43F1-95F6-98CFF070BA3D}.Release|x86.ActiveCfg = Release|Any CPU - {6C634941-79D4-43F1-95F6-98CFF070BA3D}.Release|x86.Build.0 = Release|Any CPU - {D1F82EE2-73F3-4001-BD53-EA407E7DE180}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D1F82EE2-73F3-4001-BD53-EA407E7DE180}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D1F82EE2-73F3-4001-BD53-EA407E7DE180}.Debug|x64.ActiveCfg = Debug|Any CPU - {D1F82EE2-73F3-4001-BD53-EA407E7DE180}.Debug|x64.Build.0 = Debug|Any CPU - {D1F82EE2-73F3-4001-BD53-EA407E7DE180}.Debug|x86.ActiveCfg = Debug|Any CPU - {D1F82EE2-73F3-4001-BD53-EA407E7DE180}.Debug|x86.Build.0 = Debug|Any CPU - {D1F82EE2-73F3-4001-BD53-EA407E7DE180}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D1F82EE2-73F3-4001-BD53-EA407E7DE180}.Release|Any CPU.Build.0 = Release|Any CPU - {D1F82EE2-73F3-4001-BD53-EA407E7DE180}.Release|x64.ActiveCfg = Release|Any CPU - {D1F82EE2-73F3-4001-BD53-EA407E7DE180}.Release|x64.Build.0 = Release|Any CPU - {D1F82EE2-73F3-4001-BD53-EA407E7DE180}.Release|x86.ActiveCfg = Release|Any CPU - {D1F82EE2-73F3-4001-BD53-EA407E7DE180}.Release|x86.Build.0 = Release|Any CPU - {9613D697-2F57-4818-916C-F97F1407D8C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9613D697-2F57-4818-916C-F97F1407D8C1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9613D697-2F57-4818-916C-F97F1407D8C1}.Debug|x64.ActiveCfg = Debug|Any CPU - {9613D697-2F57-4818-916C-F97F1407D8C1}.Debug|x64.Build.0 = Debug|Any CPU - {9613D697-2F57-4818-916C-F97F1407D8C1}.Debug|x86.ActiveCfg = Debug|Any CPU - {9613D697-2F57-4818-916C-F97F1407D8C1}.Debug|x86.Build.0 = Debug|Any CPU - {9613D697-2F57-4818-916C-F97F1407D8C1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9613D697-2F57-4818-916C-F97F1407D8C1}.Release|Any CPU.Build.0 = Release|Any CPU - {9613D697-2F57-4818-916C-F97F1407D8C1}.Release|x64.ActiveCfg = Release|Any CPU - {9613D697-2F57-4818-916C-F97F1407D8C1}.Release|x64.Build.0 = Release|Any CPU - {9613D697-2F57-4818-916C-F97F1407D8C1}.Release|x86.ActiveCfg = Release|Any CPU - {9613D697-2F57-4818-916C-F97F1407D8C1}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Amazon.JSII.Generator.csproj b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Amazon.JSII.Generator.csproj deleted file mode 100644 index 12dc48d768..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Amazon.JSII.Generator.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - - Amazon.JSII.Generator - .NET Code Generator for JSII - - - - - - - diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/AssemblyExtensions.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/AssemblyExtensions.cs deleted file mode 100644 index 73226d70d9..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/AssemblyExtensions.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using System; -using System.Collections.Generic; -using System.Xml.Linq; - -namespace Amazon.JSII.Generator -{ - public static class AssemblyExtensions - { - public static string GetNativePackageId(this Assembly assembly, string targetPackageName = null) - { - assembly = assembly ?? throw new ArgumentNullException(nameof(assembly)); - - string packageId = assembly.GetNativeProperty - ( - assembly.Name, - targetPackageName ?? assembly.Name, - d => d.Targets?.DotNet?.PackageId - ); - - if (string.IsNullOrWhiteSpace(packageId)) - { - throw new ArgumentException - ( - $"Assembly {assembly.Name} does not include a package id mapping for {targetPackageName ?? assembly.Name}", - nameof(assembly) - ); - } - - return packageId; - } - - public static string GetNativeNamespace(this Assembly assembly, string targetPackageName = null) - { - assembly = assembly ?? throw new ArgumentNullException(nameof(assembly)); - - string @namespace = assembly.GetNativeProperty - ( - assembly.Name, - targetPackageName ?? assembly.Name, - d => d.Targets?.DotNet?.Namespace - ); - - if (string.IsNullOrWhiteSpace(@namespace)) - { - throw new ArgumentException - ( - $"Assembly {assembly.Name} does not include a namespace mapping for {targetPackageName ?? assembly.Name}", - nameof(assembly) - ); - } - - return @namespace; - } - - public static IEnumerable GetMsBuildProperties(this Assembly assembly) - { - yield return new XElement("TargetFramework", "netstandard2.0"); - yield return new XElement("GeneratePackageOnBuild", true); - yield return new XElement("IncludeSymbols", true); - yield return new XElement("IncludeSource", true); - yield return new XElement("PackageVersion", assembly.GetDecoratedVersion()); - yield return new XElement("PackageId", assembly.Targets.DotNet.PackageId); - 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}"); - - // TODO: Update once we have a localization story. - yield return new XElement("Language", "en-US"); - - if (assembly.Targets.DotNet.Title != null) - { - yield return new XElement("Title", assembly.Targets.DotNet.Title); - } - - if (assembly.Targets.DotNet.SignAssembly) - { - yield return new XElement("SignAssembly", - new XAttribute("Condition", @"Exists('$(AssemblyOriginatorKeyFile)')"), - assembly.Targets.DotNet.SignAssembly - ); - } - - if (assembly.Targets.DotNet.AssemblyOriginatorKeyFile != null) - { - yield return new XElement("AssemblyOriginatorKeyFile", assembly.Targets.DotNet.AssemblyOriginatorKeyFile); - } - - if (assembly.Targets.DotNet.IconUrl != null) - { - 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/AssemblyGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/AssemblyGenerator.cs deleted file mode 100644 index 78a0f6a38e..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/AssemblyGenerator.cs +++ /dev/null @@ -1,362 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Xml; -using System.Xml.Linq; -using Amazon.JSII.Generator.Class; -using Amazon.JSII.Generator.Enum; -using Amazon.JSII.Generator.Interface; -using Amazon.JSII.JsonModel.FileSystem; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Newtonsoft.Json; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; -using Type = Amazon.JSII.JsonModel.Spec.Type; -using TypeKind = Amazon.JSII.JsonModel.Spec.TypeKind; - -namespace Amazon.JSII.Generator -{ - public class AssemblyGenerator - { - readonly string _outputRoot; - readonly IFileSystem _fileSystem; - - public AssemblyGenerator( - string outputRoot, - IFileSystem fileSystem = null - ) - { - _outputRoot = outputRoot ?? throw new ArgumentNullException(nameof(outputRoot)); - _fileSystem = fileSystem ?? new FileSystem(); - } - - public void Generate(string jsiiFile, string tarballPath, ISymbolMap symbols = null) - { - jsiiFile = jsiiFile ?? throw new ArgumentNullException(nameof(jsiiFile)); - symbols = symbols ?? new SymbolMap(); - - string assemblyJson = _fileSystem.File.ReadAllText(jsiiFile); - Assembly assembly = JsonConvert.DeserializeObject(assemblyJson); - symbols.Add(assembly); - - LoadDependencies(assembly, Path.GetDirectoryName(jsiiFile)); - - string packageOutputRoot = Path.Combine(_outputRoot, assembly.GetNativePackageId()); - if (_fileSystem.Directory.Exists(packageOutputRoot)) - { - _fileSystem.Directory.Delete(packageOutputRoot, true); - } - _fileSystem.Directory.CreateDirectory(packageOutputRoot); - - // On Windows, the full destination path including the filename is required. - _fileSystem.File.Copy(tarballPath, Path.Combine(packageOutputRoot, Path.GetFileName(tarballPath))); - _fileSystem.File.Copy(jsiiFile, Path.Combine(packageOutputRoot, Path.GetFileName(jsiiFile))); - - Save(packageOutputRoot, symbols, assembly, new FileInfo(tarballPath).Name, new FileInfo(jsiiFile).Name); - - void LoadDependencies(DependencyRoot dependencyRoot, string packageDirectory) - { - if (dependencyRoot.Dependencies == null) - { - return; - } - - foreach (KeyValuePair entry in dependencyRoot.Dependencies) - { - string depRoot = ResolvePackage(entry.Key, packageDirectory); - string depFile = Path.Combine(depRoot, ".jsii"); - string depJson = _fileSystem.File.ReadAllText(depFile); - Assembly depAssembly = JsonConvert.DeserializeObject(depJson); - symbols.Add(depAssembly); - LoadDependencies(depAssembly, depRoot); - } - - string ResolvePackage(string packageName, string directory) - { - if (string.IsNullOrEmpty(directory)) - { - throw new FileNotFoundException($"Could not resolve package named {packageName}"); - } - string candidate = Path.Combine(directory, "node_modules", packageName); - if (_fileSystem.Directory.Exists(candidate)) - { - return candidate; - } - return ResolvePackage(packageName, Path.GetDirectoryName(directory)); - } - } - } - - void Save(string packageOutputRoot, ISymbolMap symbols, Assembly assembly, string tarballFileName, string jsiiFileName) - { - if (assembly.Docs != null) - { - // TODO: Use Microsoft.Extensions.Logging instead of Console.Error. - Console.Error.WriteLine($"Warning: Ignoring documentation comment on assembly {assembly.Name}. Assembly-level documentation comments are not supported for .NET"); - } - - SaveProjectFile(); - SaveAssemblyInfo(assembly.Name, assembly.Version, tarballFileName); - SaveDependencyAnchorFile(); - - foreach (Type type in assembly.Types?.Values ?? Enumerable.Empty()) - { - SaveType(type); - } - - void SaveProjectFile() - { - XElement project = - new XElement("Project", - new XAttribute("Sdk", "Microsoft.NET.Sdk"), - new XElement("PropertyGroup", assembly.GetMsBuildProperties()), - new XElement("ItemGroup", - new XElement("EmbeddedResource", - new XAttribute("Include", tarballFileName) - ) - ), - new XElement("ItemGroup", - new XElement("PackageReference", - new XAttribute("Include", "Amazon.JSII.Runtime"), - new XAttribute("Version", JsiiVersion.Version) - ), - GetDependencies() - .Distinct() - .Select(d => new { Package = symbols.GetAssemblyName(d.Key), Version = d.Value.GetDecoratedVersion() }) - .Select(d => - new XElement("PackageReference", - new XAttribute("Include", d.Package), - new XAttribute("Version", d.Version) - ) - ) - ) - ); - - if (!_fileSystem.Directory.Exists(packageOutputRoot)) - { - _fileSystem.Directory.CreateDirectory(packageOutputRoot); - } - - // Save to StringBuilder instead of directly to path, so that we can - // redirect the output through the filesystem shim. Project files are - // small, so this shouldn't be a memory hog. - StringBuilder builder = new StringBuilder(); - XmlWriterSettings settings = new XmlWriterSettings - { - // Visual Studio omits the XML declaration when creating project files, so we do too. - OmitXmlDeclaration = true, - // Visual Studio indents project files (they are often edited by hand), so we do too. - Indent = true, - }; - using (XmlWriter writer = XmlWriter.Create(builder, settings)) - { - project.Save(writer); - } - - string csProjPath = Path.Combine(packageOutputRoot, $"{assembly.GetNativePackageId()}.csproj"); - _fileSystem.File.WriteAllText(csProjPath, builder.ToString()); - - IEnumerable> GetDependencies() - { - foreach (KeyValuePair dependency in GetDependenciesCore(assembly)) - { - yield return dependency; - } - - IEnumerable> GetDependenciesCore(DependencyRoot root) - { - if (root.Dependencies == null) - { - yield break; - } - foreach (var kvp in root.Dependencies) - { - yield return kvp; - foreach (KeyValuePair dependency in GetDependenciesCore(kvp.Value)) - { - yield return dependency; - } - } - } - } - } - - void SaveDependencyAnchorFile() - { - string anchorNamespace = $"{assembly.GetNativeNamespace()}.Internal.DependencyResolution"; - var syntaxTree = SF.SyntaxTree( - SF.CompilationUnit( - SF.List(), - SF.List(), - SF.List(), - SF.List(new[] { - SF.NamespaceDeclaration( - SF.IdentifierName(anchorNamespace), - SF.List(), - SF.List(), - SF.List(new MemberDeclarationSyntax[] { GenerateDependencyAnchor() }) - ) - }) - ).NormalizeWhitespace(elasticTrivia: true) - ); - - string directory = GetNamespaceDirectory(packageOutputRoot, @anchorNamespace); - SaveSyntaxTree(directory, "Anchor.cs", syntaxTree); - - ClassDeclarationSyntax GenerateDependencyAnchor() { - return SF.ClassDeclaration( - SF.List(), - SF.TokenList(SF.Token(SyntaxKind.PublicKeyword)), - SF.Identifier("Anchor"), - null, - null, - SF.List(), - SF.List(new MemberDeclarationSyntax[] { - SF.ConstructorDeclaration( - SF.List(), - SF.TokenList(SF.Token(SyntaxKind.PublicKeyword)), - SF.Identifier("Anchor"), - SF.ParameterList(SF.SeparatedList()), - null, - SF.Block(SF.List(GenerateAnchorReferences())), - null - ) - }) - ); - - IEnumerable GenerateAnchorReferences() - { - return assembly.Dependencies?.Keys - .Select(k => assembly.GetNativeNamespace(k)) - .Select(n => $"{n}.Internal.DependencyResolution.Anchor") - .Select(t => SF.ExpressionStatement(SF.ObjectCreationExpression( - SF.Token(SyntaxKind.NewKeyword), - SF.ParseTypeName(t), - SF.ArgumentList(SF.SeparatedList()), - null - ))) ?? Enumerable.Empty(); - } - } - } - - void SaveAssemblyInfo(string name, string version, string tarball) - { - SyntaxTree assemblyInfo = SF.SyntaxTree( - SF.CompilationUnit( - SF.List(), - SF.List(new[] { - SF.UsingDirective(SF.ParseName("Amazon.JSII.Runtime.Deputy")) - }), - SF.List(new[] { - SF.AttributeList( - SF.AttributeTargetSpecifier( - SF.Identifier("assembly"), - SF.Token(SyntaxKind.ColonToken) - ), - SF.SeparatedList(new[] { - SF.Attribute( - SF.ParseName("JsiiAssembly"), - SF.ParseAttributeArgumentList($"({SF.Literal(name)}, {SF.Literal(version)}, {SF.Literal(tarball)})") - ) - }) - ) - }), - SF.List() - ).NormalizeWhitespace(elasticTrivia: true) - ); - - string assemblyInfoPath = Path.Combine(packageOutputRoot, "AssemblyInfo.cs"); - _fileSystem.File.WriteAllText(assemblyInfoPath, assemblyInfo.ToString()); - } - - void SaveType(Type type) - { - string @namespace = symbols.GetNamespace(type); - string directory = GetNamespaceDirectory(packageOutputRoot, @namespace); - - switch (type.Kind) - { - case TypeKind.Class: - { - var classType = (ClassType) type; - - if (classType.IsAbstract) - { - SaveTypeFile($"{symbols.GetAbstractClassProxyName(classType)}.cs", - new AbstractClassProxyGenerator(assembly.Name, classType, symbols).CreateSyntaxTree()); - } - - SaveTypeFile($"{symbols.GetName(type)}.cs", - new ClassGenerator(assembly.Name, classType, symbols).CreateSyntaxTree()); - return; - } - case TypeKind.Enum: - { - SaveTypeFile($"{symbols.GetName(type)}.cs", - new EnumGenerator(assembly.Name, (EnumType) type, symbols).CreateSyntaxTree()); - return; - } - case TypeKind.Interface: - { - InterfaceType interfaceType = (InterfaceType) type; - - SaveTypeFile($"{symbols.GetName(interfaceType)}.cs", - new InterfaceGenerator(assembly.Name, interfaceType, symbols).CreateSyntaxTree()); - SaveTypeFile($"{symbols.GetInterfaceProxyName(interfaceType)}.cs", - new InterfaceProxyGenerator(assembly.Name, interfaceType, symbols).CreateSyntaxTree()); - - if (interfaceType.IsDataType) - { - SaveTypeFile($"{symbols.GetInterfaceDefaultName(interfaceType)}.cs", - new InterfaceDefaultGenerator(assembly.Name, interfaceType, symbols) - .CreateSyntaxTree()); - } - - return; - } - default: - { - throw new ArgumentException($"Unkown type kind: {type.Kind}", nameof(type)); - } - } - - void SaveTypeFile(string filename, SyntaxTree syntaxTree) - { - SaveSyntaxTree(directory, filename, syntaxTree); - } - } - - void SaveSyntaxTree(string directory, string filename, SyntaxTree syntaxTree) - { - if (!_fileSystem.Directory.Exists(directory)) - { - _fileSystem.Directory.CreateDirectory(directory); - } - - _fileSystem.File.WriteAllText( - Path.Combine(directory, filename), - syntaxTree.ToString() - ); - } - } - - string GetNamespaceDirectory(string packageOutputRoot, string @namespace) - { - string packageName = Path.GetFileName(packageOutputRoot); - - // packageOutputRoot is typically a directory like My.Root.Namespace/ - // We don't want to create redundant directories, i.e. - // My.Root.Namespace/My/Root/Namespace/Sub/Namespace. We just - // want My.Root.Namespace/Sub/Namespace. - if (@namespace.StartsWith(packageName)) { - @namespace = @namespace.Substring(packageName.Length).TrimStart('.'); - } - - return Path.Combine(packageOutputRoot, Path.Combine(@namespace.Split('.'))); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/CallableExtensions.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/CallableExtensions.cs deleted file mode 100644 index 31a1ad4aa5..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/CallableExtensions.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Newtonsoft.Json; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator -{ - public static class CallableExtensions - { - public static ParameterListSyntax GetParameterListSyntax(this Callable callable, INamespaceSet namespaces, ISymbolMap symbols) - { - callable = callable ?? throw new ArgumentNullException(nameof(callable)); - namespaces = namespaces ?? throw new ArgumentNullException(nameof(namespaces)); - symbols = symbols ?? throw new ArgumentNullException(nameof(symbols)); - - return SF.ParameterList(SF.SeparatedList(GetParameters())); - - IEnumerable GetParameters() - { - if (callable.Parameters == null) - { - yield break; - } - - foreach (Parameter parameter in callable.Parameters) - { - namespaces.Add(parameter.Type); - - yield return SF.Parameter( - SF.List(), - SF.TokenList(), - symbols.GetTypeSyntax(parameter.Type, parameter.IsOptional), - symbols.GetNameSyntaxToken(parameter), - null - ); - } - } - } - - private static readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings - { - DefaultValueHandling = DefaultValueHandling.Ignore - }; - - public static SyntaxToken GetParametersJsonSyntaxToken(this Callable callable) - { - // Strip docs before serializing. - Parameter[] parameters = (callable?.Parameters ?? Enumerable.Empty()) - .Select(p => new Parameter(name: p.Name, type: p.Type, isOptional: p.IsOptional, isVariadic: p.IsVariadic)) - .ToArray(); - - return SF.Literal(JsonConvert.SerializeObject(parameters, SerializerSettings)); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/AbstractClassProxyGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/AbstractClassProxyGenerator.cs deleted file mode 100644 index 9215d6bce9..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/AbstractClassProxyGenerator.cs +++ /dev/null @@ -1,174 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; -using Type = Amazon.JSII.JsonModel.Spec.Type; - -namespace Amazon.JSII.Generator.Class -{ - public class AbstractClassProxyGenerator : TypeProxyGeneratorBase - { - public AbstractClassProxyGenerator(string package, ClassType type, ISymbolMap symbols, - INamespaceSet namespaces = null) - : base(package, type, symbols, namespaces) - { - if (!type.IsAbstract) - { - throw new ArgumentException("Class type must be abstract.", nameof(type)); - } - } - - protected override SyntaxToken GetProxyTypeNameSyntax() - { - return SF.Identifier(Symbols.GetAbstractClassProxyName(Type)); - } - - protected override IEnumerable CreateProperties() - { - foreach (Property property in GetAllProperties(Type)) - { - var generator = new AbstractClassProxyPropertyGenerator(Type, property, Symbols, Namespaces); - yield return generator.CreateProperty(); - } - } - - protected override IEnumerable CreateMethods() - { - foreach (Method method in GetAllMethods(Type)) - { - var generator = new AbstractClassProxyMethodGenerator(Type, method, Symbols, Namespaces); - yield return generator.CreateMethod(); - } - } - - private IEnumerable GetAllMethods(Type type) - { - IEnumerable GetAllMethodsRecurse(Type currentType, IEnumerable methods) - { - if (currentType is InterfaceType interfaceType) - { - // Get all properties from the interface. - methods = methods.Concat(interfaceType.Methods ?? Enumerable.Empty()); - - // Interfaces can have superinterfaces. Run through them too. - if (interfaceType.Interfaces != null) - { - var superinterfaceMethods = interfaceType.Interfaces.Select(r => - Symbols.GetTypeFromFullyQualifiedName(r) as - InterfaceType) - .SelectMany(i => GetAllMethodsRecurse(i, methods)) - .ToList(); - - methods = methods.Concat(superinterfaceMethods); - } - } - else if (currentType is ClassType classType) - { - // Get all methods from the interface - methods = methods.Concat(classType.Methods ?? Enumerable.Empty()); - - if (classType.Interfaces != null) - { - // Run through all the interfaces. - var superinterfaceMethods = classType.Interfaces.Select(r => - Symbols.GetTypeFromFullyQualifiedName(r) as - InterfaceType) - .SelectMany(i => GetAllMethodsRecurse(i, methods)) - .ToList(); - - methods = methods.Concat(superinterfaceMethods); - } - - // Run through the superclass. - if (classType.Base != null) - { - methods = methods.Concat(GetAllMethodsRecurse( - Symbols.GetTypeFromFullyQualifiedName(classType.Base) as ClassType, - methods)); - } - } - - return methods; - } - - /* - Only get the first declaration encountered, and keep it if it is abstract. The list contains ALL - methods and properties encountered, in the order encountered. An abstract class can have concrete - implementations. Therefore, we only generate methods/properties if the first member encountered - is unimplemented. - */ - return GetAllMethodsRecurse(type, Enumerable.Empty()) - .GroupBy(m => (m.Name, - string.Join("", - m.Parameters?.Select(p => p.Name + p.Type.FullyQualifiedName) ?? Enumerable.Empty()))) - .Select(g => g.First()) - .Where(m => m.IsAbstract); - } - - private IEnumerable GetAllProperties(Type type) - { - IEnumerable GetAllPropertiesRecurse(Type currentType, IEnumerable properties) - { - if (currentType is InterfaceType interfaceType) - { - // Get all properties from the interface. - properties = properties.Concat(interfaceType.Properties ?? Enumerable.Empty()); - - // Interfaces can have superinterfaces. Run through them too. - if (interfaceType.Interfaces != null) - { - var superinterfaceMethods = interfaceType.Interfaces.Select(r => - Symbols.GetTypeFromFullyQualifiedName(r) as - InterfaceType) - .SelectMany(i => GetAllPropertiesRecurse(i, properties)) - .ToList(); - - properties = properties.Concat(superinterfaceMethods); - } - } - else if (currentType is ClassType classType) - { - // Add the properties from the class. - properties = - properties.Concat(classType.Properties ?? Enumerable.Empty()); - - // Run through all the interfaces. - if (classType.Interfaces != null) - { - var superinterfaceMethods = classType.Interfaces.Select(r => - Symbols.GetTypeFromFullyQualifiedName(r) as - InterfaceType) - .SelectMany(i => GetAllPropertiesRecurse(i, properties)) - .ToList(); - - properties = properties.Concat(superinterfaceMethods); - } - - // Run through the superclass. - if (classType.Base != null) - { - properties = properties.Concat(GetAllPropertiesRecurse( - Symbols.GetTypeFromFullyQualifiedName(classType.Base) as ClassType, - properties)); - } - } - - return properties; - } - - /* - Only get the first declaration encountered, and keep it if it is abstract. The list contains ALL - methods and properties encountered, in the order encountered. An abstract class can have concrete - implementations. Therefore, we only generate methods/properties if the first member encountered - is unimplemented. - */ - return GetAllPropertiesRecurse(type, Enumerable.Empty()) - .GroupBy(p => p.Name) - .Select(g => g.First()) - .Where(p => p.IsAbstract); - } - } -} \ No newline at end of file diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/AbstractClassProxyMethodGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/AbstractClassProxyMethodGenerator.cs deleted file mode 100644 index 68c9e870c0..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/AbstractClassProxyMethodGenerator.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.Class -{ - public class AbstractClassProxyMethodGenerator : ClassMethodGenerator - { - public AbstractClassProxyMethodGenerator(ClassType type, Method method, ISymbolMap symbols, - INamespaceSet namespaces) : base(type, method, symbols, namespaces) - { - } - - protected override IEnumerable GetModifierKeywords() - { - yield return Method.IsProtected ? SyntaxKind.ProtectedKeyword : SyntaxKind.PublicKeyword; - - // Type is the abstract class, so we need to check it as well as ancestors. - if (IsDefinedOnAncestor || Type.Methods.Any(m => m.Name == Method.Name)) - { - yield return SyntaxKind.OverrideKeyword; - } - } - - protected override BlockSyntax GetBody() - { - if (Method.Returns == null) - { - return SF.Block(SF.ExpressionStatement(CreateInvocationExpression())); - } - - return SF.Block(SF.ReturnStatement(CreateInvocationExpression())); - } - - protected override bool HasSemicolon => false; - } -} \ No newline at end of file diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/AbstractClassProxyPropertyGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/AbstractClassProxyPropertyGenerator.cs deleted file mode 100644 index 14bce9a677..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/AbstractClassProxyPropertyGenerator.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis.CSharp; - -namespace Amazon.JSII.Generator.Class -{ - public class AbstractClassProxyPropertyGenerator : ClassPropertyGenerator - { - public AbstractClassProxyPropertyGenerator(ClassType type, Property property, ISymbolMap symbols, - INamespaceSet namespaces) : base(type, property, symbols, namespaces) - { - } - - protected override IEnumerable GetModifierKeywords() - { - yield return Property.IsProtected ? SyntaxKind.ProtectedKeyword : SyntaxKind.PublicKeyword; - - // Type is the abstract class, so we need to check it as well as ancestors. - if (IsDefinedOnAncestor || Type.Properties.Any(p => p.Name == Property.Name)) - { - yield return SyntaxKind.OverrideKeyword; - } - } - } -} \ No newline at end of file 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 deleted file mode 100644 index 9fec604b4b..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/ClassGenerator.cs +++ /dev/null @@ -1,255 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Amazon.JSII.Generator.DocComment; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.Class -{ - public class ClassGenerator : TypeGeneratorBase - { - public ClassGenerator(string package, ClassType type, ISymbolMap symbols, INamespaceSet namespaces = null) - : base(package, type, symbols, namespaces) - { - } - - protected override MemberDeclarationSyntax CreateType() - { - return SF.ClassDeclaration - ( - CreateAttributes(), - CreateModifiers(), - Symbols.GetNameSyntaxToken(Type), - null, - CreateBaseList(), - SF.List(), - SF.List(CreateMembers()) - ); - - SyntaxList CreateAttributes() - { - TypeOfExpressionSyntax typeOfExpression = SF.TypeOfExpression(Symbols.GetNameSyntax(Type)); - SyntaxToken fullyQualifiedNameLiteral = SF.Literal(Type.FullyQualifiedName); - - var argumentList = $"nativeType: {typeOfExpression}, fullyQualifiedName: {fullyQualifiedNameLiteral}"; - if ((Type.Initializer?.Parameters?.Length ?? 0) > 0) - { - SyntaxToken parametersJsonLiteral = Type.Initializer.GetParametersJsonSyntaxToken(); - argumentList += $", parametersJson: {parametersJsonLiteral}"; - } - - return SF.List(GetAttributeLists()); - - IEnumerable GetAttributeLists() - { - yield return SF.AttributeList(SF.SeparatedList(new[] { - SF.Attribute( - SF.ParseName("JsiiClass"), - SF.ParseAttributeArgumentList($"({argumentList})") - ) - })); - - if (Type.Docs?.Stability == Stability.Deprecated) - { - var argument = Type.Docs?.Deprecated != null ? SF.Literal(Type.Docs?.Deprecated).ToString() : ""; - yield return SF.AttributeList(SF.SeparatedList(new[] { - SF.Attribute( - SF.ParseName("System.Obsolete"), - SF.ParseAttributeArgumentList($"({argument})") - ) - })); - } - } - } - - SyntaxTokenList CreateModifiers() - { - SyntaxTokenList modifierList = SF.TokenList(SF.Token(SyntaxKind.PublicKeyword)); - - if (Type.IsAbstract) - { - modifierList = modifierList.Add(SF.Token(SyntaxKind.AbstractKeyword)); - } - - return modifierList; - } - - BaseListSyntax CreateBaseList() - { - return SF.BaseList(SF.SeparatedList(GetBaseTypes())); - - IEnumerable GetBaseTypes() - { - if (Type.Base == null) - { - yield return SF.SimpleBaseType(SF.ParseTypeName("DeputyBase")); - } - else - { - yield return SF.SimpleBaseType(Symbols.GetNameSyntax(Type.Base, qualified: true)); - } - - if (Type.Interfaces == null) - { - yield break; - } - - foreach (var interfaceReference in Type.Interfaces) - { - yield return SF.SimpleBaseType(Symbols.GetNameSyntax(interfaceReference, qualified: true)); - } - } - } - - IEnumerable CreateMembers() - { - return CreateConstructors() - .Concat(CreateProperties()) - .Concat(CreateMethods()); - } - } - - 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 - ( - attributes, - SF.TokenList(SF.Token( - Type.IsAbstract || Type.Initializer.IsProtected - ? SyntaxKind.ProtectedKeyword - : SyntaxKind.PublicKeyword - )), - typeName, - Type.Initializer.GetParameterListSyntax(Namespaces, Symbols), - SF.ConstructorInitializer - ( - SyntaxKind.BaseConstructorInitializer, - SF.ArgumentList( - SF.SeparatedList(new[] - { - SF.Argument( - SF.ObjectCreationExpression( - SF.Token(SyntaxKind.NewKeyword), - SF.ParseTypeName("DeputyProps"), - SF.ArgumentList(SF.SeparatedList( - new[] {GetBaseArgument()} - )), - null - ) - ) - }) - ) - ), - SF.Block(), - null - ).WithLeadingTrivia(docComment); - } - - yield return SF.ConstructorDeclaration - ( - attributes, - SF.TokenList(SF.Token(SyntaxKind.ProtectedKeyword)), - typeName, - SF.ParseParameterList("(ByRefValue reference)"), - SF.ConstructorInitializer - ( - SyntaxKind.BaseConstructorInitializer, - SF.ParseArgumentList("(reference)") - ), - SF.Block(), - null - ); - - // This constructor allows child classes to supply their own parameter lists. It is always protected. - yield return SF.ConstructorDeclaration - ( - attributes, - SF.TokenList(SF.Token(SyntaxKind.ProtectedKeyword)), - typeName, - SF.ParseParameterList("(DeputyProps props)"), - SF.ConstructorInitializer - ( - SyntaxKind.BaseConstructorInitializer, - SF.ParseArgumentList("(props)") - ), - SF.Block(), - null - ); - - ArgumentSyntax GetBaseArgument() - { - var deputyArguments = (Type.Initializer.Parameters ?? Enumerable.Empty()) - .Select(p => Symbols.GetNameSyntaxToken(p)) - .Select(i => SF.IdentifierName(i)); - - // In C#, arrays of reference types are covariant. Because of this, passing a string[] - // to a method that takes `params object[] args` will interperet the string array *as* - // args, rather than as args' first element. To workaround with, we remove the params - // keyword from DeputyBase's constructor, and always explicitly create an array of - // objects when calling it. - return SF.Argument( - SF.ArrayCreationExpression( - SF.Token(SyntaxKind.NewKeyword), - SF.ArrayType(SF.ParseTypeName("object[]")), - SF.InitializerExpression( - SyntaxKind.ArrayInitializerExpression, - SF.SeparatedList(deputyArguments) - ) - ) - ); - } - - SyntaxList GetAttributeLists() - { - if (Type.Initializer?.Docs?.Stability != Stability.Deprecated) - { - return SF.List(); - } - var argument = Type.Initializer?.Docs?.Deprecated != null ? SF.Literal(Type.Initializer?.Docs?.Deprecated).ToString() : ""; - return SF.List(new[] { SF.AttributeList(SF.SingletonSeparatedList( - SF.Attribute( - SF.ParseName("System.Obsolete"), - SF.ParseAttributeArgumentList($"({argument})") - ) - )) }); - } - } - - IEnumerable CreateProperties() - { - if (Type.Properties == null) - { - yield break; - } - - foreach (Property property in Type.Properties) - { - ClassPropertyGenerator generator = new ClassPropertyGenerator(Type, property, Symbols, Namespaces); - yield return generator.CreateProperty(); - } - } - - IEnumerable CreateMethods() - { - if (Type.Methods == null) - { - yield break; - } - - foreach (Method method in Type.Methods) - { - ClassMethodGenerator generator = new ClassMethodGenerator(Type, method, Symbols, Namespaces); - yield return generator.CreateMethod(); - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/ClassMethodGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/ClassMethodGenerator.cs deleted file mode 100644 index 6d58e6a339..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/ClassMethodGenerator.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.Class -{ - public class ClassMethodGenerator : MethodGeneratorBase - { - public ClassMethodGenerator(ClassType type, Method method, ISymbolMap symbols, INamespaceSet namespaces) - : base(type, method, symbols, namespaces) - { - } - - protected bool IsDefinedOnAncestor - { - get - { - string[] objectMethods = - { - "ToString", - "GetHashCode", - "Equals" - }; - - if (objectMethods.Contains(NameUtils.ConvertMethodName(Method.Name))) - { - return true; - } - - return Type.AnyAncestor(Symbols, t => t.Methods?.Any(m => m.Name == Method.Name) ?? false); - } - } - - protected override IEnumerable GetModifierKeywords() - { - yield return Method.IsProtected ? SyntaxKind.ProtectedKeyword : SyntaxKind.PublicKeyword; - - if (Method.IsStatic) - { - yield return SyntaxKind.StaticKeyword; - yield break; - } - - if (Method.IsAbstract) - { - if (IsDefinedOnAncestor) - { - yield return SyntaxKind.OverrideKeyword; - } - - yield return SyntaxKind.AbstractKeyword; - } - else - { - // All Jsii methods are implicitly virtual. - yield return IsDefinedOnAncestor ? SyntaxKind.OverrideKeyword : SyntaxKind.VirtualKeyword; - } - } - - protected override BlockSyntax GetBody() - { - if (Method.IsAbstract) - { - return null; - } - - if (Method.Returns == null) - { - return SF.Block(SF.ExpressionStatement(CreateInvocationExpression())); - } - - return SF.Block(SF.ReturnStatement(CreateInvocationExpression())); - } - - protected override bool HasSemicolon => Method.IsAbstract; - } -} \ No newline at end of file diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/ClassPropertyGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/ClassPropertyGenerator.cs deleted file mode 100644 index e19c7eee78..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Class/ClassPropertyGenerator.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.Class -{ - public class ClassPropertyGenerator : PropertyGeneratorBase - { - public ClassPropertyGenerator(ClassType type, Property property, ISymbolMap symbols, INamespaceSet namespaces) - : base(type, property, symbols, namespaces) - { - } - - protected bool IsDefinedOnAncestor => Type.AnyAncestor(Symbols, t => t.Properties?.Any(p => p.Name == Property.Name) ?? false); - - protected override IEnumerable GetModifierKeywords() - { - yield return Property.IsProtected ? SyntaxKind.ProtectedKeyword : SyntaxKind.PublicKeyword; - - if (Property.IsStatic()) - { - yield return SyntaxKind.StaticKeyword; - yield break; - } - - yield return IsDefinedOnAncestor ? SyntaxKind.OverrideKeyword : SyntaxKind.VirtualKeyword; - } - - protected override SyntaxToken GetIdentifier() - { - return Symbols.GetNameSyntaxToken(Type, Property); - } - - protected override IEnumerable GetAccessors() - { - if (Property.IsConstant) - { - yield return SF.AccessorDeclaration( - SyntaxKind.GetAccessorDeclaration, - SF.List(), - SF.TokenList(), - SF.Token(SyntaxKind.GetKeyword), - null, - null, - SF.Token(SyntaxKind.SemicolonToken) - ); - } - else - { - yield return SF.AccessorDeclaration( - SyntaxKind.GetAccessorDeclaration, - SF.List(), - SF.TokenList(), - SF.ParseToken("get"), - null, - SF.ArrowExpressionClause - ( - SF.ParseToken("=>"), - CreateGetPropertyInvocationExpression() - ), - SF.ParseToken(";") - ); - } - - if (!Property.IsImmutable()) - { - yield return SF.AccessorDeclaration( - SyntaxKind.SetAccessorDeclaration, - SF.List(), - SF.TokenList(), - SF.ParseToken("set"), - null, - SF.ArrowExpressionClause - ( - SF.ParseToken("=>"), - CreateSetPropertyInvocationExpression() - ), - SF.ParseToken(";") - ); - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DelegateComparer.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DelegateComparer.cs deleted file mode 100644 index 011ea03c3a..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DelegateComparer.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Amazon.JSII.Generator -{ - public class DelegateComparer : IEqualityComparer - { - readonly Func _comparatorSelector; - - public DelegateComparer(Func comparatorSelector) - { - _comparatorSelector = comparatorSelector ?? throw new ArgumentNullException(nameof(comparatorSelector)); - } - - public bool Equals(T x, T y) - { - return EqualityComparer.Default.Equals(_comparatorSelector(x), _comparatorSelector(y)); - } - - public int GetHashCode(T obj) - { - return _comparatorSelector(obj).GetHashCode(); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DependencyRootExtensions.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DependencyRootExtensions.cs deleted file mode 100644 index 19149c549c..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DependencyRootExtensions.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Amazon.JSII.Generator -{ - public static class DependencyRootExtensions - { - internal static string GetNativeProperty( - this DependencyRoot root, - string currentPackageName, - string targetPackageName, - Func selector - ) - { - root = root ?? throw new ArgumentNullException(nameof(root)); - selector = selector ?? throw new ArgumentNullException(nameof(selector)); - currentPackageName = currentPackageName ?? throw new ArgumentNullException(nameof(currentPackageName)); - targetPackageName = targetPackageName ?? throw new ArgumentNullException(nameof(targetPackageName)); - - if (currentPackageName == targetPackageName) - { - return selector(root); - } - - return (root.Dependencies ?? Enumerable.Empty>()) - .Select(kvp => GetNativeProperty(kvp.Value, kvp.Key, targetPackageName, selector)) - .FirstOrDefault(p => p != null); - } - } -} 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 deleted file mode 100644 index 398a768fc2..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/DocCommentGeneratorBase.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using System; -using System.Collections.Generic; -using System.Linq; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.DocComment -{ - public abstract class DocCommentGeneratorBase - where T : class, IDocumentable - { - static readonly ISet _wellKnownKeys = new HashSet(new[] - { - "param", - }); - - public DocCommentGeneratorBase(T documentable) - { - Documentable = documentable ?? throw new ArgumentNullException(nameof(documentable)); - } - - protected T Documentable { get; } - - public SyntaxTrivia CreateDocComment() - { - return SF.Trivia( - SF.DocumentationCommentTrivia(SyntaxKind.SingleLineDocumentationCommentTrivia) - .AddContent(GetNodes().ToArray()) - ); - } - - protected abstract IEnumerable GetNodes(); - - protected IEnumerable GetSummaryNodes() - { - if (!String.IsNullOrEmpty(Documentable.Docs?.Summary)) - { - yield return SF.XmlText(" ").WithLeadingTrivia(SF.DocumentationCommentExterior(" ")); - yield return SF.XmlSummaryElement(GetXmlNodes(Documentable.Docs.Summary).ToArray()); - } - } - - protected IEnumerable GetRemarksNodes() - { - if (Documentable.Docs == null) - { - yield break; - } - - 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 (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 - if (Documentable.Docs.Subclassable.GetValueOrDefault(false)) { remarks.Add($"subclassable"); } - - remarks.AddRange(Documentable.Docs.Custom - .Where(kvp => !_wellKnownKeys.Contains(kvp.Key)) - .Select(kvp => kvp.Key == "link" - ? $"{kvp.Key}: {kvp.Value} " // Extra space for '@link' to keep unit tests happy - : $"{kvp.Key}: {kvp.Value}" - )); - - if (remarks.Any()) - { - yield return SF.XmlText(" ").WithLeadingTrivia(SF.DocumentationCommentExterior(" ")); - yield return SF.XmlRemarksElement(GetXmlNodes(string.Join(Environment.NewLine, remarks)).ToArray()); - } - } - - protected IEnumerable GetReturnsNodes() - { - var text = Documentable.Docs?.Returns; - - if (!String.IsNullOrEmpty(text)) { - yield return SF.XmlText(" ").WithLeadingTrivia(SF.DocumentationCommentExterior(" ")); - yield return SF.XmlReturnsElement(GetXmlNodes(text).ToArray()); - } - } - - protected IEnumerable GetXmlNodes(string text) - { - string[] tokens = text.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None); - - if (tokens.Length == 1) - { - yield return SF.XmlText($"{tokens[0]}"); - yield break; - } - - foreach (XmlNodeSyntax node in tokens.Select(t => - SF.XmlText($" {t}").WithLeadingTrivia(SF.DocumentationCommentExterior(" ")) - )) - { - yield return node; - } - - yield return SF.XmlNewLine(Environment.NewLine); - yield return SF.XmlText(" "); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/EnumMemberDocCommentGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/EnumMemberDocCommentGenerator.cs deleted file mode 100644 index c26aa04ce9..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/EnumMemberDocCommentGenerator.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using System; -using System.Collections.Generic; -using System.Linq; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.DocComment -{ - public class EnumMemberDocCommentGenerator : DocCommentGeneratorBase - { - public EnumMemberDocCommentGenerator(EnumMember documentable) : base(documentable) - { - } - - protected override IEnumerable GetNodes() - { - IEnumerable nodes = GetSummaryNodes().Concat(GetRemarksNodes()); - - if (nodes.Any()) - { - // Due to a bug in SyntaxNodeExtensions.NormalizeWhitespace, whitespace trivia - // following a documentation comment is removed. So we manually add the newline - // and indentation as XmlText rather than as trivia. - nodes = nodes.Concat(new XmlNodeSyntax[] { SF.XmlText($"{Environment.NewLine} ") }); - } - - return nodes; - } - } -} 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 deleted file mode 100644 index 62b728aa3a..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/MethodDocCommentGenerator.cs +++ /dev/null @@ -1,64 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using System; -using System.Collections.Generic; -using System.Linq; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.DocComment -{ - public class MethodDocCommentGenerator : DocCommentGeneratorBase - { - readonly ISymbolMap _symbols; - - public MethodDocCommentGenerator(Callable documentable, ISymbolMap symbols) : base(documentable) - { - _symbols = symbols ?? throw new ArgumentNullException(nameof(symbols)); - } - - protected override IEnumerable GetNodes() - { - IEnumerable nodes = GetSummaryNodes() - .Concat(GetParamsNodes()) - .Concat(GetReturnsNodes()) - .Concat(GetRemarksNodes()); - - if (nodes.Any()) - { - // Due to a bug in SyntaxNodeExtensions.NormalizeWhitespace, whitespace trivia - // following a documentation comment is removed. So we manually add the newline - // and indentation as XmlText rather than as trivia. - nodes = nodes.Concat(new XmlNodeSyntax[] { SF.XmlText($"{Environment.NewLine} ") }); - } - - return nodes; - } - - IEnumerable GetParamsNodes() - { - if (Documentable.Parameters == null) - { - yield break; - } - - foreach (Parameter parameter in Documentable.Parameters.Where(p => p.Docs != null)) - { - string text = string.Join(Environment.NewLine, GetParamTextLines(parameter)); - if (!string.IsNullOrEmpty(text)) - { - yield return SF.XmlText(" ").WithLeadingTrivia(SF.DocumentationCommentExterior(" ")); - yield return SF.XmlParamElement(_symbols.GetName(parameter), GetXmlNodes(text).ToArray()); - } - } - - IEnumerable GetParamTextLines(Parameter parameter) - { - if (!String.IsNullOrEmpty(parameter.Docs.Summary)) - { - yield return parameter.Docs.Summary; - } - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/PropertyDocCommentGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/PropertyDocCommentGenerator.cs deleted file mode 100644 index 4ec23cc789..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/PropertyDocCommentGenerator.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using System; -using System.Collections.Generic; -using System.Linq; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.DocComment -{ - public class PropertyDocCommentGenerator : DocCommentGeneratorBase - { - public PropertyDocCommentGenerator(Property documentable) : base(documentable) - { - } - - protected override IEnumerable GetNodes() - { - IEnumerable nodes = GetSummaryNodes() - .Concat(GetReturnsNodes()) - .Concat(GetRemarksNodes()); - - if (nodes.Any()) - { - // Due to a bug in SyntaxNodeExtensions.NormalizeWhitespace, whitespace trivia - // following a documentation comment is removed. So we manually add the newline - // and indentation as XmlText rather than as trivia. - nodes = nodes.Concat(new XmlNodeSyntax[] { SF.XmlText($"{Environment.NewLine} ") }); - } - - return nodes; - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/TypeDocCommentGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/TypeDocCommentGenerator.cs deleted file mode 100644 index 4a11cff045..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/DocComment/TypeDocCommentGenerator.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.CodeAnalysis.CSharp.Syntax; -using System; -using System.Collections.Generic; -using System.Linq; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; -using Type = Amazon.JSII.JsonModel.Spec.Type; - -namespace Amazon.JSII.Generator.DocComment -{ - public class TypeDocCommentGenerator : DocCommentGeneratorBase - { - public TypeDocCommentGenerator(Type documentable) : base(documentable) - { - } - - protected override IEnumerable GetNodes() - { - IEnumerable nodes = GetSummaryNodes() - .Concat(GetRemarksNodes()); - - if (nodes.Any()) - { - // Due to a bug in SyntaxNodeExtensions.NormalizeWhitespace, whitespace trivia - // following a documentation comment is removed. So we manually add the newline - // and indentation as XmlText rather than as trivia. - nodes = nodes.Concat(new XmlNodeSyntax[] { SF.XmlText($"{Environment.NewLine} ") }); - } - - return nodes; - } - } -} 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 deleted file mode 100644 index dc20b938c7..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Enum/EnumGenerator.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Amazon.JSII.Generator.DocComment; -using Amazon.JSII.JsonModel.Spec; -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; - -namespace Amazon.JSII.Generator.Enum -{ - public class EnumGenerator : TypeGeneratorBase - { - public EnumGenerator(string package, EnumType type, ISymbolMap symbols, INamespaceSet namespaces = null) - : base(package, type, symbols, namespaces) - { - } - - protected override MemberDeclarationSyntax CreateType() - { - return SF.EnumDeclaration - ( - CreateAttributes(), - SF.TokenList(SF.Token(SyntaxKind.PublicKeyword)), - Symbols.GetNameSyntaxToken(Type), - null, - CreateValues() - ); - } - - SyntaxList CreateAttributes() - { - TypeOfExpressionSyntax typeOfExpression = SF.TypeOfExpression(Symbols.GetNameSyntax(Type)); - SyntaxToken fullyQualifiedNameLiteral = SF.Literal(Type.FullyQualifiedName); - - 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?.Stability == Stability.Deprecated) - { - var argument = Type.Docs?.Deprecated != null ? SF.Literal(Type.Docs?.Deprecated).ToString() : ""; - yield return SF.AttributeList(SF.SeparatedList(new[] { - SF.Attribute( - SF.ParseName("System.Obsolete"), - SF.ParseAttributeArgumentList($"({argument})") - ) - })); - } - } - } - - SeparatedSyntaxList CreateValues() - { - return SF.SeparatedList(Type.Members.Select(GetMemberDeclaration)); - - EnumMemberDeclarationSyntax GetMemberDeclaration(EnumMember member) - { - EnumMemberDeclarationSyntax declaration = SF.EnumMemberDeclaration - ( - SF.List(GetAttributeLists()), - Symbols.GetNameSyntaxToken(Type, member), - null - ); - - if (member.Docs != null) - { - DocCommentGeneratorBase generator = new EnumMemberDocCommentGenerator(member); - SyntaxTriviaList trivia = SF.TriviaList(generator.CreateDocComment()); - - declaration = declaration.WithLeadingTrivia(trivia); - } - - 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) - { - var argument = member.Docs?.Deprecated != null ? SF.Literal(member.Docs?.Deprecated).ToString() : ""; - yield return SF.AttributeList(SF.SingletonSeparatedList( - SF.Attribute( - SF.ParseName("System.Obsolete"), - SF.ParseAttributeArgumentList($"({argument})") - ) - )); - } - } - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/INamespaceSet.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/INamespaceSet.cs deleted file mode 100644 index fec1362b9b..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/INamespaceSet.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Type = Amazon.JSII.JsonModel.Spec.Type; - -namespace Amazon.JSII.Generator -{ - public interface INamespaceSet - { - SyntaxList GetUsings(); - - void Add(TypeReference typeReference); - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/ISymbolMap.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/ISymbolMap.cs deleted file mode 100644 index 76767fb817..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/ISymbolMap.cs +++ /dev/null @@ -1,98 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; - -namespace Amazon.JSII.Generator -{ - public interface ISymbolMap - { - void Add(Assembly assembly); - - string GetAssemblyName(string name); - - string GetName(Assembly assembly); - - string GetName(Type type, bool qualified = false); - - string GetName(string fullyQualifiedName, bool qualified = false); - - string GetAbstractClassProxyName(ClassType type, bool qualified = false); - - string GetInterfaceProxyName(InterfaceType type, bool qualified = false); - - string GetInterfaceDefaultName(InterfaceType type, bool qualified = false); - - string GetName(Type type, Method method); - - string GetName(Type type, Property property); - - string GetName(Type type, EnumMember enumMember); - - string GetName(Parameter parameter); - - string GetNamespace(Type type); - - string GetNamespace(string fullyQualifiedName); - - string GetPackage(Type type); - - string GetPackage(string fullyQualifiedName); - - SyntaxToken GetNameSyntaxToken(Assembly assembly); - - SyntaxToken GetNameSyntaxToken(Type type, bool qualified = false); - - SyntaxToken GetNameSyntaxToken(string fullyQualifiedName, bool qualified = false); - - SyntaxToken GetInterfaceProxyNameSyntaxToken(InterfaceType type, bool qualified = false); - - SyntaxToken GetInterfaceDefaultNameSyntaxToken(InterfaceType type, bool qualified = false); - - SyntaxToken GetNameSyntaxToken(Type type, Method method); - - SyntaxToken GetNameSyntaxToken(Type type, Property property); - - SyntaxToken GetNameSyntaxToken(Type type, EnumMember enumMember); - - SyntaxToken GetNameSyntaxToken(Parameter parameter); - - SyntaxToken GetNamespaceSyntaxToken(Type type); - - SyntaxToken GetNamespaceSyntaxToken(string fullyQualifiedName); - - SyntaxToken GetPackageSyntaxToken(Type type); - - SyntaxToken GetPackageSyntaxToken(string fullyQualifiedName); - - NameSyntax GetNameSyntax(Assembly assembly); - - NameSyntax GetNameSyntax(Type type, bool qualified = false); - - NameSyntax GetNameSyntax(string fullyQualifiedName, bool qualified = false); - - NameSyntax GetInterfaceProxyNameSyntax(InterfaceType type, bool qualified = false); - - NameSyntax GetInterfaceDefaultNameSyntax(InterfaceType type, bool qualified = false); - - NameSyntax GetNameSyntax(Type type, Method method); - - NameSyntax GetNameSyntax(Type type, Property property); - - NameSyntax GetNameSyntax(Type type, EnumMember enumMember); - - NameSyntax GetNameSyntax(Parameter parameter); - - NameSyntax GetNamespaceSyntax(Type type); - - NameSyntax GetNamespaceSyntax(string fullyQualifiedName); - - NameSyntax GetPackageSyntax(Type type); - - NameSyntax GetPackageSyntax(string fullyQualifiedName); - - TypeSyntax GetTypeSyntax(TypeReference typeReference, bool isOptional); - - Type GetTypeFromFullyQualifiedName(string fullyQualifiedName); - - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceDefaultGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceDefaultGenerator.cs deleted file mode 100644 index 0b9a8c68bd..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceDefaultGenerator.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using System.Collections.Generic; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.Interface -{ - public class InterfaceDefaultGenerator : TypeGeneratorBase - { - public InterfaceDefaultGenerator(string package, InterfaceType type, ISymbolMap symbols, INamespaceSet namespaces = null) - : base(package, type, symbols, namespaces) - { - } - - protected override MemberDeclarationSyntax CreateType() - { - return SF.ClassDeclaration - ( - SF.List(new [] { - SF.AttributeList(SF.SeparatedList(new [] { - SF.Attribute(SF.ParseName("JsiiByValue")) - })) - }), - SF.TokenList(SF.Token(SyntaxKind.PublicKeyword)), - Symbols.GetInterfaceDefaultNameSyntaxToken(Type), - null, - SF.BaseList(SF.SeparatedList(CreateBaseTypes())), - SF.List(), - SF.List(CreateMembers()) - ); - - IEnumerable CreateBaseTypes() - { - yield return SF.SimpleBaseType(Symbols.GetNameSyntax(Type, qualified: true)); - } - - IEnumerable CreateMembers() - { - return CreateProperties(); - } - } - - IEnumerable CreateProperties() - { - foreach (Property property in Type.GetAllProperties(Symbols)) - { - InterfaceDefaultPropertyGenerator generator = new InterfaceDefaultPropertyGenerator(Type, property, Symbols, Namespaces); - yield return generator.CreateProperty(); - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceDefaultPropertyGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceDefaultPropertyGenerator.cs deleted file mode 100644 index 3015012fbb..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceDefaultPropertyGenerator.cs +++ /dev/null @@ -1,68 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using System; -using System.Collections.Generic; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.Interface -{ - public class InterfaceDefaultPropertyGenerator : PropertyGeneratorBase - { - public InterfaceDefaultPropertyGenerator(InterfaceType type, Property property, ISymbolMap symbols, INamespaceSet namespaces) - : base(type, property, symbols, namespaces) - { - if (!property.IsAbstract) - { - throw new ArgumentException("Interface properties must be abstract", nameof(property)); - } - - if (property.IsProtected) - { - throw new ArgumentException("Protected properties are not allowed on interfaces", nameof(property)); - } - - if (property.IsStatic()) - { - throw new ArgumentException( - $"Property {type.Name}.{property.Name} is marked as static, but interfaces must not contain static members.", - nameof(property) - ); - } - } - - protected override IEnumerable GetModifierKeywords() - { - yield return Property.IsProtected? SyntaxKind.ProtectedKeyword : SyntaxKind.PublicKeyword; - } - - protected override SyntaxToken GetIdentifier() - { - return Symbols.GetNameSyntaxToken(Type, Property); - } - - protected override bool IsOverride => true; - - protected override IEnumerable GetAccessors() - { - yield return SF.AccessorDeclaration( - SyntaxKind.GetAccessorDeclaration, - SF.List(), - SF.TokenList(), - SF.ParseToken("get"), - (BlockSyntax)null, - SF.ParseToken(";") - ); - - yield return SF.AccessorDeclaration( - SyntaxKind.SetAccessorDeclaration, - SF.List(), - SF.TokenList(), - SF.ParseToken("set"), - (BlockSyntax)null, - SF.ParseToken(";") - ); - } - } -} 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 deleted file mode 100644 index 76cb73033e..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceGenerator.cs +++ /dev/null @@ -1,115 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using System; -using System.Collections.Generic; -using System.Linq; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.Interface -{ - public class InterfaceGenerator : TypeGeneratorBase - { - public InterfaceGenerator(string package, InterfaceType type, ISymbolMap symbols, INamespaceSet namespaces = null) - : base(package, type, symbols, namespaces) - { - } - - protected override MemberDeclarationSyntax CreateType() - { - return SF.InterfaceDeclaration - ( - CreateAttributes(), - SF.TokenList(SF.Token(SyntaxKind.PublicKeyword)), - Symbols.GetNameSyntaxToken(Type), - null, - CreateBaseList(), - SF.List(), - SF.List(CreateMembers()) - ); - - SyntaxList CreateAttributes() - { - TypeOfExpressionSyntax typeOfExpression = SF.TypeOfExpression(Symbols.GetNameSyntax(Type)); - SyntaxToken fullyQualifiedNameLiteral = SF.Literal(Type.FullyQualifiedName); - - 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?.Stability == Stability.Deprecated) - { - var argument = Type.Docs?.Deprecated != null ? SF.Literal(Type.Docs?.Deprecated).ToString() : ""; - yield return SF.AttributeList(SF.SeparatedList(new[] { - SF.Attribute( - SF.ParseName("System.Obsolete"), - SF.ParseAttributeArgumentList($"({argument})") - ) - })); - } - } - } - - BaseListSyntax CreateBaseList() - { - IEnumerable baseTypes = GetBaseTypes(); - - return baseTypes?.Any() ?? false ? SF.BaseList(SF.SeparatedList(baseTypes)) : null; - - IEnumerable GetBaseTypes() - { - foreach (string interfaceReference in Type.Interfaces ?? Enumerable.Empty()) - { - yield return SF.SimpleBaseType(Symbols.GetNameSyntax(interfaceReference, qualified: true)); - } - } - } - - IEnumerable CreateMembers() - { - return CreateProperties().Concat(CreateMethods()); - } - } - - IEnumerable CreateMethods() - { - if (Type.Methods == null) - { - yield break; - } - - foreach (Method method in Type.Methods) - { - if (method.IsAsync) - { - throw new NotImplementedException(); - } - - InterfaceMethodGenerator generator = new InterfaceMethodGenerator(Type, method, Symbols, Namespaces); - yield return generator.CreateMethod(); - } - } - - IEnumerable CreateProperties() - { - if (Type.Properties == null) - { - yield break; - } - - foreach (Property property in Type.Properties) - { - InterfacePropertyGenerator generator = new InterfacePropertyGenerator(Type, property, Symbols, Namespaces); - yield return generator.CreateProperty(); - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceMethodGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceMethodGenerator.cs deleted file mode 100644 index 06e469e427..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceMethodGenerator.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using System; -using System.Collections.Generic; - -namespace Amazon.JSII.Generator.Interface -{ - public class InterfaceMethodGenerator : MethodGeneratorBase - { - public InterfaceMethodGenerator(InterfaceType type, Method method, ISymbolMap symbols, INamespaceSet namespaces) - : base(type, method, symbols, namespaces) - { - if (!method.IsAbstract) - { - throw new ArgumentException("Interface methods must be abstract", nameof(method)); - } - - if (method.IsProtected) - { - throw new ArgumentException("Protected methods are not allowed on interfaces", nameof(method)); - } - - if (method.IsStatic) - { - throw new ArgumentException( - $"Method {type.Name}.{method.Name} is marked as static, but interfaces must not contain static members.", - nameof(method) - ); - } - } - - protected override IEnumerable GetModifierKeywords() - { - yield break; - } - - protected override BlockSyntax GetBody() - { - return null; - } - - protected override bool HasSemicolon => true; - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfacePropertyGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfacePropertyGenerator.cs deleted file mode 100644 index cbe91ff7a3..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfacePropertyGenerator.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using System; -using System.Collections.Generic; -using System.Linq; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.Interface -{ - public class InterfacePropertyGenerator : PropertyGeneratorBase - { - public InterfacePropertyGenerator(InterfaceType type, Property property, ISymbolMap symbols, INamespaceSet namespaces) - : base(type, property, symbols, namespaces) - { - if (!property.IsAbstract) - { - throw new ArgumentException("Interface properties must be abstract", nameof(property)); - } - - if (property.IsProtected) - { - throw new ArgumentException("Protected properties are not allowed on interfaces", nameof(property)); - } - - if (property.IsStatic()) - { - throw new ArgumentException( - $"Property {type.Name}.{property.Name} is marked as static, but interfaces must not contain static members.", - nameof(property) - ); - } - } - - protected override IEnumerable GetModifierKeywords() - { - yield break; - } - - protected override SyntaxToken GetIdentifier() - { - return Symbols.GetNameSyntaxToken(Type, Property); - } - - protected override IEnumerable GetAccessors() - { - yield return SF.AccessorDeclaration( - SyntaxKind.GetAccessorDeclaration, - SF.List(), - SF.TokenList(), - SF.ParseToken("get"), - (BlockSyntax)null, - SF.ParseToken(";") - ); - - if (!Property.IsImmutable()) - { - yield return SF.AccessorDeclaration( - SyntaxKind.SetAccessorDeclaration, - SF.List(), - SF.TokenList(), - SF.ParseToken("set"), - (BlockSyntax)null, - SF.ParseToken(";") - ); - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceProxyGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceProxyGenerator.cs deleted file mode 100644 index d4b806f0cf..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceProxyGenerator.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Collections.Generic; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.Interface -{ - public class InterfaceProxyGenerator : TypeProxyGeneratorBase - { - public InterfaceProxyGenerator(string package, InterfaceType type, ISymbolMap symbols, INamespaceSet namespaces = null) - : base(package, type, symbols, namespaces) - { - } - - protected override SyntaxToken GetProxyTypeNameSyntax() - { - return SF.Identifier(Symbols.GetInterfaceProxyName(Type)); - } - - protected override IEnumerable CreateProperties() - { - foreach (Property property in Type.GetAllProperties(Symbols)) - { - InterfaceProxyPropertyGenerator generator = new InterfaceProxyPropertyGenerator(Type, property, Symbols, Namespaces); - yield return generator.CreateProperty(); - } - } - - protected override IEnumerable CreateMethods() - { - foreach (Method method in Type.GetAllMethods(Symbols)) - { - InterfaceProxyMethodGenerator generator = new InterfaceProxyMethodGenerator(Type, method, Symbols, Namespaces); - yield return generator.CreateMethod(); - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceProxyMethodGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceProxyMethodGenerator.cs deleted file mode 100644 index db1368fb23..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceProxyMethodGenerator.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.Interface -{ - public class InterfaceProxyMethodGenerator : MethodGeneratorBase - { - public InterfaceProxyMethodGenerator(InterfaceType type, Method method, ISymbolMap symbols, INamespaceSet namespaces) - : base(type, method, symbols, namespaces) - { - if (!method.IsAbstract) - { - throw new ArgumentException("Interface methods must be abstract", nameof(method)); - } - - if (method.IsProtected) - { - throw new ArgumentException("Protected methods are not allowed on interfaces", nameof(method)); - } - - if (method.IsStatic) - { - throw new ArgumentException( - $"Method {type.Name}.{method.Name} is marked as static, but interfaces must not contain static members.", - nameof(method) - ); - } - } - - protected override IEnumerable GetModifierKeywords() - { - yield return SyntaxKind.PublicKeyword; - } - - protected override BlockSyntax GetBody() - { - if (Method.Returns == null) - { - return SF.Block(SF.ExpressionStatement(CreateInvocationExpression())); - } - - return SF.Block(SF.ReturnStatement(CreateInvocationExpression())); - } - - protected override bool HasSemicolon => false; - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceProxyPropertyGenerator.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceProxyPropertyGenerator.cs deleted file mode 100644 index 5af04d2e94..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceProxyPropertyGenerator.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Collections.Generic; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator.Interface -{ - public class InterfaceProxyPropertyGenerator : PropertyGeneratorBase - { - public InterfaceProxyPropertyGenerator(InterfaceType type, Property property, ISymbolMap symbols, INamespaceSet namespaces) - : base(type, property, symbols, namespaces) - { - if (!property.IsAbstract) - { - throw new ArgumentException("Interface properties must be abstract", nameof(property)); - } - - if (property.IsProtected) - { - throw new ArgumentException("Protected properties are not allowed on interfaces", nameof(property)); - } - - if (property.IsStatic()) - { - throw new ArgumentException( - $"Property {type.Name}.{property.Name} is marked as static, but interfaces must not contain static members.", - nameof(property) - ); - } - } - - protected override IEnumerable GetModifierKeywords() - { - yield return SyntaxKind.PublicKeyword; - } - - protected override SyntaxToken GetIdentifier() - { - return Symbols.GetNameSyntaxToken(Type, Property); - } - - protected override IEnumerable GetAccessors() - { - yield return SF.AccessorDeclaration( - SyntaxKind.GetAccessorDeclaration, - SF.List(), - SF.TokenList(), - SF.ParseToken("get"), - null, - SF.ArrowExpressionClause - ( - SF.ParseToken("=>"), - CreateGetPropertyInvocationExpression() - ), - SF.ParseToken(";") - ); - - if (!Property.IsImmutable()) - { - yield return SF.AccessorDeclaration( - SyntaxKind.SetAccessorDeclaration, - SF.List(), - SF.TokenList(), - SF.ParseToken("set"), - null, - SF.ArrowExpressionClause - ( - SF.ParseToken("=>"), - CreateSetPropertyInvocationExpression() - ), - SF.ParseToken(";") - ); - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceTypeExtensions.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceTypeExtensions.cs deleted file mode 100644 index 3a3c78d5b2..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/Interface/InterfaceTypeExtensions.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Amazon.JSII.Generator.Interface -{ - internal static class InterfaceTypeExtensions - { - public static IEnumerable GetAllProperties(this InterfaceType @interface, ISymbolMap symbols) - { - @interface = @interface ?? throw new ArgumentNullException(nameof(@interface)); - symbols = symbols ?? throw new ArgumentNullException(nameof(symbols)); - - return GetAllCore(@interface, symbols, i => i.Properties); - } - - public static IEnumerable GetAllMethods(this InterfaceType @interface, ISymbolMap symbols) - { - @interface = @interface ?? throw new ArgumentNullException(nameof(@interface)); - symbols = symbols ?? throw new ArgumentNullException(nameof(symbols)); - - return GetAllCore(@interface, symbols, i => i.Methods); - } - - static IEnumerable GetAllCore(this InterfaceType @interface, ISymbolMap symbols, Func> selector) - { - foreach (T member in selector(@interface) ?? Enumerable.Empty()) - { - yield return member; - } - - if (@interface.Interfaces != null) - { - var baseMembers = @interface.Interfaces - .Select(r => symbols.GetTypeFromFullyQualifiedName(r) as InterfaceType) - .SelectMany(i => GetAllCore(i, symbols, selector)); - - foreach (T member in baseMembers) - { - yield return member; - } - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/MethodGeneratorBase.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/MethodGeneratorBase.cs deleted file mode 100644 index 4987d30ab8..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/MethodGeneratorBase.cs +++ /dev/null @@ -1,257 +0,0 @@ -using Amazon.JSII.Generator.DocComment; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator -{ - public abstract class MethodGeneratorBase - where T : JsonModel.Spec.Type - { - protected MethodGeneratorBase(T type, Method method, ISymbolMap symbols, INamespaceSet namespaces) - { - Type = type ?? throw new ArgumentNullException(nameof(type)); - Method = method ?? throw new ArgumentNullException(nameof(method)); - Symbols = symbols ?? throw new ArgumentNullException(nameof(symbols)); - Namespaces = namespaces ?? throw new ArgumentNullException(nameof(namespaces)); - } - - protected T Type { get; } - - protected Method Method { get; } - - protected ISymbolMap Symbols { get; } - - protected INamespaceSet Namespaces { get; } - - public MethodDeclarationSyntax CreateMethod() - { - MethodDeclarationSyntax declaration = SF.MethodDeclaration( - GetAttributeLists(), - GetModifierList(), - GetReturnType(), - GetExplicitInterfaceSpecifier(), - GetIdentifier(), - GetTypeParameterList(), - Method.GetParameterListSyntax(Namespaces, Symbols), - GetConstraintClauseList(), - GetBody(), - GetExpressionBody(), - GetSemicolonToken() - ); - - MethodDocCommentGenerator generator = new MethodDocCommentGenerator(Method, Symbols); - SyntaxTriviaList trivia = SF.TriviaList(generator.CreateDocComment()); - - declaration = declaration.WithLeadingTrivia(trivia); - - return declaration; - } - - protected abstract IEnumerable GetModifierKeywords(); - - - protected abstract BlockSyntax GetBody(); - - protected abstract bool HasSemicolon { get; } - - protected SyntaxToken GetIdentifier() - { - return Symbols.GetNameSyntaxToken(Type, Method); - } - - protected InvocationExpressionSyntax CreateInvocationExpression() - { - return SF.InvocationExpression( - CreateInvokeMethodIdentifier(), - GetArgumentListSyntax() - ); - - SimpleNameSyntax CreateInvokeMethodIdentifier() - { - string invokeMethodName = GetInvokeMethodName(); - - if (Method.Returns == null) - { - return SF.IdentifierName(invokeMethodName); - } - - return SF.GenericName( - SF.Identifier(invokeMethodName), - CreateTypeArgumentList() - ); - - TypeArgumentListSyntax CreateTypeArgumentList() - { - if (Method.Returns == null) - { - return null; - } - - return SF.TypeArgumentList( - SF.Token(SyntaxKind.LessThanToken), - SF.SeparatedList(new[] { GetReturnType() }), - SF.Token(SyntaxKind.GreaterThanToken) - ); - } - - string GetInvokeMethodName() - { - StringBuilder builder = new StringBuilder("Invoke"); - builder.Append(Method.IsStatic ? "Static" : "Instance"); - if (Method.Returns == null) - { - builder.Append("Void"); - } - builder.Append("Method"); - - return builder.ToString(); - } - } - } - - ArgumentListSyntax GetArgumentListSyntax() - { - var arguments = GetArgumentExpressions().Select(e => SF.Argument(e)); - return SF.ArgumentList(SF.SeparatedList(arguments)); - - IEnumerable GetArgumentExpressions() - { - if (Method.IsStatic) - { - yield return SF.TypeOfExpression(Symbols.GetNameSyntax(Type)); - } - - yield return CreateArgumentsArray(); - } - - ArrayCreationExpressionSyntax CreateArgumentsArray() - { - return SF.ArrayCreationExpression( - SF.Token(SyntaxKind.NewKeyword), - SF.ArrayType(SF.ParseTypeName("object[]")), - SF.InitializerExpression( - SyntaxKind.ArrayInitializerExpression, - SF.Token(SyntaxKind.OpenBraceToken), - SF.SeparatedList(GetArguments()), - SF.Token(SyntaxKind.CloseBraceToken) - ) - ); - - IEnumerable GetArguments() - { - if (Method.Parameters == null) - { - yield break; - } - - foreach (Parameter parameter in Method.Parameters) - { - yield return Symbols.GetNameSyntax(parameter); - } - } - } - } - - private static readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings - { - DefaultValueHandling = DefaultValueHandling.Ignore - }; - - SyntaxList GetAttributeLists() - { - return SF.List(GetAttributeLists()); - - IEnumerable GetAttributeLists() - { - SyntaxToken nameLiteral = SF.Literal(Method.Name); - SyntaxToken trueLiteral = SF.Token(SyntaxKind.TrueKeyword); - - string argumentList = $"name: {nameLiteral}"; - if (Method.Returns != null) - { - SyntaxToken returnsJsonLiteral = Method.Returns == null ? - SF.Token(SyntaxKind.NullKeyword) : - SF.Literal(JsonConvert.SerializeObject(Method.Returns, SerializerSettings)); - argumentList += $", returnsJson: {returnsJsonLiteral}"; - } - - if (Method.Parameters != null && Method.Parameters.Length > 0) - { - SyntaxToken parametersJsonLiteral = Method.GetParametersJsonSyntaxToken(); - argumentList += $", parametersJson: {parametersJsonLiteral}"; - } - if (Method.IsAsync) - { - argumentList += $", isAsync: {trueLiteral}"; - } - if (Method.Overrides != null) - { - argumentList += $", isOverride: {trueLiteral}"; - } - - yield return SF.AttributeList(SF.SingletonSeparatedList(SF.Attribute( - SF.ParseName("JsiiMethod"), - SF.ParseAttributeArgumentList($"({argumentList})") - ))); - - if (Method.Docs?.Stability == Stability.Deprecated) - { - var argument = Method.Docs?.Deprecated != null ? SF.Literal(Method.Docs?.Deprecated).ToString() : ""; - yield return SF.AttributeList(SF.SingletonSeparatedList(SF.Attribute( - SF.ParseName("System.Obsolete"), - SF.ParseAttributeArgumentList($"({argument})") - ))); - } - } - } - - SyntaxTokenList GetModifierList() - { - return SF.TokenList(GetModifierKeywords().Select(k => SF.Token(k))); - } - - ExplicitInterfaceSpecifierSyntax GetExplicitInterfaceSpecifier() - { - return null; - } - - TypeSyntax GetReturnType() - { - if (Method.Returns == null) - { - return SF.ParseTypeName("void"); - } - - Namespaces.Add(Method.Returns.Type); - return Symbols.GetTypeSyntax(Method.Returns.Type, Method.Returns.IsOptional); - } - - TypeParameterListSyntax GetTypeParameterList() - { - return null; - } - - SyntaxList GetConstraintClauseList() - { - return SF.List< TypeParameterConstraintClauseSyntax>(); - } - - ArrowExpressionClauseSyntax GetExpressionBody() - { - return null; - } - - SyntaxToken GetSemicolonToken() - { - return SF.Token(HasSemicolon ? SyntaxKind.SemicolonToken : SyntaxKind.None); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/NameUtils.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/NameUtils.cs deleted file mode 100644 index 20f862ed4d..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/NameUtils.cs +++ /dev/null @@ -1,96 +0,0 @@ -using Microsoft.CodeAnalysis.CSharp; -using System; -using System.Linq; - -namespace Amazon.JSII.Generator -{ - public static class NameUtils - { - public static string ConvertPackageName(string original) - { - original = original ?? throw new ArgumentNullException(nameof(original)); - - if (string.IsNullOrWhiteSpace(original) || original.Contains('$')) - { - throw new ArgumentException($"Invalid package name '{original}'", nameof(original)); - } - - return string.Join(".", original.Split('-').Select(CapitalizeWord)); - } - - public static string ConvertTypeName(string original) - { - original = original ?? throw new ArgumentNullException(nameof(original)); - - if (string.IsNullOrWhiteSpace(original) || original.Contains('$')) - { - throw new ArgumentException($"Invalid type name '{original}'", nameof(original)); - } - - return CapitalizeWord(original); - } - - public static string ConvertPropertyName(string original) - { - original = original ?? throw new ArgumentNullException(nameof(original)); - - if (string.IsNullOrWhiteSpace(original) || original.Contains('$')) - { - throw new ArgumentException($"Invalid property name '{original}'", nameof(original)); - } - - return CapitalizeWord(original); - } - - public static string ConvertMethodName(string original) - { - original = original ?? throw new ArgumentNullException(nameof(original)); - - if (string.IsNullOrWhiteSpace(original) || original.Contains('$')) - { - throw new ArgumentException($"Invalid method name '{original}'", nameof(original)); - } - - return CapitalizeWord(original); - } - - public static string ConvertEnumMemberName(string original) - { - original = original ?? throw new ArgumentNullException(nameof(original)); - - if (string.IsNullOrWhiteSpace(original) || original.Contains('$')) - { - throw new ArgumentException($"Invalid enum member name '{original}'", nameof(original)); - } - - return CapitalizeWord(original); - } - - public static string ConvertParameterName(string original) - { - original = original ?? throw new ArgumentNullException(nameof(original)); - - if (string.IsNullOrWhiteSpace(original) || original.Contains('$')) - { - throw new ArgumentException($"Invalid parameter name '{original}'", nameof(original)); - } - - return EscapeKeyword(original); - } - - static string CapitalizeWord(string word) - { - return word.Substring(0, 1).ToUpperInvariant() + word.Substring(1); - } - - static string EscapeKeyword(string text) - { - if (SyntaxFacts.GetKeywordKind(text) != SyntaxKind.None) - { - return "@" + text; - } - - return text; - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/NamespaceSet.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/NamespaceSet.cs deleted file mode 100644 index b5da8c1afa..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/NamespaceSet.cs +++ /dev/null @@ -1,82 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using System; -using System.Collections.Generic; -using System.Linq; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; -using Type = Amazon.JSII.JsonModel.Spec.Type; - -namespace Amazon.JSII.Generator -{ - public class NamespaceSet : INamespaceSet - { - readonly ISet _referencedNamespaces; - readonly ISymbolMap _symbols; - readonly NameSyntax _currentNamespace; - - public NamespaceSet(ISymbolMap symbols, NameSyntax currentNamespace) - { - _symbols = symbols ?? throw new ArgumentNullException(nameof(symbols)); - _currentNamespace = currentNamespace ?? throw new ArgumentNullException(nameof(currentNamespace)); - - _referencedNamespaces = new HashSet - ( - new[] { SF.ParseName("Amazon.JSII.Runtime.Deputy") }, - new DelegateComparer(nameSyntax => nameSyntax.ToString()) - ); - } - - public SyntaxList GetUsings() - { - // Don't add a redundant using for the current namespace. - _referencedNamespaces.Remove(_currentNamespace); - - IEnumerable usings = _referencedNamespaces - .Select(n => SF.UsingDirective(n)) - .OrderBy(u => u.Name.ToString().ToUpperInvariant()); - - return SF.List(usings); - } - - public void Add(TypeReference typeReference) - { - if (typeReference.FullyQualifiedName != null) - { - // Not generating "using" statements for stuff from dependencies - we won't use those. - return; - } - - switch (typeReference.Primitive) - { - case PrimitiveType.Date: - _referencedNamespaces.Add(SF.ParseName("System")); - return; - case PrimitiveType.Json: - _referencedNamespaces.Add(SF.ParseName("Newtonsoft.Json.Linq")); - return; - } - - if (typeReference.Collection != null) - { - switch (typeReference.Collection.Kind) - { - case CollectionKind.Map: - _referencedNamespaces.Add(SF.ParseName("System.Collections.Generic")); - break; - } - - Add(typeReference.Collection.ElementType); - return; - } - - if (typeReference.Union != null) - { - foreach (var partialTypeReference in typeReference.Union.Types) - { - Add(partialTypeReference); - } - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/PropertyExtensions.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/PropertyExtensions.cs deleted file mode 100644 index c0981e019a..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/PropertyExtensions.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using System; -using System.Collections.Generic; -using System.Text; - -namespace Amazon.JSII.Generator -{ - internal static class PropertyExtensions - { - public static bool IsStatic(this Property property) - { - return property.IsStatic || property.IsConstant; - } - - public static bool IsImmutable(this Property property) - { - return property.IsImmutable || property.IsConstant; - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/PropertyGeneratorBase.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/PropertyGeneratorBase.cs deleted file mode 100644 index 8bc8ae40c8..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/PropertyGeneratorBase.cs +++ /dev/null @@ -1,215 +0,0 @@ -using Amazon.JSII.Generator.DocComment; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator -{ - public abstract class PropertyGeneratorBase - where T : JsonModel.Spec.Type - { - protected PropertyGeneratorBase(T type, Property property, ISymbolMap symbols, INamespaceSet namespaces) - { - Type = type ?? throw new ArgumentNullException(nameof(type)); - Property = property ?? throw new ArgumentNullException(nameof(property)); - Symbols = symbols ?? throw new ArgumentNullException(nameof(symbols)); - Namespaces = namespaces ?? throw new ArgumentNullException(nameof(namespaces)); - } - - protected T Type { get; } - - protected Property Property { get; } - - protected ISymbolMap Symbols { get; } - - protected INamespaceSet Namespaces { get; } - - public PropertyDeclarationSyntax CreateProperty() - { - PropertyDeclarationSyntax declaration = Property.IsConstant ? - SF.PropertyDeclaration - ( - GetAttributeLists(), - GetModifierList(), - GetReturnType(), - GetExplicitInterfaceSpecifier(), - GetIdentifier(), - GetAccessorList(), - null, - GetInitializer(), - SF.Token(SyntaxKind.SemicolonToken) - ) : - SF.PropertyDeclaration - ( - GetAttributeLists(), - GetModifierList(), - GetReturnType(), - GetExplicitInterfaceSpecifier(), - GetIdentifier(), - GetAccessorList() - ); - - if (Property.Docs != null) - { - DocCommentGeneratorBase generator = new PropertyDocCommentGenerator(Property); - SyntaxTriviaList trivia = SF.TriviaList(generator.CreateDocComment()); - - declaration = declaration.WithLeadingTrivia(trivia); - } - - return declaration; - } - - protected abstract IEnumerable GetModifierKeywords(); - - protected abstract SyntaxToken GetIdentifier(); - - protected abstract IEnumerable GetAccessors(); - - protected virtual bool IsOverride => false; - - protected InvocationExpressionSyntax CreateGetPropertyInvocationExpression() - { - return SF.InvocationExpression( - CreateGetPropertyMethodIdentifier(), - GetArgumentListSyntax() - ); - - SimpleNameSyntax CreateGetPropertyMethodIdentifier() - { - return SF.GenericName( - SF.Identifier(Property.IsStatic() ? - "GetStaticProperty" : - "GetInstanceProperty" - ), - SF.TypeArgumentList( - SF.Token(SyntaxKind.LessThanToken), - SF.SeparatedList(new[] { GetReturnType() }), - SF.Token(SyntaxKind.GreaterThanToken) - ) - ); - } - - ArgumentListSyntax GetArgumentListSyntax() - { - var arguments = GetArgumentExpressions().Select(e => SF.Argument(e)); - - return SF.ArgumentList(SF.SeparatedList(arguments)); - - IEnumerable GetArgumentExpressions() - { - if (Property.IsStatic()) - { - yield return SF.TypeOfExpression(Symbols.GetNameSyntax(Type)); - } - } - } - } - - protected InvocationExpressionSyntax CreateSetPropertyInvocationExpression() - { - return SF.InvocationExpression( - CreateGetPropertyMethodIdentifier(), - GetArgumentListSyntax() - ); - - SimpleNameSyntax CreateGetPropertyMethodIdentifier() - { - return SF.IdentifierName(Property.IsStatic() ? - "SetStaticProperty" : - "SetInstanceProperty" - ); - } - - ArgumentListSyntax GetArgumentListSyntax() - { - var arguments = GetArgumentExpressions().Select(e => SF.Argument(e)); - - return SF.ArgumentList(SF.SeparatedList(arguments)); - - IEnumerable GetArgumentExpressions() - { - if (Property.IsStatic()) - { - yield return SF.TypeOfExpression(Symbols.GetNameSyntax(Type)); - } - - yield return SF.IdentifierName("value"); - } - } - } - - SyntaxTokenList GetModifierList() - { - return SF.TokenList(GetModifierKeywords().Select(k => SF.Token(k))); - } - - private static readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings - { - DefaultValueHandling = DefaultValueHandling.Ignore - }; - - SyntaxList GetAttributeLists() - { - return SF.List(GetAttributesLists()); - - IEnumerable GetAttributesLists() - { - SyntaxToken nameLiteral = SF.Literal(Property.Name); - SyntaxToken typeJsonLiteral = SF.Literal(JsonConvert.SerializeObject(Property.Type, SerializerSettings)); - SyntaxToken trueLiteral = SF.Token(SyntaxKind.TrueKeyword); - - string argumentList = $"name: {nameLiteral}, typeJson: {typeJsonLiteral}"; - if (Property.IsOptional) - { - argumentList += $", isOptional: {trueLiteral}"; - } - if (IsOverride) - { - argumentList += $", isOverride: {trueLiteral}"; - } - - yield return SF.AttributeList(SF.SingletonSeparatedList(SF.Attribute( - SF.ParseName("JsiiProperty"), - SF.ParseAttributeArgumentList($"({argumentList})") - ))); - - if (Property.Docs?.Stability == Stability.Deprecated) - { - var argument = Property.Docs?.Deprecated != null ? SF.Literal(Property.Docs?.Deprecated).ToString() : ""; - yield return SF.AttributeList(SF.SingletonSeparatedList(SF.Attribute( - SF.ParseName("System.Obsolete"), - SF.ParseAttributeArgumentList($"({argument})") - ))); - } - } - } - - TypeSyntax GetReturnType() - { - Namespaces.Add(Property.Type); - return Symbols.GetTypeSyntax(Property.Type, Property.IsOptional); - } - - ExplicitInterfaceSpecifierSyntax GetExplicitInterfaceSpecifier() - { - return null; - } - - AccessorListSyntax GetAccessorList() - { - return SF.AccessorList(SF.List(GetAccessors())); - } - - EqualsValueClauseSyntax GetInitializer() - { - return SF.EqualsValueClause(CreateGetPropertyInvocationExpression()); - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/SymbolMap.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/SymbolMap.cs deleted file mode 100644 index 8d8921bd95..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/SymbolMap.cs +++ /dev/null @@ -1,434 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; -using Type = Amazon.JSII.JsonModel.Spec.Type; -using TypeKind = Amazon.JSII.JsonModel.Spec.TypeKind; - -namespace Amazon.JSII.Generator -{ - public class SymbolMap : ISymbolMap - { - readonly IDictionary _assemblyNames; - readonly IDictionary _types; - - public SymbolMap() - { - _assemblyNames = new Dictionary(); - _types = new Dictionary(); - } - - public void Add(Assembly assembly) - { - if (_assemblyNames.ContainsKey((assembly ?? throw new ArgumentNullException(nameof(assembly))).Name)) - { - return; - } - - _assemblyNames[assembly.Name] = assembly.GetNativePackageId(); - - var types = assembly.Types?.Values ?? Enumerable.Empty(); - - foreach (Type type in types) - { - if (!_types.ContainsKey(type.FullyQualifiedName)) - { - _types[type.FullyQualifiedName] = GetMetadata(type); - } - } - - // Now that we have a complete list of namespaces, resolve type name conflicts. - // TODO: Disallow name conflicts at the jsii-authoring level. This requires the - // TypeScript-to-Jsii compiler to be aware of .NET name-conversion logic. - ISet namespaceNames = new HashSet(_types.Values.Select(t => t.Namespace)); - foreach (Type type in types) - { - TypeMetadata metadata = _types[type.FullyQualifiedName]; - metadata.ResolveTypeNameConflicts(namespaceNames); - } - - TypeMetadata GetMetadata(Type type) - { - switch (type.Kind) - { - case TypeKind.Class: - { - var classType = (ClassType) type; - if (classType.IsAbstract) - { - return new AbstractClassTypeMetadata(classType, assembly); - } - return new ClassTypeMetadata((ClassType)type, assembly); - } - case TypeKind.Enum: - { - return new EnumTypeMetadata((EnumType)type, assembly); - } - case TypeKind.Interface: - { - return new InterfaceTypeMetadata((InterfaceType)type, assembly); - } - default: - { - throw new ArgumentException($"Type {type.Name} has unrecognized kind {type.Kind}", nameof(type)); - } - } - } - } - - #region name - - public string GetAssemblyName(string name) - { - name = name ?? throw new ArgumentNullException(nameof(name)); - - return _assemblyNames[name]; - } - - public string GetName(Assembly assembly) - { - assembly = assembly ?? throw new ArgumentNullException(nameof(assembly)); - - return GetAssemblyName(assembly.Name); - } - - public string GetName(Type type, bool qualified = false) - { - type = type ?? throw new ArgumentNullException(nameof(type)); - - TypeMetadata metadata = _types[type.FullyQualifiedName]; - - return qualified ? metadata.FrameworkFullyQualifiedName : metadata.Name; - } - - public string GetName(string fullyQualifiedName, bool qualified = false) - { - return GetName(GetTypeFromFullyQualifiedName(fullyQualifiedName), qualified); - } - - public string GetAbstractClassProxyName(ClassType type, bool qualified = false) - { - type = type ?? throw new ArgumentNullException(nameof(type)); - - if (_types[type.FullyQualifiedName] is AbstractClassTypeMetadata metadata) - { - return metadata.ProxyName; - } - - throw new ArgumentException($"Cannot get proxy name for '{type.FullyQualifiedName}' because it is not an abstract class."); - } - - public string GetInterfaceProxyName(InterfaceType type, bool qualified = false) - { - type = type ?? throw new ArgumentNullException(nameof(type)); - - if (_types[type.FullyQualifiedName] is InterfaceTypeMetadata metadata) - { - return metadata.ProxyName; - } - - throw new ArgumentException($"Cannot get proxy name for '{type.FullyQualifiedName}' because it is not an interface."); - } - - public string GetInterfaceDefaultName(InterfaceType type, bool qualified = false) - { - type = type ?? throw new ArgumentNullException(nameof(type)); - - if (_types[type.FullyQualifiedName] is InterfaceTypeMetadata metadata) - { - return metadata.DefaultName; - } - - throw new ArgumentException($"Cannot get default name for '{type.FullyQualifiedName}' because it is not an interface."); - } - - public string GetName(Type type, Method method) - { - string fullyQualifiedName = (type ?? throw new ArgumentNullException(nameof(type))).FullyQualifiedName; - string methodName = (method ?? throw new ArgumentNullException(nameof(method))).Name; - - // We can't look up the method name in _types, because it might belong to a base type that hasn't been parsed yet. - return NameUtils.ConvertMethodName(method.Name); - } - - public string GetName(Type type, Property property) - { - string fullyQualifiedName = (type ?? throw new ArgumentNullException(nameof(type))).FullyQualifiedName; - string propertyName = (property ?? throw new ArgumentNullException(nameof(property))).Name; - - // We can't look up the property name in _types, because it might belong to a base type that hasn't been parsed yet. - return NameUtils.ConvertPropertyName(propertyName); - } - - public string GetName(Type type, EnumMember enumMember) - { - string fullyQualifiedName = (type ?? throw new ArgumentNullException(nameof(type))).FullyQualifiedName; - string enumMemberName = (enumMember ?? throw new ArgumentNullException(nameof(enumMember))).Name; - - // We can't look up the enum member name in _types, because it might belong to a base type that hasn't been parsed yet. - return NameUtils.ConvertEnumMemberName(enumMemberName); - } - - public string GetName(Parameter parameter) - { - return NameUtils.ConvertParameterName((parameter ?? throw new ArgumentNullException(nameof(parameter))).Name); - } - - public SyntaxToken GetNameSyntaxToken(Assembly assembly) - { - return SF.Identifier(GetName(assembly ?? throw new ArgumentNullException(nameof(assembly)))); - } - - public SyntaxToken GetNameSyntaxToken(Type type, bool qualified = false) - { - return SF.Identifier(GetName(type ?? throw new ArgumentNullException(nameof(type)), qualified)); - } - - public SyntaxToken GetNameSyntaxToken(string fullyQualifiedName, bool qualified = false) - { - return GetNameSyntaxToken(GetTypeFromFullyQualifiedName(fullyQualifiedName), qualified); - } - - public SyntaxToken GetInterfaceProxyNameSyntaxToken(InterfaceType type, bool qualified = false) - { - return SF.Identifier(GetInterfaceProxyName(type ?? throw new ArgumentNullException(nameof(type)), qualified)); - } - - public SyntaxToken GetInterfaceDefaultNameSyntaxToken(InterfaceType type, bool qualified = false) - { - return SF.Identifier(GetInterfaceDefaultName(type ?? throw new ArgumentNullException(nameof(type)), qualified)); - } - - public SyntaxToken GetNameSyntaxToken(Type type, Method method) - { - return SF.Identifier(GetName( - type ?? throw new ArgumentNullException(nameof(type)), - method ?? throw new ArgumentNullException(nameof(method)) - )); - } - - public SyntaxToken GetNameSyntaxToken(Type type, Property property) - { - return SF.Identifier(GetName( - type ?? throw new ArgumentNullException(nameof(type)), - property ?? throw new ArgumentNullException(nameof(property)) - )); - } - - public SyntaxToken GetNameSyntaxToken(Type type, EnumMember enumMember) - { - return SF.Identifier(GetName( - type ?? throw new ArgumentNullException(nameof(type)), - enumMember ?? throw new ArgumentNullException(nameof(enumMember)) - )); - } - - public SyntaxToken GetNameSyntaxToken(Parameter parameter) - { - return SF.Identifier(GetName(parameter ?? throw new ArgumentNullException(nameof(parameter)))); - } - - public NameSyntax GetNameSyntax(Assembly assembly) - { - return SF.IdentifierName(GetName(assembly ?? throw new ArgumentNullException(nameof(assembly)))); - } - - public NameSyntax GetNameSyntax(Type type, bool disambiguate = false) - { - return SF.IdentifierName(GetName(type ?? throw new ArgumentNullException(nameof(type)), disambiguate)); - } - - public NameSyntax GetNameSyntax(string fullyQualifiedName, bool disambiguate = false) - { - return GetNameSyntax(GetTypeFromFullyQualifiedName(fullyQualifiedName), disambiguate); - } - - public NameSyntax GetInterfaceProxyNameSyntax(InterfaceType type, bool disambiguate = false) - { - return SF.IdentifierName(GetInterfaceProxyName(type ?? throw new ArgumentNullException(nameof(type)), disambiguate)); - } - - public NameSyntax GetInterfaceDefaultNameSyntax(InterfaceType type, bool disambiguate = false) - { - return SF.IdentifierName(GetInterfaceDefaultName(type ?? throw new ArgumentNullException(nameof(type)), disambiguate)); - } - - public NameSyntax GetNameSyntax(Type type, Method method) - { - return SF.IdentifierName(GetName( - type ?? throw new ArgumentNullException(nameof(type)), - method ?? throw new ArgumentNullException(nameof(method)) - )); - } - - public NameSyntax GetNameSyntax(Type type, Property property) - { - return SF.IdentifierName(GetName( - type ?? throw new ArgumentNullException(nameof(type)), - property ?? throw new ArgumentNullException(nameof(property)) - )); - } - - public NameSyntax GetNameSyntax(Type type, EnumMember enumMember) - { - return SF.IdentifierName(GetName( - type ?? throw new ArgumentNullException(nameof(type)), - enumMember ?? throw new ArgumentNullException(nameof(enumMember)) - )); - } - - public NameSyntax GetNameSyntax(Parameter parameter) - { - return SF.IdentifierName(GetName(parameter ?? throw new ArgumentNullException(nameof(parameter)))); - } - - #endregion - - #region namespace - - public string GetNamespace(Type type) - { - string fullyQualifiedName = (type ?? throw new ArgumentNullException(nameof(type))).FullyQualifiedName; - - return _types[fullyQualifiedName].Namespace ?? ""; - } - - public string GetNamespace(string fullyQualifiedName) - { - return GetNamespace(GetTypeFromFullyQualifiedName(fullyQualifiedName)); - } - - public SyntaxToken GetNamespaceSyntaxToken(Type type) - { - return SF.Identifier(GetNamespace(type ?? throw new ArgumentNullException(nameof(type)))); - } - - public SyntaxToken GetNamespaceSyntaxToken(string fullyQualifiedName) - { - return GetNamespaceSyntaxToken(GetTypeFromFullyQualifiedName(fullyQualifiedName)); - } - - public NameSyntax GetNamespaceSyntax(Type type) - { - return SF.IdentifierName(GetNamespace(type ?? throw new ArgumentNullException(nameof(type)))); - } - - public NameSyntax GetNamespaceSyntax(string fullyQualifiedName) - { - return GetNamespaceSyntax(GetTypeFromFullyQualifiedName(fullyQualifiedName)); - } - - #endregion - - #region package - - public string GetPackage(Type type) - { - type = type ?? throw new ArgumentNullException(nameof(type)); - - string fullyQualifiedName = type.FullyQualifiedName; - - return _types[fullyQualifiedName].Package; - } - - public string GetPackage(string fullyQualifiedName) - { - return GetPackage(GetTypeFromFullyQualifiedName(fullyQualifiedName)); - } - - public SyntaxToken GetPackageSyntaxToken(Type type) - { - return SF.Identifier(GetPackage(type ?? throw new ArgumentNullException(nameof(type)))); - } - - public SyntaxToken GetPackageSyntaxToken(string fullyQualifiedName) - { - return GetPackageSyntaxToken(GetTypeFromFullyQualifiedName(fullyQualifiedName)); - } - - public NameSyntax GetPackageSyntax(Type type) - { - return SF.IdentifierName(GetPackage(type ?? throw new ArgumentNullException(nameof(type)))); - } - - public NameSyntax GetPackageSyntax(string fullyQualifiedName) - { - return GetPackageSyntax(GetTypeFromFullyQualifiedName(fullyQualifiedName)); - } - - #endregion - - public TypeSyntax GetTypeSyntax(TypeReference typeReference, bool isOptional) - { - typeReference = typeReference ?? throw new ArgumentNullException(nameof(typeReference)); - - if (typeReference.Primitive != null) - { - switch (typeReference.Primitive.Value) - { - case PrimitiveType.Any: - return SF.ParseTypeName("object"); - case PrimitiveType.Boolean: - return NullableIfOptional(SF.ParseTypeName("bool")); - case PrimitiveType.Date: - return NullableIfOptional(SF.ParseTypeName("DateTime")); - case PrimitiveType.Json: - return SF.ParseTypeName("JObject"); - case PrimitiveType.Number: - return NullableIfOptional(SF.ParseTypeName("double")); - case PrimitiveType.String: - return SF.ParseTypeName("string"); - default: - throw new ArgumentException($"Unexpected primitive type {typeReference.Primitive.Value}", nameof(typeReference)); - } - } - - if (typeReference.Collection != null) - { - TypeSyntax elementType = GetTypeSyntax(typeReference.Collection.ElementType, false); - - switch (typeReference.Collection.Kind) - { - case CollectionKind.Array: - return SF.ArrayType( - elementType, - SF.List(new[] { SF.ArrayRankSpecifier() }) - ); - case CollectionKind.Map: - return SF.ParseTypeName($"IDictionary"); - default: - throw new ArgumentException($"Unexpected collection type {typeReference.Collection.Kind}", nameof(typeReference)); - } - } - - if (typeReference.Union != null) - { - return SF.ParseTypeName("object"); - } - - if (typeReference.FullyQualifiedName != null) - { - var type = GetTypeFromFullyQualifiedName(typeReference.FullyQualifiedName); - var typeSyntax = SF.ParseTypeName(GetName(type, true)); - return type.Kind == TypeKind.Enum ? NullableIfOptional(typeSyntax) : typeSyntax; - } - - throw new ArgumentException("Invalid type reference", nameof(typeReference)); - - TypeSyntax NullableIfOptional(TypeSyntax type) - { - return isOptional ? SF.NullableType(type) : type; - } - } - - public Type GetTypeFromFullyQualifiedName(string fullyQualifiedName) - { - fullyQualifiedName = fullyQualifiedName ?? throw new ArgumentNullException(nameof(fullyQualifiedName)); - - return _types[fullyQualifiedName].Type; - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeExtensions.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeExtensions.cs deleted file mode 100644 index 0d16a3395e..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeExtensions.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using System; - -namespace Amazon.JSII.Generator -{ - public static class TypeExtensions - { - public static bool AnyAncestor(this ClassType classType, ISymbolMap symbols, Func predicate) - { - var current = classType.Base; - - while (current != null) - { - ClassType currentType = (ClassType)symbols.GetTypeFromFullyQualifiedName(current); - - if (predicate(currentType)) - { - return true; - } - - current = currentType.Base; - } - - return false; - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeGeneratorBase.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeGeneratorBase.cs deleted file mode 100644 index 9d81aab13c..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeGeneratorBase.cs +++ /dev/null @@ -1,64 +0,0 @@ -using Amazon.JSII.Generator.DocComment; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using System; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; -using Type = Amazon.JSII.JsonModel.Spec.Type; - -namespace Amazon.JSII.Generator -{ - public abstract class TypeGeneratorBase where T : Type - { - protected TypeGeneratorBase(string package, T type, ISymbolMap symbols, INamespaceSet namespaces) - { - Package = package ?? throw new ArgumentNullException(nameof(package)); - - Type = type ?? throw new ArgumentNullException(nameof(type)); - Symbols = symbols ?? throw new ArgumentNullException(nameof(symbols)); - - NameSyntax namespaceSyntax = Symbols.GetNamespaceSyntax(Type); - Namespaces = namespaces ?? new NamespaceSet(Symbols, namespaceSyntax); - } - - protected T Type { get; } - - protected ISymbolMap Symbols { get; } - - protected INamespaceSet Namespaces { get; } - - protected string Package { get; } - - public SyntaxTree CreateSyntaxTree() - { - // The call to CreateType must come before the call to namespaces.GetUsings. - // This is because CreateType builds the list of referenced namespaces. - MemberDeclarationSyntax typeDeclaration = CreateType(); - - if (Type.Docs != null) - { - DocCommentGeneratorBase generator = new TypeDocCommentGenerator(Type); - SyntaxTriviaList trivia = SF.TriviaList(generator.CreateDocComment()); - - typeDeclaration = typeDeclaration.WithLeadingTrivia(trivia); - } - - NamespaceDeclarationSyntax namespaceDeclaration = SF.NamespaceDeclaration( - Symbols.GetNamespaceSyntax(Type), - SF.List(), - SF.List(), - SF.List(new[] { typeDeclaration }) - ); - - return SF.SyntaxTree( - SF.CompilationUnit( - SF.List(), - Namespaces.GetUsings(), - SF.List(), - SF.List(new[] { namespaceDeclaration }) - ).NormalizeWhitespace(elasticTrivia: true) - ); - } - - protected abstract MemberDeclarationSyntax CreateType(); - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeMetadata.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeMetadata.cs deleted file mode 100644 index f6f7af256b..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeMetadata.cs +++ /dev/null @@ -1,162 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using Type = Amazon.JSII.JsonModel.Spec.Type; - -namespace Amazon.JSII.Generator -{ - public abstract class TypeMetadata - { - public TypeMetadata(Type type, Assembly assembly) - { - Type = type ?? throw new ArgumentNullException(nameof(type)); - assembly = assembly ?? throw new ArgumentNullException(nameof(assembly)); - - Package = type.Assembly; - - string suffix = type.Namespace != null ? $".{type.Namespace}" : ""; - Namespace = $"{assembly.GetNativeNamespace(Package)}{suffix}"; - } - - public virtual void ResolveTypeNameConflicts(ISet namespaceNames) - { - ISet memberNames = new HashSet(MemberNames.Values); - - while (memberNames.Contains(Name) || namespaceNames.Contains(FrameworkFullyQualifiedName) || Namespace.EndsWith($".{Name}", StringComparison.InvariantCulture)) - { - Name += "_"; - } - - } - - public Type Type { get; } - - public string Package { get; } - - public string Namespace { get; } - - public string Name { get; protected set; } - - public IReadOnlyDictionary MemberNames { get; protected set; } - - public string FrameworkFullyQualifiedName => $"{Namespace}.{Name}"; - - } - - public class ClassTypeMetadata : TypeMetadata - { - public ClassTypeMetadata(ClassType type, Assembly assembly) - : base(type, assembly) - { - IDictionary memberNames = new Dictionary(); - - foreach (Method method in type.Methods ?? Enumerable.Empty()) - { - memberNames[method.Name] = NameUtils.ConvertMethodName(method.Name); - } - - foreach (Property property in type.Properties ?? Enumerable.Empty()) - { - memberNames[property.Name] = NameUtils.ConvertPropertyName(property.Name); - } - - MemberNames = new ReadOnlyDictionary(memberNames); - Name = NameUtils.ConvertTypeName(type.Name); - } - } - - public class AbstractClassTypeMetadata : ClassTypeMetadata - { - public string ProxyName { get; private set; } - - public string FrameworkFullyQualifiedProxyName => $"{Namespace}.{ProxyName}"; - - public AbstractClassTypeMetadata(ClassType type, Assembly assembly) - : base(type, assembly) - { - ProxyName = $"{Name}Proxy"; - } - - public override void ResolveTypeNameConflicts(ISet namespaceNames) - { - base.ResolveTypeNameConflicts(namespaceNames); - - ISet memberNames = new HashSet(MemberNames.Values); - - while (memberNames.Contains(ProxyName) || namespaceNames.Contains(FrameworkFullyQualifiedProxyName)) - { - ProxyName += "_"; - } - } - } - - public class EnumTypeMetadata : TypeMetadata - { - public EnumTypeMetadata(EnumType type, Assembly assembly) - : base(type, assembly) - { - IDictionary memberNames = new Dictionary(); - - foreach (EnumMember member in type.Members ?? Enumerable.Empty()) - { - memberNames[member.Name] = NameUtils.ConvertEnumMemberName(member.Name); - } - - MemberNames = new ReadOnlyDictionary(memberNames); - Name = NameUtils.ConvertTypeName(type.Name); - } - } - - public class InterfaceTypeMetadata : TypeMetadata - { - public InterfaceTypeMetadata(InterfaceType type, Assembly assembly) - : base(type, assembly) - { - IDictionary memberNames = new Dictionary(); - - foreach (Method method in type.Methods ?? Enumerable.Empty()) - { - memberNames[method.Name] = NameUtils.ConvertMethodName(method.Name); - } - - foreach (Property property in type.Properties ?? Enumerable.Empty()) - { - memberNames[property.Name] = NameUtils.ConvertPropertyName(property.Name); - } - - MemberNames = new ReadOnlyDictionary(memberNames); - - string name = NameUtils.ConvertTypeName(type.Name); - Name = $"I{name}"; - ProxyName = $"{name}Proxy"; - DefaultName = name; - } - - public string ProxyName { get; private set; } - - public string DefaultName { get; private set; } - - public string FrameworkFullyQualifiedProxyName => $"{Namespace}.{ProxyName}"; - - public string FrameworkFullyQualifiedDefaultName => $"{Namespace}.{DefaultName}"; - - public override void ResolveTypeNameConflicts(ISet namespaceNames) - { - base.ResolveTypeNameConflicts(namespaceNames); - - ISet memberNames = new HashSet(MemberNames.Values); - - while (memberNames.Contains(ProxyName) || namespaceNames.Contains(FrameworkFullyQualifiedProxyName)) - { - ProxyName += "_"; - } - - while (memberNames.Contains(DefaultName) || namespaceNames.Contains(FrameworkFullyQualifiedDefaultName)) - { - DefaultName += "_"; - } - } - } -} diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeProxyGeneratorBase.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeProxyGeneratorBase.cs deleted file mode 100644 index 6ea156c3ac..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/TypeProxyGeneratorBase.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Amazon.JSII.JsonModel.Spec; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; - -namespace Amazon.JSII.Generator -{ - public abstract class TypeProxyGeneratorBase : TypeGeneratorBase where T : Type - { - protected TypeProxyGeneratorBase(string package, T type, ISymbolMap symbols, INamespaceSet namespaces) - : base(package, type, symbols, namespaces) - { - } - - protected override MemberDeclarationSyntax CreateType() - { - return SF.ClassDeclaration - ( - CreateAttributes(), - SF.TokenList( - SF.Token(SyntaxKind.InternalKeyword), - SF.Token(SyntaxKind.SealedKeyword)), - GetProxyTypeNameSyntax(), - null, - CreateBaseList(), - SF.List(), - SF.List(CreateMembers()) - ); - - SyntaxList CreateAttributes() - { - var typeOfExpression = SF.TypeOfExpression(Symbols.GetNameSyntax(Type)); - var fullyQualifiedNameLiteral = SF.Literal(Type.FullyQualifiedName); - - return SF.List(GetAttributeLists()); - - IEnumerable GetAttributeLists() - { - yield return SF.AttributeList(SF.SingletonSeparatedList( - SF.Attribute( - SF.ParseName("JsiiTypeProxy"), - SF.ParseAttributeArgumentList($"(nativeType: {typeOfExpression}, fullyQualifiedName: {fullyQualifiedNameLiteral})") - ) - )); - - if (Type.Docs?.Stability == Stability.Deprecated) - { - var argument = Type.Docs?.Deprecated != null ? SF.Literal(Type.Docs?.Deprecated).ToString() : ""; - yield return SF.AttributeList(SF.SingletonSeparatedList( - SF.Attribute( - SF.ParseName("System.Obsolete"), - SF.ParseAttributeArgumentList($"({argument})") - ) - )); - } - } - } - - BaseListSyntax CreateBaseList() - { - return SF.BaseList(SF.SeparatedList(GetBaseTypes())); - - IEnumerable GetBaseTypes() - { - if (Type is InterfaceType) - { - yield return SF.SimpleBaseType(SF.ParseTypeName("DeputyBase")); - } - - yield return SF.SimpleBaseType(Symbols.GetNameSyntax(Type, qualified: true)); - } - } - - IEnumerable CreateMembers() - { - return CreateConstructors() - .Concat(CreateProperties()) - .Concat(CreateMethods()); - } - } - - protected virtual IEnumerable CreateConstructors() - { - yield return SF.ConstructorDeclaration - ( - SF.List(), - - // Only Amazon.JSII.Runtime should create interface proxies, - // so we make the constructor private. - SF.TokenList(SF.Token(SyntaxKind.PrivateKeyword)), - GetProxyTypeNameSyntax(), - SF.ParseParameterList("(ByRefValue reference)"), - SF.ConstructorInitializer - ( - SyntaxKind.BaseConstructorInitializer, - SF.ParseArgumentList("(reference)") - ), - SF.Block(), - null - ); - } - - protected abstract SyntaxToken GetProxyTypeNameSyntax(); - - protected abstract IEnumerable CreateProperties(); - - protected abstract IEnumerable CreateMethods(); - } -} \ No newline at end of file diff --git a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/VersionSuffixExtensions.cs b/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/VersionSuffixExtensions.cs deleted file mode 100644 index b647b5ca2f..0000000000 --- a/packages/jsii-dotnet-generator/src/Amazon.JSII.Generator/VersionSuffixExtensions.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Amazon.JSII.JsonModel.Spec; - -namespace Amazon.JSII.Generator -{ - public static class VersionSuffixExtensions - { - public static string GetDecoratedVersion(this Assembly assembly) - { - return MakeDecoratedVersion(assembly.Version, assembly.Targets?.DotNet?.VersionSuffix); - } - - public static string GetDecoratedVersion(this PackageVersion package) - { - return MakeDecoratedVersion(package.Version, package.Targets?.DotNet?.VersionSuffix); - } - - private static string MakeDecoratedVersion(string version, string suffix) - { - if (suffix == null) - { - return version; - } - // suffix is guaranteed to start with a leading `-` - return $"{version}{suffix}"; - } - } -} diff --git a/packages/jsii-dotnet-generator/src/NuGet.config b/packages/jsii-dotnet-generator/src/NuGet.config deleted file mode 100644 index b5fb4a92ff..0000000000 --- a/packages/jsii-dotnet-generator/src/NuGet.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/packages/jsii-dotnet-generator/src/NuGet.config.vs b/packages/jsii-dotnet-generator/src/NuGet.config.vs deleted file mode 100644 index f0b88f301d..0000000000 --- a/packages/jsii-dotnet-generator/src/NuGet.config.vs +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/packages/jsii-dotnet-generator/test.sh b/packages/jsii-dotnet-generator/test.sh deleted file mode 100755 index 7cee135d19..0000000000 --- a/packages/jsii-dotnet-generator/test.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -set -euo pipefail - -# Run unit tests -dotnet test -c Release ./src/Amazon.JSII.Generator.UnitTests diff --git a/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs b/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs index 6ba171f560..62ad6a627c 100644 --- a/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs +++ b/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using Amazon.JSII.Runtime.Deputy; using Amazon.JSII.Tests.CalculatorNamespace; -using Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperation; +using CompositeOperation = Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperation; using Amazon.JSII.Tests.CalculatorNamespace.LibNamespace; using Newtonsoft.Json.Linq; using Xunit; @@ -260,9 +260,9 @@ public void GetAndSetEnumValues() calc.Add(9); calc.Pow(3); - Assert.Equal(CompositionStringStyle.NORMAL, calc.StringStyle); - calc.StringStyle = CompositionStringStyle.DECORATED; - Assert.Equal(CompositionStringStyle.DECORATED, calc.StringStyle); + Assert.Equal(CompositeOperation.CompositionStringStyle.NORMAL, calc.StringStyle); + calc.StringStyle = CompositeOperation.CompositionStringStyle.DECORATED; + Assert.Equal(CompositeOperation.CompositionStringStyle.DECORATED, calc.StringStyle); Assert.Equal("<<[[{{(((1 * (0 + 9)) * (0 + 9)) * (0 + 9))}}]]>>", calc.ToString()); } diff --git a/packages/jsii-pacmak/.gitignore b/packages/jsii-pacmak/.gitignore index 3d5a10a692..fd398815c6 100644 --- a/packages/jsii-pacmak/.gitignore +++ b/packages/jsii-pacmak/.gitignore @@ -1,5 +1,4 @@ lib/version.ts -lib/targets/dotnet-generator/ .classpath .project .settings diff --git a/packages/jsii-pacmak/generate.sh b/packages/jsii-pacmak/generate.sh index fb400b00c0..a4a719c448 100644 --- a/packages/jsii-pacmak/generate.sh +++ b/packages/jsii-pacmak/generate.sh @@ -1,11 +1,6 @@ #!/bin/bash set -euo pipefail -# embed the dotnet code generator program as a resource -dng="lib/targets/dotnet-generator" -mkdir -p ${dng} -rsync -av ../jsii-dotnet-generator/cli/publish/ ${dng}/ - commit=${CODEBUILD_RESOLVED_SOURCE_VERSION:-} # CODEBUILD_RESOLVED_SOURCE_VERSION is not defined (i.e. local build or CodePipeline build), # use the HEAD commit hash diff --git a/packages/jsii-pacmak/lib/targets/dotnet.ts b/packages/jsii-pacmak/lib/targets/dotnet.ts index 7b92496953..1b1bd17fb3 100644 --- a/packages/jsii-pacmak/lib/targets/dotnet.ts +++ b/packages/jsii-pacmak/lib/targets/dotnet.ts @@ -1,12 +1,11 @@ -import childProcess = require('child_process'); -import fs = require('fs-extra'); -import spec = require('jsii-spec'); -import path = require('path'); -import xmlbuilder = require('xmlbuilder'); -import { IGenerator } from '../generator'; -import logging = require('../logging'); +import * as fs from 'fs-extra'; +import * as spec from 'jsii-spec'; +import * as path from 'path'; +import * as xmlbuilder from 'xmlbuilder'; +import * as logging from '../logging'; import { PackageInfo, Target, TargetOptions } from '../target'; import { shell } from '../util'; +import {DotNetGenerator} from "./dotnet/dotnetgenerator"; export default class Dotnet extends Target { public static toPackageInfos(assm: spec.Assembly): { [language: string]: PackageInfo } { @@ -48,16 +47,14 @@ export default class Dotnet extends Target { public async build(sourceDir: string, outDir: string): Promise { await this.generateNuGetConfigForLocalDeps(sourceDir, outDir); - const pkg = await fs.readJson(path.join(this.packageDir, 'package.json')); const packageId: string = pkg.jsii.targets.dotnet.packageId; const project: string = path.join(packageId, `${packageId}.csproj`); - // Add retry as NuGet on Ubuntu is prone to failing due to race conditions await shell( 'dotnet', [ 'build', project, '-c', 'Release' ], - { cwd: sourceDir, retry: true } + { cwd: sourceDir } ); await this.copyFiles( @@ -125,46 +122,4 @@ export default class Dotnet extends Target { logging.debug(`Generated ${filePath}`); await fs.writeFile(filePath, xml); } -} - -// ################## -// # CODE GENERATOR # -// ################## - -class DotNetGenerator implements IGenerator { - private jsiiFile: string; - - public generate(): void { - // The DotNet generator does not currently support in-memory generation. - // Support can be added relatively easily if necessary. - } - - public async load(packageRoot: string) { - this.jsiiFile = path.join(packageRoot, spec.SPEC_FILE_NAME); - } - - public upToDate(_: string): Promise { - return Promise.resolve(false); - } - - public save(outdir: string, tarball: string): Promise { - return new Promise((resolve, reject) => { - const cliPath = path.join(__dirname, 'dotnet-generator', 'Amazon.JSII.Generator.CLI.dll'); - const cli = childProcess.spawn( - 'dotnet', - [cliPath, '--jsii', this.jsiiFile, '--tarball', tarball, '--output', outdir], - { stdio: 'inherit' } - ); - - cli.once('exit', code => { - if (code === 0) { - return resolve(); - } else { - return reject(new Error(`jsii-dotnet-generator exited with code ${code}`)); - } - }); - - cli.once('error', err => reject(err)); - }); - } -} +} \ No newline at end of file diff --git a/packages/jsii-pacmak/lib/targets/dotnet/dotnetdocgenerator.ts b/packages/jsii-pacmak/lib/targets/dotnet/dotnetdocgenerator.ts new file mode 100644 index 0000000000..68fabc4035 --- /dev/null +++ b/packages/jsii-pacmak/lib/targets/dotnet/dotnetdocgenerator.ts @@ -0,0 +1,120 @@ +import {CodeMaker} from "codemaker"; +import * as spec from 'jsii-spec'; +import {DotNetNameUtils} from "./nameutils"; + +/** + * Generates the Jsii attributes and calls for the .NET runtime + * + * Uses the same instance of CodeMaker as the rest of the code + */ +export class DotNetDocGenerator { + private code: CodeMaker; + private nameutils: DotNetNameUtils = new DotNetNameUtils(); + + constructor(code: CodeMaker) { + this.code = code; + } + + /** + * Emits all documentation depending on what is available in the jsii model + * + * Used by all kind of members + classes, interfaces, enums + * Order should be + * Summary + * Param + * Returns + * Remarks (includes examples, links, deprecated) + */ + public emitDocs(obj: spec.Method | spec.InterfaceType | spec.ClassType | spec.Property | spec.EnumType | spec.Initializer): void { + const docs = obj.docs; + + // The docs may be undefined at the method level but not the parameters level + if (docs) { + if (docs.summary) { + this.code.line(`/// ${docs.summary}`); + } + } + + // Handling parameters only if the obj is a method + const objMethod = obj as spec.Method; + if (objMethod.parameters) { + objMethod.parameters.forEach(param => { + if (param.docs) { + const paramSummary = param.docs.summary; + if (paramSummary) { + this.code.line(`/// ${paramSummary}`); + } + } + }); + } + + // At this point we only need a valid instance of docs + if (!docs) { + return; + } + + if (docs.returns) { + this.code.line(`/// `); + const returnsLines = docs.returns.split('\n'); + returnsLines.forEach( line => this.code.line(`/// ${line}`)); + this.code.line(`/// `); + } + + const remarks: string[] = []; + let remarksOpen = false; + if (docs.remarks) { + this.code.line(`/// `); + remarksOpen = true; + const remarkLines = docs.remarks.split('\n'); + remarkLines.forEach( line => this.code.line(`/// ${line}`)); + } + + if (docs.default) { + const defaultLines = docs.default.split('\n'); + remarks.push(`default:`); + defaultLines.forEach( line => remarks.push(`${line}`)); + } + + if (docs.stability) { + remarks.push(`stability: ${this.nameutils.capitalizeWord(docs.stability)}`); + } + + if (docs.example) { + const remarkLines = docs.example.split('\n'); + remarks.push(`example:`); + remarks.push(``); + remarkLines.forEach( line => remarks.push(`${line}`)); + remarks.push(``); + } + + if (docs.see) { + const seeLines = docs.see.split('\n'); + remarks.push(`see:`); + seeLines.forEach( line => remarks.push(`${line}`)); + } + + if (docs.subclassable) { + remarks.push("subclassable"); + } + + if (docs.custom) { + for (const [k, v] of Object.entries(docs.custom || {})) { + const custom = (k === "link") ? `${k}: ${v} ` : `${k}: ${v}`; // Extra space for '@link' to keep unit tests happy + const customLines = custom.split('\n'); + customLines.forEach( line => remarks.push(`${line}`)); + } + } + + if (remarks.length > 0) { + if (!remarksOpen) { + this.code.line(`/// `); + remarksOpen = true; + } + remarks.forEach( line => this.code.line(`/// ${line}`)); + } + + if (remarksOpen) { + this.code.line(`/// `); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/lib/targets/dotnet/dotnetgenerator.ts b/packages/jsii-pacmak/lib/targets/dotnet/dotnetgenerator.ts new file mode 100644 index 0000000000..b0be62acc5 --- /dev/null +++ b/packages/jsii-pacmak/lib/targets/dotnet/dotnetgenerator.ts @@ -0,0 +1,767 @@ +import * as clone from "clone"; +import * as fs from "fs-extra"; +import * as reflect from 'jsii-reflect'; +import * as spec from 'jsii-spec'; +import * as path from "path"; +import {Generator} from "../../generator"; +import {DotNetDocGenerator} from "./dotnetdocgenerator"; +import {DotNetRuntimeGenerator} from "./dotnetruntimegenerator"; +import {DotNetTypeResolver} from "./dotnettyperesolver"; +import {DotNetDependency, FileGenerator} from "./filegenerator"; +import {DotNetNameUtils} from "./nameutils"; + +/** + * CODE GENERATOR V2 + */ +export class DotNetGenerator extends Generator { + // The path of the original jsii input model. + private jsiiFilePath: string; + + // Flags that tracks if we have already wrote the first member of the class + private firstMemberWritten: boolean = false; + + private typeresolver: DotNetTypeResolver; + + private nameutils: DotNetNameUtils = new DotNetNameUtils(); + + private dotnetRuntimeGenerator: DotNetRuntimeGenerator; + + private dotnetDocGenerator: DotNetDocGenerator; + + constructor() { + super(); + + // Override the openBlock to get a correct C# looking code block with the curly brace after the line + this.code.openBlock = function(text) { + this.line(text); + this.open('{'); + }; + } + + public async load(packageRoot: string, assembly: reflect.Assembly): Promise { + await super.load(packageRoot, assembly); + this.jsiiFilePath = path.join(packageRoot, spec.SPEC_FILE_NAME); + } + + /** + * Runs the generator (in-memory). + */ + public generate(fingerprint: boolean) { + this.typeresolver = new DotNetTypeResolver(this.assembly, + (fqn: string) => this.findModule(fqn), + (fqn: string) => this.findType(fqn), + ); + + this.dotnetRuntimeGenerator = new DotNetRuntimeGenerator(this.code, this.typeresolver); + this.dotnetDocGenerator = new DotNetDocGenerator(this.code); + + // We need to resolve the dependency tree + this.typeresolver.resolveNamespacesDependencies(); + super.generate(fingerprint); + } + + public async save(outdir: string, tarball: string) { + // Generating the csproj and AssemblyInfo.cs files + const tarballFileName = tarball.substr(tarball.lastIndexOf('/') + 1); + const filegen = new FileGenerator(this.assembly, tarballFileName, this.code); + filegen.generateAssemblyInfoFile(); + filegen.generateProjectFile(this.typeresolver.namespaceDependencies); + // Calling super.save() dumps the tarball in the format name@version.jsii.tgz. + // This is not in sync with the Old .NET generator where the name is scope-name-version.tgz. + // Hence we are saving the files ourselves here: + const assm = this.assembly; + const packageId: string = assm.targets!.dotnet!.packageId; + if (!packageId) { throw new Error(`The module ${assm.name} does not have a dotnet.packageId setting`); } + await fs.mkdirs(path.join(outdir, packageId)); + await fs.copyFile(tarball, path.join(outdir, packageId, tarballFileName)); + + // Create an anchor file for the current model + this.generateDependencyAnchorFile(); + + // Copying the .jsii file + await fs.copyFile(this.jsiiFilePath, path.join(outdir, packageId, spec.SPEC_FILE_NAME)); + + // Saving the generated code. + return await this.code.save(outdir); + } + + /** + * Generates the Anchor file + */ + protected generateDependencyAnchorFile(): void { + const namespace: string = this.assembly.targets!.dotnet!.namespace + ".Internal.DependencyResolution"; + this.openFileIfNeeded("Anchor", namespace, false, false); + this.code.openBlock("public class Anchor"); + this.code.openBlock("public Anchor()"); + this.typeresolver.namespaceDependencies.forEach((value: DotNetDependency) => { + this.code.line(`new ${value.namespace}.Internal.DependencyResolution.Anchor();`); + }); + this.code.closeBlock(); + this.code.closeBlock(); + this.closeFileIfNeeded("Anchor", false); + } + + /** + * Not used as we override the save() method + */ + protected getAssemblyOutputDir(mod: spec.Assembly): string { + return this.nameutils.convertPackageName((mod.name)); + } + + /** + * Namespaces are handled implicitly by openFileIfNeeded(). + */ + protected onBeginNamespace(_ns: string) { + /* tslint:disable:no-empty */ + } + + protected onEndNamespace(_ns: string) { + /* tslint:disable:no-empty */ + } + + protected onBeginInterface(ifc: spec.InterfaceType) { + const implementations = this.typeresolver.resolveImplementedInterfaces(ifc); + const interfaceName = this.nameutils.convertInterfaceName(ifc.name); + const namespace = ifc.namespace ? `${this.assembly.targets!.dotnet!.namespace}.${ifc.namespace}` : this.assembly.targets!.dotnet!.namespace; + this.openFileIfNeeded(interfaceName, namespace, this.isNested(ifc)); + + this.dotnetDocGenerator.emitDocs(ifc); + this.dotnetRuntimeGenerator.emitAttributesForInterface(ifc); + + if (implementations.length > 0) { + this.code.openBlock(`public interface ${interfaceName} : ${implementations.join(', ')}`); + } else { + this.code.openBlock(`public interface ${interfaceName}`); + } + this.flagFirstMemberWritten(false); + } + + protected onEndInterface(ifc: spec.InterfaceType) { + const interfaceName = this.nameutils.convertInterfaceName(ifc.name); + this.code.closeBlock(); + this.closeFileIfNeeded(interfaceName, this.isNested(ifc)); + + // emit interface proxy class + this.emitInterfaceProxy(ifc); + + // emit implementation class + // TODO: If datatype then we may not need the interface proxy to be created, We could do with just the interface impl? + if (ifc.datatype) { + this.emitInterfaceDataType(ifc); + } + } + + protected onInterfaceMethod(_ifc: spec.InterfaceType, method: spec.Method) { + this.dotnetDocGenerator.emitDocs(method); + this.dotnetRuntimeGenerator.emitAttributesForMethod(_ifc, method); + const returnType = method.returns ? this.typeresolver.toDotNetType(method.returns.type) : 'void'; + this.code.line(`${returnType} ${this.nameutils.convertMethodName(method.name)}(${this.renderMethodParameters(method)});`); + } + + protected onInterfaceMethodOverload(ifc: spec.InterfaceType, overload: spec.Method, _originalMethod: spec.Method) { + this.onInterfaceMethod(ifc, overload); + } + + protected onInterfaceProperty(_ifc: spec.InterfaceType, prop: spec.Property) { + if (!prop.abstract) { + throw new Error(`Interface properties must be abstract: ${prop.name}`); + } + + if (prop.protected) { + throw new Error(`Protected properties are not allowed on interfaces: ${prop.name}`); + } + + if (prop.static) { + throw new Error(`Property ${_ifc.name}.${prop.name} is marked as static, but interfaces must not contain static members.`); + } + + this.emitNewLineIfNecessary(); + this.dotnetDocGenerator.emitDocs(prop); + this.dotnetRuntimeGenerator.emitAttributesForProperty(prop); + + const propType = this.typeresolver.toDotNetType(prop.type); + const propName = this.nameutils.convertPropertyName(prop.name); + + // Specifying that a type is nullable is only required for primitive value types + const isOptionalPrimitive = this.isOptionalPrimitive(prop) ? '?' : ''; + this.code.openBlock(`${propType}${isOptionalPrimitive} ${propName}`); + + this.code.line('get;'); + if (!prop.immutable) { + this.code.line('set;'); + } + this.code.closeBlock(); + this.flagFirstMemberWritten(true); + } + + protected onBeginClass(cls: spec.ClassType, abstract: boolean) { + let baseTypeNames: string[] = []; + const namespace = cls.namespace ? `${this.assembly.targets!.dotnet!.namespace}.${cls.namespace}` : this.assembly.targets!.dotnet!.namespace; + + // A class can derive from only one base class + // But can implement multiple interfaces + if (!cls.base) { + baseTypeNames.push('DeputyBase'); + } else { + const classBase = this.typeresolver.toDotNetType({ fqn: cls.base }); + baseTypeNames.push(classBase); + } + + if (cls.interfaces && cls.interfaces.length > 0) { + const implementations = this.typeresolver.resolveImplementedInterfaces(cls); + baseTypeNames = baseTypeNames.concat(implementations); + } + + const className = this.nameutils.convertClassName(cls); + + // Nested classes will be dealt with during calc code generation + const nested = this.isNested(cls); + const inner = nested ? ' static' : ''; + const absPrefix = abstract ? ' abstract' : ''; + + this.openFileIfNeeded(className, namespace, nested); + + const implementsExpr = ' : ' + baseTypeNames.join(', '); + + this.dotnetDocGenerator.emitDocs(cls); + this.dotnetRuntimeGenerator.emitAttributesForClass(cls); + + this.code.openBlock(`public${inner}${absPrefix} class ${className}${implementsExpr}`); + + // Compute the class parameters + // TODO: add the support for optional parameters + // Not achievable as of today and not supported by the current generator + // https://github.com/awslabs/jsii/issues/210 + let parametersDefinition = ''; + let parametersBase = ''; + const initializer = cls.initializer; + if (initializer) { + this.dotnetDocGenerator.emitDocs(initializer); + this.dotnetRuntimeGenerator.emitDeprecatedAttributeIfNecessary(initializer); + if (initializer.parameters) { + for (const p of initializer.parameters) { + const pType = this.typeresolver.toDotNetType(p.type); + const isOptionalPrimitive = this.isOptionalPrimitive(p) ? '?' : ''; + if (parametersDefinition !== '') { + parametersDefinition += ', '; + parametersBase += ', '; + } + parametersDefinition += `${pType}${isOptionalPrimitive} ${this.nameutils.convertParameterName(p.name)}`; + parametersBase += `${this.nameutils.convertParameterName(p.name)}`; + + } + } + + // Create the constructors: + // Abstract classes have protected constructors. + const visibility = cls.abstract ? 'protected' : 'public'; + + this.code.openBlock(`${visibility} ${className}(${parametersDefinition}): base(new DeputyProps(new object[]{${parametersBase}}))`); + this.code.closeBlock(); + this.code.line(); + } + + this.dotnetRuntimeGenerator.emitDeprecatedAttributeIfNecessary(initializer); + this.code.openBlock(`protected ${className}(ByRefValue reference): base(reference)`); + this.code.closeBlock(); + this.code.line(); + + this.dotnetRuntimeGenerator.emitDeprecatedAttributeIfNecessary(initializer); + this.code.openBlock(`protected ${className}(DeputyProps props): base(props)`); + this.code.closeBlock(); + + // We have already outputted members (constructors), setting the flag to true + this.flagFirstMemberWritten(true); + } + + protected onEndClass(cls: spec.ClassType) { + this.code.closeBlock(); + this.closeFileIfNeeded(cls.name, this.isNested(cls)); + + if (cls.abstract) { + this.emitInterfaceProxy(cls); + } + } + + protected onField(_cls: spec.ClassType, _prop: spec.Property, _union?: spec.UnionTypeReference) { + /* tslint:disable:no-empty */ + } + + protected onMethod(cls: spec.ClassType, method: spec.Method) { + this.emitMethod(cls, method); + } + + protected onMethodOverload(cls: spec.ClassType, overload: spec.Method, _originalMethod: spec.Method) { + this.onMethod(cls, overload); + } + + protected onProperty(cls: spec.ClassType, prop: spec.Property) { + this.emitProperty(cls, prop); + } + + protected onStaticMethod(cls: spec.ClassType, method: spec.Method) { + this.emitMethod(cls, method); + } + + protected onStaticMethodOverload(cls: spec.ClassType, overload: spec.Method, _originalMethod: spec.Method) { + this.emitMethod(cls, overload); + } + + protected onStaticProperty(cls: spec.ClassType, prop: spec.Property) { + if (prop.const) { + this.emitConstProperty(cls, prop); + } else { + this.emitProperty(cls, prop); + } + } + + protected onUnionProperty(cls: spec.ClassType, prop: spec.Property, _union: spec.UnionTypeReference) { + this.emitProperty(cls, prop); + } + + protected onBeginEnum(enm: spec.EnumType) { + const enumName = this.nameutils.convertTypeName(enm.name); + const namespace = enm.namespace ? `${this.assembly.targets!.dotnet!.namespace}.${enm.namespace}` : this.assembly.targets!.dotnet!.namespace; + this.openFileIfNeeded(enumName, namespace, this.isNested(enm)); + this.emitNewLineIfNecessary(); + this.dotnetDocGenerator.emitDocs(enm); + this.dotnetRuntimeGenerator.emitAttributesForEnum(enm, enumName); + this.code.openBlock(`public enum ${enm.name}`); + } + + protected onEndEnum(enm: spec.EnumType) { + this.code.closeBlock(); + const enumName = this.nameutils.convertTypeName(enm.name); + this.closeFileIfNeeded(enumName, this.isNested(enm)); + } + + protected onEnumMember(_: spec.EnumType, member: spec.EnumMember) { + this.dotnetDocGenerator.emitDocs(member); + const enumMemberName = this.nameutils.convertEnumMemberName(member.name); + this.dotnetRuntimeGenerator.emitAttributesForEnumMember(enumMemberName, member); + // If we are on the last enum member, we don't need a comma + if (_.members.indexOf(member) !== (_.members.length - 1)) { + this.code.line(`${enumMemberName},`); + } else { + this.code.line(`${enumMemberName}`); + } + } + + private emitMethod(cls: spec.ClassType | spec.InterfaceType, method: spec.Method, emitForProxyOrDatatype: boolean = false): void { + this.emitNewLineIfNecessary(); + const returnType = method.returns ? this.typeresolver.toDotNetType(method.returns.type) : 'void'; + let staticKeyWord = ''; + let overrideKeyWord = ''; + let virtualKeyWord = ''; + + let definedOnAncestor = false; + // In the case of the source being a class, we check if it is already defined on an ancestor + if (cls.kind === spec.TypeKind.Class) { + definedOnAncestor = this.isMemberDefinedOnAncestor(cls as spec.ClassType, method); + } + // The method is an override if it's defined on the ancestor, or if the parent is a class and we are generating a proxy or datatype class + let overrides = (definedOnAncestor || (cls.kind === spec.TypeKind.Class && emitForProxyOrDatatype)); + // We also inspect the jsii model to see if it overrides a class member. + if (method.overrides) { + const overrideType = this.findType(method.overrides); + if (overrideType.kind === spec.TypeKind.Class) { + // Overrides a class, needs overrides keyword + overrides = true; + } + } + if (method.static) { + staticKeyWord = 'static '; + } else if (overrides) { + // Add the override key word if the method is emitted for a proxy or data type or is defined on an ancestor + overrideKeyWord = 'override '; + } else if ((method.abstract || !definedOnAncestor) && !emitForProxyOrDatatype) { + // Add the virtual key word if the method is abstract or not defined on an ancestor and we are NOT generating a proxy or datatype class + // Methods should always be virtual when possible + virtualKeyWord = 'virtual '; + } + const access = this.renderAccessLevel(method); + const methodName = this.nameutils.convertMethodName(method.name); + const signature = `${returnType} ${methodName}(${this.renderMethodParameters(method)})`; + + this.dotnetDocGenerator.emitDocs(method); + this.dotnetRuntimeGenerator.emitAttributesForMethod(cls, method/*, emitForProxyOrDatatype*/); + + if (method.abstract) { + this.code.line(`${access} ${overrideKeyWord}abstract ${signature};`); + this.code.line(); + } else { + this.code.openBlock(`${access} ${staticKeyWord}${overrideKeyWord}${virtualKeyWord}${signature}`); + this.code.line(this.dotnetRuntimeGenerator.createInvokeMethodIdentifier(method, cls as spec.ClassType)); + this.code.closeBlock(); + } + } + + /** + * Founds out if a member (property or method) is already defined in one of the base classes + * + * Used to figure out if the override or virtual keywords are necessary. + */ + private isMemberDefinedOnAncestor(cls: spec.ClassType, member: spec.Property | spec.Method): boolean { + if (member as spec.Method) { + const objectMethods = [ 'ToString', 'GetHashCode', 'Equals']; + // Methods defined on the Object class should be overridden, return true; + if (objectMethods.includes(this.nameutils.convertMethodName(member.name))) { + return true; + } + } + + const base = cls.base; + if (base) { + const baseType = this.findType(base) as spec.ClassType; + + if (member as spec.Property) { + if (baseType.properties) { + if (baseType.properties.filter(property => property.name === member.name).length > 0) { + // property found in base parent + return true; + } + } + return this.isMemberDefinedOnAncestor(baseType, member); + } else if (member as spec.Method) { + if (baseType.methods) { + const myMethod = member as spec.Method; + // If the name, parameters and returns are similar then it is the same method in .NET + for (const m of baseType.methods) { + if (m.name === myMethod.name + && m.parameters === myMethod.parameters + && m.returns === myMethod.returns) { + return true; + } + } + } + return this.isMemberDefinedOnAncestor(baseType, member); + } else { + return false; + } + } else { + return false; + } + } + + // TODO: I uncovered an issue with optional parameters and ordering them + // They are currently not supported by the generator. + // In C#, optional parameters need to be declared after required parameters + // We could make changes to the parameters ordering in the jsii model to support them + // But then an optional parameter becoming non optional would create a mess + // https://github.com/awslabs/jsii/issues/210 + private renderMethodParameters(method: spec.Method): string { + const params = []; + if (method.parameters) { + for (const p of method.parameters) { + const isOptionalPrimitive = this.isOptionalPrimitive(p) ? '?' : ''; + const st = `${this.typeresolver.toDotNetType(p.type)}${isOptionalPrimitive} ${this.nameutils.convertParameterName(p.name)}`; + params.push(st); + } + } + return params.join(', '); + } + + private isOptionalPrimitive(optionalValue: spec.OptionalValue | undefined): boolean { + if (!optionalValue || !optionalValue.optional) { + return false; + } + + // If the optional type is an enum then we need to flag it as ? + const typeref = optionalValue.type as spec.NamedTypeReference; + let isOptionalEnum = false; + if (typeref && typeref.fqn) { + const type = this.findType(typeref.fqn); + isOptionalEnum = type.kind === spec.TypeKind.Enum; + } + + return (spec.isPrimitiveTypeReference(optionalValue.type) + // In .NET, string or object is a reference type, and can be nullable + && optionalValue.type.primitive !== spec.PrimitiveType.String + && optionalValue.type.primitive !== spec.PrimitiveType.Any + && optionalValue.type.primitive !== spec.PrimitiveType.Json) // Json is not a primitive in .NET + || (isOptionalEnum); + } + + /** + * Emits an interface proxy for an interface or an abstract class. + */ + private emitInterfaceProxy(ifc: spec.InterfaceType | spec.ClassType): void { + // No need to slugify for a proxy + const name = this.nameutils.convertTypeName(ifc.name) + 'Proxy'; + const namespace = ifc.namespace ? `${this.assembly.targets!.dotnet!.namespace}.${ifc.namespace}` : this.assembly.targets!.dotnet!.namespace; + const isNested = this.isNested(ifc); + this.openFileIfNeeded(name, namespace, isNested); + + this.dotnetDocGenerator.emitDocs(ifc); + this.dotnetRuntimeGenerator.emitAttributesForInterfaceProxy(ifc); + const interfaceFqn = this.typeresolver.toNativeFqn(ifc.fqn); + const suffix = ifc.kind === spec.TypeKind.Interface ? `: DeputyBase, ${interfaceFqn}` + : `: ${interfaceFqn}`; + this.code.openBlock(`internal sealed class ${name} ${suffix}`); + + // Create the private constructor + this.code.openBlock(`private ${name}(ByRefValue reference): base(reference)`); + this.code.closeBlock(); + + // We have already output a member (constructor), setting the first member flag to true + this.flagFirstMemberWritten(true); + + const datatype = false; + const proxy = true; + this.emitInterfaceMembersForProxyOrDatatype(ifc, datatype, proxy); + + this.code.closeBlock(); + this.closeFileIfNeeded(name, isNested); + } + + /** + * Emits an Interface Datatype class + * + * This is used to emit a class implementing an interface when the datatype property is true in the jsii model + * The generation of the interface proxy may not be needed if the interface is also set as a datatype + */ + private emitInterfaceDataType(ifc: spec.InterfaceType | spec.ClassType): void { + // Interface datatypes do not need to be prefixed by I, we can call convertClassName + const name = this.nameutils.convertClassName(ifc as spec.ClassType); + const namespace = ifc.namespace ? `${this.assembly.targets!.dotnet!.namespace}.${ifc.namespace}` : this.assembly.targets!.dotnet!.namespace; + const isNested = this.isNested(ifc); + this.openFileIfNeeded(name, namespace, isNested); + this.dotnetDocGenerator.emitDocs(ifc); + const suffix = `: ${this.typeresolver.toNativeFqn(ifc.fqn)}`; + this.dotnetRuntimeGenerator.emitAttributesForInterfaceDatatype(); + this.code.openBlock(`public class ${name} ${suffix}`); + this.flagFirstMemberWritten(false); + const datatype = true; + const proxy = false; + this.emitInterfaceMembersForProxyOrDatatype(ifc, datatype, proxy); + this.code.closeBlock(); + this.closeFileIfNeeded(name, isNested); + } + + /** + * Generates the body of the interface proxy or data type class + * + * This loops through all the member and generates them + */ + private emitInterfaceMembersForProxyOrDatatype(ifc: spec.InterfaceType | spec.ClassType, datatype: boolean, proxy: boolean): void { + // The key is in the form 'method.name;parameter1;parameter2;' etc + const methods: Map = new Map(); + /* + Only get the first declaration encountered, and keep it if it is abstract. The list contains ALL + methods and properties encountered, in the order encountered. An abstract class can have concrete + implementations. Therefore, we only generate methods/properties if the first member encountered + is unimplemented. + */ + const excludedMethod: string[] = []; // Keeps track of the methods we already ran into and don't want to emit + const excludedProperties: string[] = []; // Keeps track of the properties we already ran into and don't want to emit + const properties: { [name: string]: spec.Property } = {}; + const collectAbstractMembers = (currentType: spec.InterfaceType | spec.ClassType) => { + for (const prop of currentType.properties || []) { + if (excludedProperties.indexOf(prop.name) < 0) { + // If we have never run into this property before and it is abstract, we keep it + if (prop.abstract) { + properties[prop.name] = prop; + } + excludedProperties.push(prop.name); + } + } + + for (const method of currentType.methods || []) { + let methodParameters = ''; + if (method.parameters) { + method.parameters.forEach(param => { methodParameters += ';' + this.typeresolver.toDotNetType(param.type); }); + } + if (excludedMethod.indexOf(`${method.name}${methodParameters}`) < 0) { + // If we have never run into this method before and it is abstract, we keep it + if (method.abstract) { + methods.set(`${method.name}${methodParameters}`, method); + } + excludedMethod.push(`${method.name}${methodParameters}`); + } + } + + const bases = new Array(); + bases.push(...(currentType.interfaces || []).map(iface => this.findType(iface))); + if (currentType.kind === spec.TypeKind.Class && currentType.base) { + bases.push(this.findType(currentType.base)); + } + for (const base of bases) { + const type = this.findType(base.fqn!); + if (type.kind !== spec.TypeKind.Interface && type.kind !== spec.TypeKind.Class) { + throw new Error(`Base interfaces of an interface must be an interface or a class (${base.fqn} is of type ${type.kind})`); + } + collectAbstractMembers(type); + } + }; + collectAbstractMembers(ifc); + + // emit all properties + for (const propName of Object.keys(properties)) { + const prop = clone(properties[propName]); + prop.abstract = false; + this.emitProperty(ifc, prop, datatype, proxy); + } + // emit all the methods + for (const methodNameAndParameters of methods.keys()) { + const originalMethod = methods.get(methodNameAndParameters); + if (originalMethod) { + const method = clone(originalMethod); + method.abstract = false; + this.emitMethod(ifc, method, /* emitForProxyOrDatatype */ true); + + for (const overloadedMethod of this.createOverloadsForOptionals(method)) { + overloadedMethod.abstract = false; + this.emitMethod(ifc, overloadedMethod, /* emitForProxyOrDatatype */ true); + } + } + } + } + + /** + * Emits a property + */ + private emitProperty(cls: spec.Type, prop: spec.Property, datatype: boolean = false, proxy: boolean = false): void { + + this.emitNewLineIfNecessary(); + + const className = this.typeresolver.toNativeFqn(cls.fqn); + const access = this.renderAccessLevel(prop); + const staticKeyWord = prop.static ? 'static ' : ''; + const propName = this.nameutils.convertPropertyName(prop.name); + + this.dotnetDocGenerator.emitDocs(prop); + this.dotnetRuntimeGenerator.emitAttributesForProperty(prop, datatype); + + let isOverrideKeyWord = ''; + + let isVirtualKeyWord = ''; + // If the prop parent is a class + if (cls.kind === spec.TypeKind.Class) { + + const implementedInBase = this.isMemberDefinedOnAncestor(cls as spec.ClassType, prop); + if (implementedInBase || datatype || proxy) { + // Override if the property is in a datatype or proxy class or declared in a parent class + isOverrideKeyWord = 'override '; + } else if (!prop.static && (prop.abstract || !implementedInBase)) { + // Virtual if the prop is not static, and is abstract or not implemented in base member, this way we can later override it. + isVirtualKeyWord = 'virtual '; + } + } + const propTypeFQN = this.typeresolver.toDotNetType(prop.type); + const isOptionalPrimitive = this.isOptionalPrimitive(prop) ? '?' : ''; + const statement = `${access} ${isVirtualKeyWord}${isOverrideKeyWord}${staticKeyWord}${propTypeFQN}${isOptionalPrimitive} ${propName}`; + this.code.openBlock(statement); + + // Emit getters + if (datatype || prop.const) { + this.code.line('get;'); + } else { + if (prop.static) { + this.code.line(`get => GetStaticProperty<${propTypeFQN}>(typeof(${className}));`); + } else { + this.code.line(`get => GetInstanceProperty<${propTypeFQN}${isOptionalPrimitive}>();`); + } + } + + // Emit setters + if (datatype) { + this.code.line('set;'); + } else { + if (!prop.immutable) { + if (prop.static) { + this.code.line(`set => SetStaticProperty(typeof(${className}), value);`); + } else { + this.code.line(`set => SetInstanceProperty(value);`); + } + } + } + + this.code.closeBlock(); + + this.flagFirstMemberWritten(true); + } + + /** + * Emits a constant property + */ + private emitConstProperty(cls: spec.ClassType, prop: spec.Property): void { + this.emitNewLineIfNecessary(); + this.flagFirstMemberWritten(true); + const propType = this.typeresolver.toDotNetType(prop.type); + this.dotnetDocGenerator.emitDocs(prop); + this.dotnetRuntimeGenerator.emitAttributesForProperty(prop); + const access = this.renderAccessLevel(prop); + const propName = this.nameutils.convertPropertyName(prop.name); + const staticKeyword = prop.static ? 'static ' : ''; + + this.code.openBlock(`${access} ${staticKeyword}${propType} ${propName}`); + this.code.line('get;'); + this.code.closeBlock(); + const className = this.typeresolver.toNativeFqn(cls.fqn); + const initializer = prop.static ? `= GetStaticProperty<${propType}>(typeof(${className}));` + : `= GetInstanceProperty<${propType}>(typeof(${className}));`; + this.code.line(initializer); + } + + private renderAccessLevel(method: spec.Method | spec.Property): string { + return method.protected ? 'protected' : 'public'; + } + + private isNested(type: spec.Type): boolean { + if (!this.assembly.types || !type.namespace) { return false; } + const parent = `${type.assembly}.${type.namespace}`; + return parent in this.assembly.types; + } + + private toCSharpFilePath(type: string): string { + return type + ".cs"; + } + + private openFileIfNeeded(typeName: string, namespace: string, isNested: boolean, usingDeputy: boolean = true): void { + // If Nested type, we shouldn't open/close a file + if (isNested) { + return; + } + + const dotnetPackageId = this.assembly.targets && this.assembly.targets.dotnet && this.assembly.targets.dotnet.packageId; + if (!dotnetPackageId) { throw new Error(`The module ${this.assembly.name} does not have a dotnet.packageId setting`); } + const filePath = namespace.replace(/[.]/g, '/'); + this.code.openFile(path.join(dotnetPackageId, filePath, this.toCSharpFilePath(typeName))); + if (usingDeputy) { + this.code.line("using Amazon.JSII.Runtime.Deputy;"); + this.code.line(); + } + this.code.openBlock(`namespace ${namespace}`); + } + + private closeFileIfNeeded(typeName: string, isNested: boolean): void { + if (isNested) { + return; + } + this.code.closeBlock(); + this.code.closeFile(this.toCSharpFilePath(typeName)); + } + + /** + * Resets the firstMember boolean flag to keep track of the first member of a new file + * + * This avoids unnecessary white lines + */ + private flagFirstMemberWritten(first: boolean): void { + this.firstMemberWritten = first; + } + + /** + * Emits a new line prior to writing a new property, method, if the property is not the first one in the class + * + * This avoids unnecessary white lines. + */ + private emitNewLineIfNecessary(): void { + // If the first member has already been written, it is safe to write a new line + if (this.firstMemberWritten) { + this.code.line(); + } else { + this.firstMemberWritten = false; + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/lib/targets/dotnet/dotnetruntimegenerator.ts b/packages/jsii-pacmak/lib/targets/dotnet/dotnetruntimegenerator.ts new file mode 100644 index 0000000000..5d98eb83d0 --- /dev/null +++ b/packages/jsii-pacmak/lib/targets/dotnet/dotnetruntimegenerator.ts @@ -0,0 +1,173 @@ +import {CodeMaker} from "codemaker"; +import * as spec from 'jsii-spec'; +import {DotNetTypeResolver} from "./dotnettyperesolver"; +import {DotNetNameUtils} from "./nameutils"; + +/** + * Generates the Jsii attributes and calls for the jsii .NET runtime + * + * Uses the same instance of CodeMaker as the rest of the code + */ +export class DotNetRuntimeGenerator { + private code: CodeMaker; + private typeresolver: DotNetTypeResolver; + private nameutils: DotNetNameUtils = new DotNetNameUtils(); + + constructor(code: CodeMaker, typeresolver: DotNetTypeResolver) { + this.code = code; + this.typeresolver = typeresolver; + } + + /** + * Emits the jsii attribute for an interface + * + * Ex: [JsiiInterface(nativeType: typeof(IGreetee), fullyQualifiedName: "jsii-calc.Greetee")] + */ + public emitAttributesForInterface(ifc: spec.InterfaceType) { + const jsiiAttribute = + `[JsiiInterface(nativeType: typeof(${this.nameutils.convertInterfaceName(ifc.name)}), fullyQualifiedName: "${ifc.fqn}")]`; + this.code.line(jsiiAttribute); + this.emitDeprecatedAttributeIfNecessary(ifc); + } + + /** + * Emits the jsii attribute for an interface datatype + * + * Ex: [JsiiByValue] + */ + public emitAttributesForInterfaceDatatype() { + const jsiiAttribute = `[JsiiByValue]`; + this.code.line(jsiiAttribute); + } + + /** + * Emits the jsii attribute for a class + * + * Ex: [JsiiClass(nativeType: typeof(Very), fullyQualifiedName: "@scope/jsii-calc-base-of-base.Very")] + */ + public emitAttributesForClass(cls: spec.ClassType) { + // const className = this.nameutils.convertClassName(cls); + const className = this.typeresolver.toNativeFqn(cls.fqn); + let jsiiAttribute = `[JsiiClass(nativeType: typeof(${className}), fullyQualifiedName: "${cls.fqn}")]`; + const initializer = cls.initializer; + if (initializer) { + if (initializer.parameters) { + jsiiAttribute = `[JsiiClass(nativeType: typeof(${className}), fullyQualifiedName: ` + + `"${cls.fqn}", parametersJson: "${JSON.stringify(initializer.parameters) + .replace(/"/g, '\\"') + .replace(/\\{2}"/g, 'test')}")]`; + } + } + this.code.line(jsiiAttribute); + this.emitDeprecatedAttributeIfNecessary(cls); + } + + /** + * Emits the proper jsii .NET attribute for a method + * + * Ex: [JsiiMethod(name: "hey", returnsJson: "{\"type\":{\"primitive\":\"number\"}}") + */ + public emitAttributesForMethod(cls: spec.ClassType | spec.InterfaceType, method: spec.Method/*, emitForProxyOrDatatype: boolean = false*/): void { + const isOverride = (cls.kind === spec.TypeKind.Class) && (method.overrides) ? ', isOverride: true' : ''; + const isAsync = (cls.kind === spec.TypeKind.Class) && (method.async) ? ', isAsync: true' : ''; + const parametersJson = method.parameters ? `, parametersJson: "${JSON.stringify(method.parameters) + .replace(/"/g, '\\"') + .replace(/\\{2}"/g, 'test')}"` : ''; + const returnsJson = method.returns ? `, returnsJson: "${JSON.stringify(method.returns) + .replace(/"/g, '\\"') + .replace(/\\{2}"/g, 'test')}"` : ''; + const jsiiAttribute = `[JsiiMethod(name: "${method.name}"${returnsJson}${parametersJson}${isAsync}${isOverride})]`; + this.code.line(jsiiAttribute); + this.emitDeprecatedAttributeIfNecessary(method); + } + + /** + * Emits the proper jsii .NET attribute for a property + * + * Ex: [JsiiProperty(name: "foo", typeJson: "{\"fqn\":\"@scope/jsii-calc-base-of-base.Very\"}", isOptional: true, isOverride: true)] + */ + public emitAttributesForProperty(prop: spec.Property, datatype: boolean = false): void { + // If we are on a datatype then we want the property to override in Jsii + const isJsiiOverride = datatype ? ', isOverride: true' : ''; + const isOptionalJsii = prop.optional ? ', isOptional: true' : ''; + const jsiiAttribute = `[JsiiProperty(name: "${prop.name}", ` + + `typeJson: "${JSON.stringify(prop.type) + .replace(/"/g, '\\"') + .replace(/\\{2}"/g, 'test')}"${isOptionalJsii}${isJsiiOverride})]`; + this.code.line(jsiiAttribute); + this.emitDeprecatedAttributeIfNecessary(prop); + } + + /** + * Emits the proper jsii .NET attribute for an interface proxy + * + * Ex: [JsiiTypeProxy(nativeType: typeof(IVeryBaseProps), fullyQualifiedName: "@scope/jsii-calc-base-of-base.VeryBaseProps")] + */ + public emitAttributesForInterfaceProxy(ifc: spec.ClassType | spec.InterfaceType): void { + const name = ifc.kind === spec.TypeKind.Interface ? this.nameutils.convertInterfaceName(ifc.name) + : this.typeresolver.toNativeFqn(ifc.fqn); + this.code.line(`[JsiiTypeProxy(nativeType: typeof(${name}), fullyQualifiedName: \"${ifc.fqn}\")]`); + this.emitDeprecatedAttributeIfNecessary(ifc); + } + + /** + * Emits the proper jsii .NET attribute for an enum + * + * Ex: [JsiiEnum(nativeType: typeof(Test), fullyQualifiedName: "jsii-calc.Test")] + */ + public emitAttributesForEnum(enm: spec.EnumType, enumName: string): void { + const jsiiAttribute = `[JsiiEnum(nativeType: typeof(${enumName}), fullyQualifiedName: \"${enm.fqn}\")]`; + this.code.line(jsiiAttribute); + this.emitDeprecatedAttributeIfNecessary(enm); + } + + /** + * Emits the proper jsii .NET attribute for an enum member + * + * Ex: [JsiiEnumMember(name: "Normal")] + */ + public emitAttributesForEnumMember(enumMemberName: string, enmmember: spec.EnumMember): void { + const jsiiAttribute = `[JsiiEnumMember(name: "${enumMemberName}")]`; + this.code.line(jsiiAttribute); + this.emitDeprecatedAttributeIfNecessary(enmmember); + } + + /** + * Returns the jsii .NET method identifier + */ + public createInvokeMethodIdentifier(method: spec.Method, cls: spec.ClassType): string { + const className = this.typeresolver.toNativeFqn(cls.fqn); + const isStatic = method.static ? 'Static' : 'Instance'; + const returns = method.returns ? '' : 'Void'; + const invokeMethodName = method.returns ? `return Invoke${isStatic}${returns}Method` : `Invoke${isStatic}${returns}Method`; + const returnType = method.returns ? `<${this.typeresolver.toDotNetType(method.returns.type)}>` : ''; + const typeofStatement = method.static ? `typeof(${className}), ` : ''; + const params: string[] = []; + if (method.parameters) { + method.parameters.forEach(param => { params.push(this.nameutils.convertParameterName(param.name)); }); + } + return `${invokeMethodName}${returnType}(${typeofStatement}new object[]{${params.join(', ')}});`; + } + + /** + * Emits the proper .NET attribute for a deprecated class/interface/member + * + * Ex: [System.Obsolete()] + */ + public emitDeprecatedAttributeIfNecessary(obj: spec.Method | spec.ClassType | spec.InterfaceType + | spec.Property | spec.EnumType | spec.EnumMember | spec.Initializer | undefined): void { + if (!obj) { + return; + } + const docs = obj.docs; + if (docs) { + if (docs.stability! === spec.Stability.Deprecated) { + const attribute = docs.deprecated ? + `[System.Obsolete("${docs.deprecated + .replace(/\n/g, ' ') // Replacing new lines in Obsolete + .replace(/"/g, '\\"')}")]` : `[System.Obsolete()]`; + this.code.line(attribute); + } + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/lib/targets/dotnet/dotnettyperesolver.ts b/packages/jsii-pacmak/lib/targets/dotnet/dotnettyperesolver.ts new file mode 100644 index 0000000000..df115a1461 --- /dev/null +++ b/packages/jsii-pacmak/lib/targets/dotnet/dotnettyperesolver.ts @@ -0,0 +1,159 @@ +import * as spec from 'jsii-spec'; +import {DotNetDependency} from './filegenerator'; +import {DotNetNameUtils} from "./nameutils"; + +type FindModuleCallback = (fqn: string) => spec.Assembly | spec.PackageVersion; +type FindTypeCallback = (fqn: string) => spec.Type; + +export class DotNetTypeResolver { + // The dependency tree for the current jsii input model. + // This is later used to output the csproj + public namespaceDependencies: Map = new Map(); + + private readonly findModule: FindModuleCallback; + private readonly findType: FindTypeCallback; + private readonly assembly: spec.Assembly; + private nameutils: DotNetNameUtils = new DotNetNameUtils(); + + constructor(assembly: spec.Assembly, + findModule: FindModuleCallback, + findType: FindTypeCallback) { + this.assembly = assembly; + this.findModule = findModule; + this.findType = findType; + } + + /** + * Translates a type fqn to a native .NET full type + */ + public toNativeFqn(fqn: string): string { + const type = this.findType(fqn); + let typeName: string = ''; + switch (type.kind) { + case spec.TypeKind.Interface: + typeName = this.nameutils.convertInterfaceName(type.name); + break; + case spec.TypeKind.Class: + typeName = this.nameutils.convertClassName(type as spec.ClassType); + break; + case spec.TypeKind.Enum: + typeName = this.nameutils.convertTypeName(type.name); + break; + default: + throw new Error('Unknown type: ' + type); + } + const [mod] = fqn.split('.'); + const depMod = this.findModule(mod); + const dotnetNamespace = depMod.targets && depMod.targets.dotnet && depMod.targets.dotnet.namespace; + if (!dotnetNamespace) { + throw new Error(`The module does not have a dotnet.namespace setting`); + } + if (type.namespace) { + // If the type is declared in an additional namespace. + const namespaceFqn = `${this.assembly.name}.${type.namespace}`; + const associatedNamespace = this.assembly.types && this.assembly.types[namespaceFqn]; + if (associatedNamespace) { + // Checking if there is a C# type associated with this namespace, in case we need to slugify it + const actualNamespace = this.toDotNetType(this.findType(namespaceFqn)); + return `${actualNamespace}.${typeName}`; + } + return `${dotnetNamespace}.${type.namespace}.${typeName}`; + } else { + // When undefined, the type is located at the root of the assembly + return `${dotnetNamespace}.${typeName}`; + } + + } + + /** + * Resolves the namespaces dependencies by looking at the .jsii model + */ + public resolveNamespacesDependencies(): void { + const assmDependencies = this.assembly.dependencies || {}; + for (const depName of Object.keys(assmDependencies)) { + const depInfo = assmDependencies[depName]; + if (!this.namespaceDependencies.has(depName)) { + const dotnetInfo = depInfo.targets!.dotnet; + const namespace = dotnetInfo!.namespace; + const packageId = dotnetInfo!.packageId; + let version = depInfo.version; + const suffix = depInfo.targets!.dotnet!.versionSuffix; + if (suffix) { + // suffix is guaranteed to start with a leading `-` + version = `${depInfo.version}${suffix}`; + } + this.namespaceDependencies.set(depName, new DotNetDependency(namespace, packageId, depName, version)); + } + } + } + + /** + * Loops through the implemented interfaces and returns the fully qualified .NET types of the interfaces + * + */ + public resolveImplementedInterfaces(ifc: spec.InterfaceType | spec.ClassType): string[] { + const interfaces = ifc.interfaces || []; + const baseTypeNames: string[] = []; + + // For all base members + for (const base of interfaces) { + const interfaceFullType = this.toNativeFqn(base); + baseTypeNames.push(interfaceFullType); + } + return baseTypeNames; + } + + /** + * Translates any jsii type to its corresponding .NET type + */ + public toDotNetType(typeref: spec.TypeReference): string { + if (spec.isPrimitiveTypeReference(typeref)) { + return this.toDotNetPrimitive(typeref.primitive); + } else if (spec.isCollectionTypeReference(typeref)) { + return this.toDotNetCollection(typeref); + } else if (spec.isNamedTypeReference(typeref)) { + return this.toNativeFqn(typeref.fqn); + } else if (typeref.union) { + return "object"; + } else { + throw new Error('Invalid type reference: ' + JSON.stringify(typeref)); + } + } + + /** + * Translates a primitive in jsii to a native .NET primitive + */ + private toDotNetPrimitive(primitive: spec.PrimitiveType): string { + switch (primitive) { + case spec.PrimitiveType.Boolean: + return 'bool'; + case spec.PrimitiveType.Date: + return 'System.DateTime'; + case spec.PrimitiveType.Json: + return 'Newtonsoft.Json.Linq.JObject'; + case spec.PrimitiveType.Number: + return 'double'; + case spec.PrimitiveType.String: + return 'string'; + case spec.PrimitiveType.Any: + return 'object'; + default: + throw new Error('Unknown primitive type: ' + primitive); + } + } + + /** + * Translates a collection in jsii to a native .NET collection + */ + private toDotNetCollection(ref: spec.CollectionTypeReference): string { + const elementDotNetType = this.toDotNetType(ref.collection.elementtype); + switch (ref.collection.kind) { + case spec.CollectionKind.Array: + return `${elementDotNetType}[]`; + case spec.CollectionKind.Map: + return `System.Collections.Generic.IDictionary`; + default: + throw new Error(`Unsupported collection kind: ${ref.collection.kind}`); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/lib/targets/dotnet/filegenerator.ts b/packages/jsii-pacmak/lib/targets/dotnet/filegenerator.ts new file mode 100644 index 0000000000..0b9a291e2c --- /dev/null +++ b/packages/jsii-pacmak/lib/targets/dotnet/filegenerator.ts @@ -0,0 +1,147 @@ +import {CodeMaker} from "codemaker"; +import {Assembly} from "jsii-spec"; +import path = require('path'); +import xmlbuilder = require('xmlbuilder'); +import logging = require('../../logging'); +import {DotNetNameUtils} from "./nameutils"; + +// Represents a dependency in the dependency tree. +export class DotNetDependency { + public namespace: string; + public packageId: string; + public fqn: string; + public version: string; + + constructor(namespace: string, packageId: string, fqn: string, version: string) { + this.namespace = namespace; + this.packageId = packageId; + this.fqn = fqn; + this.version = version; + } +} + +// Generates misc files such as the .csproj and the AssemblyInfo.cs file +// Uses the same instance of CodeMaker as the rest of the code so that the files get created when calling the save() method +export class FileGenerator { + + private assm: Assembly; + private tarballFileName: string; + private code: CodeMaker; + private assemblyInfoNamespaces: string[] = ["Amazon.JSII.Runtime.Deputy"]; + private nameutils: DotNetNameUtils = new DotNetNameUtils(); + + // We pass in an instance of CodeMaker so that the files get later saved + // when calling the save() method on the .NET Generator. + constructor(assm: Assembly, tarballFileName: string, code: CodeMaker) { + this.assm = assm; + this.tarballFileName = tarballFileName; + this.code = code; + } + + // Generates the .csproj file + public generateProjectFile(dependencies: Map) { + const assembly = this.assm; + const packageId: string = assembly.targets!.dotnet!.packageId; + + const projectFilePath: string = path.join(packageId, `${packageId}.csproj`); + + // Construct XML csproj content. + // headless removes the head node so that the first node is the node + const rootNode = xmlbuilder.create('Project', {encoding: 'UTF-8', headless: true}); + rootNode.att("Sdk", "Microsoft.NET.Sdk"); + const propertyGroup = rootNode.ele("PropertyGroup"); + propertyGroup.ele("TargetFramework", "netstandard2.0"); + propertyGroup.ele("GeneratePackageOnBuild", "true"); + propertyGroup.ele("IncludeSymbols", "true"); + propertyGroup.ele("IncludeSource", "true"); + propertyGroup.ele("PackageVersion", this.getDecoratedVersion(assembly)); + propertyGroup.ele("PackageId", packageId); + propertyGroup.ele("Description", this.getDescription()); + propertyGroup.ele("ProjectUrl", assembly.homepage); + propertyGroup.ele("LicenseUrl", `https://spdx.org/licenses/${assembly.license}.html`); + propertyGroup.ele("Authors", assembly.author.name); + propertyGroup.ele("Language", "en-US"); + + const dotnetInfo = assembly.targets!.dotnet; + if (dotnetInfo!.title != null) { + propertyGroup.ele("Title", dotnetInfo!.title); + } + + if (dotnetInfo!.signAssembly != null) { + const signAssembly = propertyGroup.ele("SignAssembly"); + signAssembly.att("Condition", `Exists('${dotnetInfo!.assemblyOriginatorKeyFile}')`); + } + + if (dotnetInfo!.assemblyOriginatorKeyFile != null) { + propertyGroup.ele("AssemblyOriginatorKeyFile", dotnetInfo!.assemblyOriginatorKeyFile); + } + + if (dotnetInfo!.iconUrl != null) { + propertyGroup.ele("IconUrl", dotnetInfo!.iconUrl); + } + + const itemGroup1 = rootNode.ele("ItemGroup"); + const embeddedResource = itemGroup1.ele("EmbeddedResource"); + embeddedResource.att("Include", this.tarballFileName); + + const itemGroup2 = rootNode.ele("ItemGroup"); + const packageReference = itemGroup2.ele("PackageReference"); + packageReference.att("Include", "Amazon.JSII.Runtime"); + + // Strip " (build abcdef)" from the jsii version + const jsiiVersionSimple = assembly.jsiiVersion.replace(/ .*$/, ''); + packageReference.att("Version", jsiiVersionSimple); + + dependencies.forEach((value: DotNetDependency) => { + const dependencyReference = itemGroup2.ele("PackageReference"); + dependencyReference.att("Include", value.packageId); + dependencyReference.att("Version", value.version); + }); + + const xml = rootNode.end({pretty: true}); + + // Sending the xml content to the codemaker to ensure the file is written + // and added to the file list for tracking + this.code.openFile(projectFilePath); + this.code.open(xml); + // Unindent for the next file + this.code.close(); + this.code.closeFile(projectFilePath); + + logging.debug(`Written to ${projectFilePath}`); + } + + // Generates the AssemblyInfo.cs file + public generateAssemblyInfoFile() { + const packageId: string = this.assm.targets!.dotnet!.packageId; + const filePath: string = path.join(packageId, `AssemblyInfo.cs`); + this.code.openFile(filePath); + this.assemblyInfoNamespaces.map(n => this.code.line(`using ${n};`)); + this.code.line(); + const assembly = `[assembly: JsiiAssembly("${this.assm.name}", "${this.assm.version}", "${this.tarballFileName}")]`; + this.code.line(assembly); + this.code.closeFile(filePath); + } + + // Generates the description + private getDescription(): string { + const docs = this.assm.docs; + if (docs) { + const stability = docs.stability; + if (stability) { + return `${this.assm.description} (Stability: ${this.nameutils.capitalizeWord(stability)})`; + } + } + return this.assm.description; + } + + // Generates the decorated version + private getDecoratedVersion(assembly: Assembly): string { + const suffix = assembly.targets!.dotnet!.versionSuffix; + if (suffix) { + // suffix is guaranteed to start with a leading `-` + return `${assembly.version}${suffix}`; + } + return assembly.version; + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/lib/targets/dotnet/nameutils.ts b/packages/jsii-pacmak/lib/targets/dotnet/nameutils.ts new file mode 100644 index 0000000000..032e64c4fe --- /dev/null +++ b/packages/jsii-pacmak/lib/targets/dotnet/nameutils.ts @@ -0,0 +1,123 @@ +import { default as camelcase } from 'camelcase'; +import * as spec from 'jsii-spec'; + +export class DotNetNameUtils { + + public convertPropertyName(original: string) { + if (this.isInvalidName(original)) { + throw new Error(`Invalid property name: ${original}`); + } + return this.capitalizeWord(original); + } + + public convertTypeName(original: string) { + if (this.isInvalidName(original)) { + throw new Error(`Invalid type name: ${original}`); + } + return this.capitalizeWord(original); + } + + public convertMethodName(original: string) { + if (this.isInvalidName(original)) { + throw new Error(`Invalid method name: ${original}`); + } + return this.capitalizeWord(original); + } + + public convertEnumMemberName(original: string) { + if (this.isInvalidName(original)) { + throw new Error(`Invalid enum member name: ${original}`); + } + return this.capitalizeWord(original); + } + + public convertInterfaceName(original: string) { + if (this.isInvalidName(original)) { + throw new Error(`Invalid interface name: ${original}`); + } + const capitalizedName = this.capitalizeWord(original); + return 'I' + capitalizedName; + } + + public convertClassName(original: spec.ClassType) { + if (this.isInvalidName(original.name)) { + throw new Error(`Invalid class name: ${original}`); + } + // Tentatively get the class name + let name = this.capitalizeWord(original.name); + if (original.methods) { + original.methods.forEach((method) => { + if (method.name.toLowerCase() === original.name.toLowerCase()) { + // This class has a member with the same name, need to slugify the class name + name = this.capitalizeWord(this.slugify(original.name)); + } + }); + } + if (original.properties) { + original.properties.forEach((property) => { + if (property.name.toLowerCase() === original.name.toLowerCase()) { + // This class has a member with the same name, need to slugify the class name + name = this.capitalizeWord(this.slugify(original.name)); + } + }); + } + + return name; + } + + public convertPackageName(original: string) { + if (this.isInvalidName(original)) { + throw new Error(`Invalid package name: ${original}`); + } + return original.split("-").map((s: string) => this.capitalizeWord(s)).join("."); + } + + public convertParameterName(original: string) { + if (this.isInvalidName(original)) { + throw new Error(`Invalid parameter name: ${original}`); + } + const name = camelcase(original); + return this.escapeParameterName(name); + } + + public capitalizeWord(original: string) { + return original.charAt(0).toUpperCase() + original.slice(1); + } + + /* We only want valid names for members */ + private isInvalidName(str: string) { + // Can not be empty, or contains $ + // Can only start with a letter or an underscore + return str === null || str.match(/^\s*$/) !== null || str.indexOf('$') >= 0 || !str.match(/^[A-Za-z_]/); + } + + private escapeParameterName(name: string): string { + if (!name) { + return name; + } + if (RESERVED_KEYWORDS.includes(name)) { + return `@${name}`; + } else { + return name; + } + } + + private slugify(name: string): string { + if (!name) { + return name; + } + return `${name}_`; + } +} + +// Pulled from https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/ +const RESERVED_KEYWORDS = [ + // For some reason the old generator does not slugify the keyword base? + 'abstract', 'as', 'base', 'bool', 'break', 'byte', 'case', 'catch', 'char', 'checked', 'class', + 'const', 'continue', 'decimal', 'default', 'delegate', 'double', 'do', 'else', 'enum', 'event', 'explicit', + 'extern', 'false', 'finally', 'fixed', 'float', 'for', 'foreach', 'goto', 'if', 'implicit', 'in', + 'int', 'interface', 'internal', 'is', 'lock', 'long', 'namespace', 'new', 'null', 'object', 'operator', 'out', + 'override', 'params', 'private', 'protected', 'public', 'readonly', 'ref', 'return', 'sbyte', 'sealed', 'short', + 'sizeof', 'stackalloc', 'static', 'string', 'struct', 'switch', 'this', 'throw', 'true', 'try', 'typeof', 'uint', + 'ulong', 'unchecked', 'unsafe', 'ushort', 'using', 'value', 'virtual', 'void', 'volatile', 'while' +]; \ No newline at end of file diff --git a/packages/jsii-pacmak/package.json b/packages/jsii-pacmak/package.json index fe6dd13fc9..9434d9c487 100644 --- a/packages/jsii-pacmak/package.json +++ b/packages/jsii-pacmak/package.json @@ -43,7 +43,6 @@ "@types/yargs": "^13.0.1", "jsii-build-tools": "file:../jsii-build-tools", "jsii-calc": "file:../jsii-calc", - "jsii-dotnet-generator": "file:../jsii-dotnet-generator", "jsii-dotnet-jsonmodel": "file:../jsii-dotnet-jsonmodel", "jsii-dotnet-runtime": "file:../jsii-dotnet-runtime", "jsii-java-runtime": "file:../jsii-java-runtime", diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId.csproj b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId.csproj index 0e51828da5..1059552dc9 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId.csproj +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId.csproj @@ -13,10 +13,11 @@ en-US - + - - + + - \ No newline at end of file + + diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/Base.cs b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/Base.cs index 5e59669e18..ad4404504f 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/Base.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/Base.cs @@ -3,7 +3,7 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace { /// A base class. - [JsiiClass(nativeType: typeof(Base), fullyQualifiedName: "@scope/jsii-calc-base.Base")] + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.Base), fullyQualifiedName: "@scope/jsii-calc-base.Base")] public abstract class Base : DeputyBase { protected Base(): base(new DeputyProps(new object[]{})) @@ -18,11 +18,13 @@ protected Base(DeputyProps props): base(props) { } - /// the name of the class (to verify native type names are created for derived classes). + /// + /// the name of the class (to verify native type names are created for derived classes). + /// [JsiiMethod(name: "typeName", returnsJson: "{\"type\":{\"primitive\":\"any\"}}")] public virtual object TypeName() { return InvokeInstanceMethod(new object[]{}); } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/BaseProps.cs b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/BaseProps.cs index 7a395875d8..22330e864e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/BaseProps.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/BaseProps.cs @@ -19,4 +19,4 @@ public Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace.Very Foo set; } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/BasePropsProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/BasePropsProxy.cs index fbd4167172..72db0f04ec 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/BasePropsProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/BasePropsProxy.cs @@ -21,4 +21,4 @@ public Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace.Very Foo get => GetInstanceProperty(); } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/BaseProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/BaseProxy.cs index 72d1295922..31c2ab627b 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/BaseProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/BaseProxy.cs @@ -3,11 +3,11 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace { /// A base class. - [JsiiTypeProxy(nativeType: typeof(Base), fullyQualifiedName: "@scope/jsii-calc-base.Base")] + [JsiiTypeProxy(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.Base), fullyQualifiedName: "@scope/jsii-calc-base.Base")] internal sealed class BaseProxy : Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.Base { private BaseProxy(ByRefValue reference): base(reference) { } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/IBaseInterfaceProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/IBaseInterfaceProxy.cs index 9fb65f6450..6cd231e3a5 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/IBaseInterfaceProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/IBaseInterfaceProxy.cs @@ -21,4 +21,4 @@ public void Foo() InvokeInstanceVoidMethod(new object[]{}); } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/IBaseProps.cs b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/IBaseProps.cs index c311dc9f7e..802b27ca7b 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/IBaseProps.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/IBaseProps.cs @@ -11,4 +11,4 @@ string Bar get; } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/IIBaseInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/IIBaseInterface.cs index fd94a8eaff..274d9497d3 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/IIBaseInterface.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/IIBaseInterface.cs @@ -8,4 +8,4 @@ public interface IIBaseInterface : Amazon.JSII.Tests.CalculatorNamespace.BaseOfB [JsiiMethod(name: "bar")] void Bar(); } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/Internal/DependencyResolution/Anchor.cs b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/Internal/DependencyResolution/Anchor.cs index c11dfffe04..d6e680cb86 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/Internal/DependencyResolution/Anchor.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/Internal/DependencyResolution/Anchor.cs @@ -7,4 +7,4 @@ public Anchor() new Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace.Internal.DependencyResolution.Anchor(); } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/AssemblyInfo.cs b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/AssemblyInfo.cs index 4781fb715d..e3b8122589 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/AssemblyInfo.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/AssemblyInfo.cs @@ -1,3 +1,3 @@ using Amazon.JSII.Runtime.Deputy; -[assembly: JsiiAssembly("@scope/jsii-calc-base", "0.14.2", "scope-jsii-calc-base-0.14.2.tgz")] \ No newline at end of file +[assembly: JsiiAssembly("@scope/jsii-calc-base", "0.14.2", "scope-jsii-calc-base-0.14.2.tgz")] 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 12a3116348..3b9aab9835 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 @@ -13,10 +13,11 @@ en-US - + - - + + - \ No newline at end of file + + diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/EnumFromScopedModule.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/EnumFromScopedModule.cs index 7a826db1f3..35b8cea5bd 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/EnumFromScopedModule.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/EnumFromScopedModule.cs @@ -3,18 +3,24 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace { /// Check that enums from \@scoped packages can be references. See awslabs/jsii#138. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiEnum(nativeType: typeof(EnumFromScopedModule), fullyQualifiedName: "@scope/jsii-calc-lib.EnumFromScopedModule")] [System.Obsolete()] public enum EnumFromScopedModule { - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiEnumMember(name: "VALUE1")] [System.Obsolete()] VALUE1, - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiEnumMember(name: "VALUE2")] [System.Obsolete()] VALUE2 } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IDoublableProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IDoublableProxy.cs index 9ea5f29aa5..6800b339a7 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IDoublableProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IDoublableProxy.cs @@ -3,7 +3,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace { /// The general contract for a concrete number. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiTypeProxy(nativeType: typeof(IIDoublable), fullyQualifiedName: "@scope/jsii-calc-lib.IDoublable")] [System.Obsolete()] internal sealed class IDoublableProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IIDoublable @@ -12,7 +14,9 @@ private IDoublableProxy(ByRefValue reference): base(reference) { } - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "doubleValue", typeJson: "{\"primitive\":\"number\"}")] [System.Obsolete()] public double DoubleValue @@ -20,4 +24,4 @@ public double DoubleValue get => GetInstanceProperty(); } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IFriendlyProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IFriendlyProxy.cs index 9164f725c6..892ea3c811 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IFriendlyProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IFriendlyProxy.cs @@ -17,7 +17,9 @@ private IFriendlyProxy(ByRefValue reference): base(reference) } /// Say hello! - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiMethod(name: "hello", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] [System.Obsolete()] public string Hello() @@ -25,4 +27,4 @@ public string Hello() return InvokeInstanceMethod(new object[]{}); } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IIDoublable.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IIDoublable.cs index 060cd23cd2..9e2681f4ea 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IIDoublable.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IIDoublable.cs @@ -3,12 +3,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace { /// The general contract for a concrete number. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiInterface(nativeType: typeof(IIDoublable), fullyQualifiedName: "@scope/jsii-calc-lib.IDoublable")] [System.Obsolete()] public interface IIDoublable { - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "doubleValue", typeJson: "{\"primitive\":\"number\"}")] [System.Obsolete()] double DoubleValue @@ -16,4 +20,4 @@ double DoubleValue get; } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IIFriendly.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IIFriendly.cs index 7e44fba770..6adbb6085a 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IIFriendly.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IIFriendly.cs @@ -13,9 +13,11 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace public interface IIFriendly { /// Say hello! - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiMethod(name: "hello", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] [System.Obsolete()] string Hello(); } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IIThreeLevelsInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IIThreeLevelsInterface.cs index e786698770..ef9443e530 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IIThreeLevelsInterface.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IIThreeLevelsInterface.cs @@ -12,9 +12,11 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace [System.Obsolete()] public interface IIThreeLevelsInterface : Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.IIBaseInterface { - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiMethod(name: "baz")] [System.Obsolete()] void Baz(); } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IMyFirstStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IMyFirstStruct.cs index acdf9dded9..f5681f0998 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IMyFirstStruct.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IMyFirstStruct.cs @@ -3,13 +3,17 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace { /// This is the first struct we have created in jsii. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiInterface(nativeType: typeof(IMyFirstStruct), fullyQualifiedName: "@scope/jsii-calc-lib.MyFirstStruct")] [System.Obsolete()] public interface IMyFirstStruct { /// An awesome number value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "anumber", typeJson: "{\"primitive\":\"number\"}")] [System.Obsolete()] double Anumber @@ -18,7 +22,9 @@ double Anumber } /// A string value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "astring", typeJson: "{\"primitive\":\"string\"}")] [System.Obsolete()] string Astring @@ -26,12 +32,14 @@ string Astring get; } - /// stability: Deprecated - [JsiiProperty(name: "firstOptional", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}", isOptional: true)] + /// + /// stability: Deprecated + /// + [JsiiProperty(name: "firstOptional", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"string\"},\"kind\":\"array\"}}", isOptional: true)] [System.Obsolete()] string[] FirstOptional { get; } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IStructWithOnlyOptionals.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IStructWithOnlyOptionals.cs index 6222b814be..23413fa7ef 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IStructWithOnlyOptionals.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IStructWithOnlyOptionals.cs @@ -3,13 +3,17 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace { /// This is a struct with only optional properties. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiInterface(nativeType: typeof(IStructWithOnlyOptionals), fullyQualifiedName: "@scope/jsii-calc-lib.StructWithOnlyOptionals")] [System.Obsolete()] public interface IStructWithOnlyOptionals { /// The first optional! - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "optional1", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] [System.Obsolete()] string Optional1 @@ -17,7 +21,9 @@ string Optional1 get; } - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "optional2", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] [System.Obsolete()] double? Optional2 @@ -25,7 +31,9 @@ string Optional1 get; } - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "optional3", typeJson: "{\"primitive\":\"boolean\"}", isOptional: true)] [System.Obsolete()] bool? Optional3 @@ -33,4 +41,4 @@ string Optional1 get; } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IThreeLevelsInterfaceProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IThreeLevelsInterfaceProxy.cs index 9f72a3b495..44d5ba9fec 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IThreeLevelsInterfaceProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/IThreeLevelsInterfaceProxy.cs @@ -16,7 +16,9 @@ private IThreeLevelsInterfaceProxy(ByRefValue reference): base(reference) { } - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiMethod(name: "baz")] [System.Obsolete()] public void Baz() @@ -36,4 +38,4 @@ public void Foo() InvokeInstanceVoidMethod(new object[]{}); } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Internal/DependencyResolution/Anchor.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Internal/DependencyResolution/Anchor.cs index a12334cc09..cdded93e05 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Internal/DependencyResolution/Anchor.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Internal/DependencyResolution/Anchor.cs @@ -7,4 +7,4 @@ public Anchor() new Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.Internal.DependencyResolution.Anchor(); } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/MyFirstStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/MyFirstStruct.cs index 918ee1b628..c36847573d 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/MyFirstStruct.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/MyFirstStruct.cs @@ -3,12 +3,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace { /// This is the first struct we have created in jsii. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiByValue] public class MyFirstStruct : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IMyFirstStruct { /// An awesome number value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "anumber", typeJson: "{\"primitive\":\"number\"}", isOverride: true)] [System.Obsolete()] public double Anumber @@ -18,7 +22,9 @@ public double Anumber } /// A string value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "astring", typeJson: "{\"primitive\":\"string\"}", isOverride: true)] [System.Obsolete()] public string Astring @@ -27,8 +33,10 @@ public string Astring set; } - /// stability: Deprecated - [JsiiProperty(name: "firstOptional", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}", isOptional: true, isOverride: true)] + /// + /// stability: Deprecated + /// + [JsiiProperty(name: "firstOptional", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"string\"},\"kind\":\"array\"}}", isOptional: true, isOverride: true)] [System.Obsolete()] public string[] FirstOptional { @@ -36,4 +44,4 @@ public string[] FirstOptional set; } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/MyFirstStructProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/MyFirstStructProxy.cs index 0bca4479a1..8c15dae980 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/MyFirstStructProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/MyFirstStructProxy.cs @@ -3,7 +3,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace { /// This is the first struct we have created in jsii. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiTypeProxy(nativeType: typeof(IMyFirstStruct), fullyQualifiedName: "@scope/jsii-calc-lib.MyFirstStruct")] [System.Obsolete()] internal sealed class MyFirstStructProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IMyFirstStruct @@ -13,7 +15,9 @@ private MyFirstStructProxy(ByRefValue reference): base(reference) } /// An awesome number value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "anumber", typeJson: "{\"primitive\":\"number\"}")] [System.Obsolete()] public double Anumber @@ -22,7 +26,9 @@ public double Anumber } /// A string value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "astring", typeJson: "{\"primitive\":\"string\"}")] [System.Obsolete()] public string Astring @@ -30,12 +36,14 @@ public string Astring get => GetInstanceProperty(); } - /// stability: Deprecated - [JsiiProperty(name: "firstOptional", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}", isOptional: true)] + /// + /// stability: Deprecated + /// + [JsiiProperty(name: "firstOptional", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"string\"},\"kind\":\"array\"}}", isOptional: true)] [System.Obsolete()] public string[] FirstOptional { get => GetInstanceProperty(); } } -} \ No newline at end of file +} 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 0c09e4fd8a..1e1c4c9926 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 @@ -3,16 +3,20 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace { /// Represents a concrete number. - /// stability: Deprecated - [JsiiClass(nativeType: typeof(Number), fullyQualifiedName: "@scope/jsii-calc-lib.Number", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"number\"}}]")] + /// + /// stability: Deprecated + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Number), fullyQualifiedName: "@scope/jsii-calc-lib.Number", parametersJson: "[{\"docs\":{\"summary\":\"The number.\"},\"name\":\"value\",\"type\":{\"primitive\":\"number\"}}]")] [System.Obsolete()] public class Number : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IIDoublable { /// Creates a Number object. - /// The number. - /// stability: Deprecated + /// The number. + /// + /// stability: Deprecated + /// [System.Obsolete()] - public Number(double value): base(new DeputyProps(new object[]{value})) + public Number(double @value): base(new DeputyProps(new object[]{@value})) { } @@ -27,7 +31,9 @@ protected Number(DeputyProps props): base(props) } /// The number multiplied by 2. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "doubleValue", typeJson: "{\"primitive\":\"number\"}")] [System.Obsolete()] public virtual double DoubleValue @@ -36,7 +42,9 @@ public virtual double DoubleValue } /// The number. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"number\"}")] [System.Obsolete()] public override double Value @@ -44,4 +52,4 @@ public override double Value get => GetInstanceProperty(); } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Operation.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Operation.cs index 6143c39cbb..8d1e82f99c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Operation.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Operation.cs @@ -3,8 +3,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace { /// Represents an operation on values. - /// stability: Deprecated - [JsiiClass(nativeType: typeof(Operation), fullyQualifiedName: "@scope/jsii-calc-lib.Operation")] + /// + /// stability: Deprecated + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Operation), fullyQualifiedName: "@scope/jsii-calc-lib.Operation")] [System.Obsolete()] public abstract class Operation : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ { @@ -21,9 +23,12 @@ protected Operation(DeputyProps props): base(props) } /// String representation of the value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiMethod(name: "toString", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] [System.Obsolete()] public override abstract string ToString(); + } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/OperationProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/OperationProxy.cs index e32dfd5bc8..86bbc6ba78 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/OperationProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/OperationProxy.cs @@ -3,8 +3,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace { /// Represents an operation on values. - /// stability: Deprecated - [JsiiTypeProxy(nativeType: typeof(Operation), fullyQualifiedName: "@scope/jsii-calc-lib.Operation")] + /// + /// stability: Deprecated + /// + [JsiiTypeProxy(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Operation), fullyQualifiedName: "@scope/jsii-calc-lib.Operation")] [System.Obsolete()] internal sealed class OperationProxy : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Operation { @@ -13,7 +15,9 @@ private OperationProxy(ByRefValue reference): base(reference) } /// The value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"number\"}")] [System.Obsolete()] public override double Value @@ -22,7 +26,9 @@ public override double Value } /// String representation of the value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiMethod(name: "toString", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] [System.Obsolete()] public override string ToString() @@ -30,4 +36,4 @@ public override string ToString() return InvokeInstanceMethod(new object[]{}); } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/StructWithOnlyOptionals.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/StructWithOnlyOptionals.cs index e0c1651089..d82c4b4553 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/StructWithOnlyOptionals.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/StructWithOnlyOptionals.cs @@ -3,12 +3,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace { /// This is a struct with only optional properties. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiByValue] public class StructWithOnlyOptionals : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IStructWithOnlyOptionals { /// The first optional! - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "optional1", typeJson: "{\"primitive\":\"string\"}", isOptional: true, isOverride: true)] [System.Obsolete()] public string Optional1 @@ -17,7 +21,9 @@ public string Optional1 set; } - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "optional2", typeJson: "{\"primitive\":\"number\"}", isOptional: true, isOverride: true)] [System.Obsolete()] public double? Optional2 @@ -26,7 +32,9 @@ public double? Optional2 set; } - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "optional3", typeJson: "{\"primitive\":\"boolean\"}", isOptional: true, isOverride: true)] [System.Obsolete()] public bool? Optional3 @@ -35,4 +43,4 @@ public bool? Optional3 set; } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/StructWithOnlyOptionalsProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/StructWithOnlyOptionalsProxy.cs index 2bd20233df..2034bc7b4c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/StructWithOnlyOptionalsProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/StructWithOnlyOptionalsProxy.cs @@ -3,7 +3,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace { /// This is a struct with only optional properties. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiTypeProxy(nativeType: typeof(IStructWithOnlyOptionals), fullyQualifiedName: "@scope/jsii-calc-lib.StructWithOnlyOptionals")] [System.Obsolete()] internal sealed class StructWithOnlyOptionalsProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IStructWithOnlyOptionals @@ -13,7 +15,9 @@ private StructWithOnlyOptionalsProxy(ByRefValue reference): base(reference) } /// The first optional! - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "optional1", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] [System.Obsolete()] public string Optional1 @@ -21,20 +25,24 @@ public string Optional1 get => GetInstanceProperty(); } - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "optional2", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] [System.Obsolete()] public double? Optional2 { - get => GetInstanceProperty(); + get => GetInstanceProperty(); } - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "optional3", typeJson: "{\"primitive\":\"boolean\"}", isOptional: true)] [System.Obsolete()] public bool? Optional3 { - get => GetInstanceProperty(); + get => GetInstanceProperty(); } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/ValueProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/ValueProxy.cs index 37d2e262d4..0fa20deecb 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/ValueProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/ValueProxy.cs @@ -3,8 +3,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace { /// Abstract class which represents a numeric value. - /// stability: Deprecated - [JsiiTypeProxy(nativeType: typeof(Value_), fullyQualifiedName: "@scope/jsii-calc-lib.Value")] + /// + /// stability: Deprecated + /// + [JsiiTypeProxy(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_), fullyQualifiedName: "@scope/jsii-calc-lib.Value")] [System.Obsolete()] internal sealed class ValueProxy : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ { @@ -13,7 +15,9 @@ private ValueProxy(ByRefValue reference): base(reference) } /// The value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"number\"}")] [System.Obsolete()] public override double Value @@ -21,4 +25,4 @@ public override double Value get => GetInstanceProperty(); } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Value_.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Value_.cs index c641278db1..43a6e2c2cd 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Value_.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Value_.cs @@ -3,8 +3,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace { /// Abstract class which represents a numeric value. - /// stability: Deprecated - [JsiiClass(nativeType: typeof(Value_), fullyQualifiedName: "@scope/jsii-calc-lib.Value")] + /// + /// stability: Deprecated + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_), fullyQualifiedName: "@scope/jsii-calc-lib.Value")] [System.Obsolete()] public abstract class Value_ : Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.Base { @@ -20,22 +22,26 @@ protected Value_(DeputyProps props): base(props) { } - /// The value. - /// stability: Deprecated - [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"number\"}")] - [System.Obsolete()] - public virtual double Value - { - get => GetInstanceProperty(); - } - /// String representation of the value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiMethod(name: "toString", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] [System.Obsolete()] public override string ToString() { return InvokeInstanceMethod(new object[]{}); } + + /// The value. + /// + /// stability: Deprecated + /// + [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"number\"}")] + [System.Obsolete()] + public virtual double Value + { + get => GetInstanceProperty(); + } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/AssemblyInfo.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/AssemblyInfo.cs index ff660db434..1a952b9875 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/AssemblyInfo.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/AssemblyInfo.cs @@ -1,3 +1,3 @@ using Amazon.JSII.Runtime.Deputy; -[assembly: JsiiAssembly("@scope/jsii-calc-lib", "0.14.2", "scope-jsii-calc-lib-0.14.2.tgz")] \ No newline at end of file +[assembly: JsiiAssembly("@scope/jsii-calc-lib", "0.14.2", "scope-jsii-calc-lib-0.14.2.tgz")] 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 a7121b048a..1b61b05128 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 @@ -13,12 +13,13 @@ en-US - + - - - - + + + + - \ 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/AbstractClass.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AbstractClass.cs index 4a456c8616..268f0f5456 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AbstractClass.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AbstractClass.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(AbstractClass), fullyQualifiedName: "jsii-calc.AbstractClass")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AbstractClass), fullyQualifiedName: "jsii-calc.AbstractClass")] public abstract class AbstractClass : Amazon.JSII.Tests.CalculatorNamespace.AbstractClassBase, Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceImplementedByAbstractClass { protected AbstractClass(): base(new DeputyProps(new object[]{})) @@ -18,21 +20,29 @@ protected AbstractClass(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiProperty(name: "propFromInterface", typeJson: "{\"primitive\":\"string\"}")] - public virtual string PropFromInterface - { - get => GetInstanceProperty(); - } - - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "abstractMethod", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"name\",\"type\":{\"primitive\":\"string\"}}]")] public abstract string AbstractMethod(string name); - /// stability: Experimental + + + /// + /// stability: Experimental + /// [JsiiMethod(name: "nonAbstractMethod", returnsJson: "{\"type\":{\"primitive\":\"number\"}}")] public virtual double NonAbstractMethod() { return InvokeInstanceMethod(new object[]{}); } + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "propFromInterface", typeJson: "{\"primitive\":\"string\"}")] + public virtual string PropFromInterface + { + 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/AbstractClassBase.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AbstractClassBase.cs index 3310d35533..1ed4b36d21 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AbstractClassBase.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AbstractClassBase.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(AbstractClassBase), fullyQualifiedName: "jsii-calc.AbstractClassBase")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AbstractClassBase), fullyQualifiedName: "jsii-calc.AbstractClassBase")] public abstract class AbstractClassBase : DeputyBase { protected AbstractClassBase(): base(new DeputyProps(new object[]{})) @@ -18,11 +20,13 @@ protected AbstractClassBase(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "abstractProperty", typeJson: "{\"primitive\":\"string\"}")] public virtual string AbstractProperty { 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/AbstractClassBaseProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AbstractClassBaseProxy.cs index 51f30c088e..a5f0ed8f29 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AbstractClassBaseProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AbstractClassBaseProxy.cs @@ -2,19 +2,23 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiTypeProxy(nativeType: typeof(AbstractClassBase), fullyQualifiedName: "jsii-calc.AbstractClassBase")] + /// + /// stability: Experimental + /// + [JsiiTypeProxy(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AbstractClassBase), fullyQualifiedName: "jsii-calc.AbstractClassBase")] internal sealed class AbstractClassBaseProxy : Amazon.JSII.Tests.CalculatorNamespace.AbstractClassBase { private AbstractClassBaseProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "abstractProperty", typeJson: "{\"primitive\":\"string\"}")] public override string AbstractProperty { 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/AbstractClassProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AbstractClassProxy.cs index a6a7c196a5..68a152223c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AbstractClassProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AbstractClassProxy.cs @@ -2,26 +2,32 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiTypeProxy(nativeType: typeof(AbstractClass), fullyQualifiedName: "jsii-calc.AbstractClass")] + /// + /// stability: Experimental + /// + [JsiiTypeProxy(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AbstractClass), fullyQualifiedName: "jsii-calc.AbstractClass")] internal sealed class AbstractClassProxy : Amazon.JSII.Tests.CalculatorNamespace.AbstractClass { private AbstractClassProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "abstractProperty", typeJson: "{\"primitive\":\"string\"}")] public override string AbstractProperty { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "abstractMethod", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"name\",\"type\":{\"primitive\":\"string\"}}]")] public override string AbstractMethod(string name) { return InvokeInstanceMethod(new object[]{name}); } } -} \ 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/AbstractClassReturner.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AbstractClassReturner.cs index abe4c22eb4..015d1c806a 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AbstractClassReturner.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AbstractClassReturner.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(AbstractClassReturner), fullyQualifiedName: "jsii-calc.AbstractClassReturner")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AbstractClassReturner), fullyQualifiedName: "jsii-calc.AbstractClassReturner")] public class AbstractClassReturner : DeputyBase { public AbstractClassReturner(): base(new DeputyProps(new object[]{})) @@ -18,25 +20,31 @@ protected AbstractClassReturner(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiProperty(name: "returnAbstractFromProperty", typeJson: "{\"fqn\":\"jsii-calc.AbstractClassBase\"}")] - public virtual Amazon.JSII.Tests.CalculatorNamespace.AbstractClassBase ReturnAbstractFromProperty - { - get => GetInstanceProperty(); - } - - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "giveMeAbstract", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.AbstractClass\"}}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.AbstractClass GiveMeAbstract() { return InvokeInstanceMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "giveMeInterface", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.IInterfaceImplementedByAbstractClass\"}}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceImplementedByAbstractClass GiveMeInterface() { return InvokeInstanceMethod(new object[]{}); } + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "returnAbstractFromProperty", typeJson: "{\"fqn\":\"jsii-calc.AbstractClassBase\"}")] + public virtual Amazon.JSII.Tests.CalculatorNamespace.AbstractClassBase ReturnAbstractFromProperty + { + 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/Add.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Add.cs index de8fe346c2..4cbd82d796 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 @@ -3,14 +3,18 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// The "+" binary operation. - /// stability: Experimental - [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\"}}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Add), fullyQualifiedName: "jsii-calc.Add", parametersJson: "[{\"docs\":{\"summary\":\"Left-hand side operand.\"},\"name\":\"lhs\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}},{\"docs\":{\"summary\":\"Right-hand side operand.\"},\"name\":\"rhs\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}]")] public class Add : Amazon.JSII.Tests.CalculatorNamespace.BinaryOperation { /// Creates a BinaryOperation. /// Left-hand side operand. /// Right-hand side operand. - /// stability: Experimental + /// + /// stability: Experimental + /// public Add(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ lhs, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ rhs): base(new DeputyProps(new object[]{lhs, rhs})) { } @@ -23,20 +27,24 @@ protected Add(DeputyProps props): base(props) { } - /// The value. - /// stability: Experimental - [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"number\"}")] - public override double Value - { - get => GetInstanceProperty(); - } - /// String representation of the value. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "toString", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] public override string ToString() { return InvokeInstanceMethod(new object[]{}); } + + /// The value. + /// + /// stability: Experimental + /// + [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"number\"}")] + public override double Value + { + 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/AllTypes.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AllTypes.cs index 1ef188e3d1..b5b70f1476 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AllTypes.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AllTypes.cs @@ -1,7 +1,4 @@ using Amazon.JSII.Runtime.Deputy; -using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; namespace Amazon.JSII.Tests.CalculatorNamespace { @@ -11,7 +8,7 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// that the value set is of the expected type and throw otherwise. /// stability: Experimental /// - [JsiiClass(nativeType: typeof(AllTypes), fullyQualifiedName: "jsii-calc.AllTypes")] + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AllTypes), fullyQualifiedName: "jsii-calc.AllTypes")] public class AllTypes : DeputyBase { public AllTypes(): base(new DeputyProps(new object[]{})) @@ -26,30 +23,65 @@ protected AllTypes(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// + [JsiiMethod(name: "anyIn", parametersJson: "[{\"name\":\"inp\",\"type\":{\"primitive\":\"any\"}}]")] + public virtual void AnyIn(object inp) + { + InvokeInstanceVoidMethod(new object[]{inp}); + } + + /// + /// stability: Experimental + /// + [JsiiMethod(name: "anyOut", returnsJson: "{\"type\":{\"primitive\":\"any\"}}")] + public virtual object AnyOut() + { + return InvokeInstanceMethod(new object[]{}); + } + + /// + /// stability: Experimental + /// + [JsiiMethod(name: "enumMethod", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.StringEnum\"}}", parametersJson: "[{\"name\":\"value\",\"type\":{\"fqn\":\"jsii-calc.StringEnum\"}}]")] + public virtual Amazon.JSII.Tests.CalculatorNamespace.StringEnum EnumMethod(Amazon.JSII.Tests.CalculatorNamespace.StringEnum @value) + { + return InvokeInstanceMethod(new object[]{@value}); + } + + /// + /// stability: Experimental + /// [JsiiProperty(name: "enumPropertyValue", typeJson: "{\"primitive\":\"number\"}")] public virtual double EnumPropertyValue { get => GetInstanceProperty(); } - /// stability: Experimental - [JsiiProperty(name: "anyArrayProperty", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"any\"}}}")] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "anyArrayProperty", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"any\"},\"kind\":\"array\"}}")] public virtual object[] AnyArrayProperty { get => GetInstanceProperty(); set => SetInstanceProperty(value); } - /// stability: Experimental - [JsiiProperty(name: "anyMapProperty", typeJson: "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"primitive\":\"any\"}}}")] - public virtual IDictionary AnyMapProperty + /// + /// stability: Experimental + /// + [JsiiProperty(name: "anyMapProperty", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"any\"},\"kind\":\"map\"}}")] + public virtual System.Collections.Generic.IDictionary AnyMapProperty { - get => GetInstanceProperty>(); + get => GetInstanceProperty>(); set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "anyProperty", typeJson: "{\"primitive\":\"any\"}")] public virtual object AnyProperty { @@ -57,15 +89,19 @@ public virtual object AnyProperty set => SetInstanceProperty(value); } - /// stability: Experimental - [JsiiProperty(name: "arrayProperty", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}")] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "arrayProperty", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"string\"},\"kind\":\"array\"}}")] public virtual string[] ArrayProperty { get => GetInstanceProperty(); set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "booleanProperty", typeJson: "{\"primitive\":\"boolean\"}")] public virtual bool BooleanProperty { @@ -73,15 +109,19 @@ public virtual bool BooleanProperty set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "dateProperty", typeJson: "{\"primitive\":\"date\"}")] - public virtual DateTime DateProperty + public virtual System.DateTime DateProperty { - get => GetInstanceProperty(); + get => GetInstanceProperty(); set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "enumProperty", typeJson: "{\"fqn\":\"jsii-calc.AllTypesEnum\"}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.AllTypesEnum EnumProperty { @@ -89,23 +129,29 @@ public virtual Amazon.JSII.Tests.CalculatorNamespace.AllTypesEnum EnumProperty set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "jsonProperty", typeJson: "{\"primitive\":\"json\"}")] - public virtual JObject JsonProperty + public virtual Newtonsoft.Json.Linq.JObject JsonProperty { - get => GetInstanceProperty(); + get => GetInstanceProperty(); set => SetInstanceProperty(value); } - /// stability: Experimental - [JsiiProperty(name: "mapProperty", typeJson: "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Number\"}}}")] - public virtual IDictionary MapProperty + /// + /// stability: Experimental + /// + [JsiiProperty(name: "mapProperty", typeJson: "{\"collection\":{\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Number\"},\"kind\":\"map\"}}")] + public virtual System.Collections.Generic.IDictionary MapProperty { - get => GetInstanceProperty>(); + get => GetInstanceProperty>(); set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "numberProperty", typeJson: "{\"primitive\":\"number\"}")] public virtual double NumberProperty { @@ -113,7 +159,9 @@ public virtual double NumberProperty set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "stringProperty", typeJson: "{\"primitive\":\"string\"}")] public virtual string StringProperty { @@ -121,23 +169,29 @@ public virtual string StringProperty set => SetInstanceProperty(value); } - /// stability: Experimental - [JsiiProperty(name: "unionArrayProperty", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"union\":{\"types\":[{\"primitive\":\"number\"},{\"fqn\":\"@scope/jsii-calc-lib.Value\"}]}}}}")] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "unionArrayProperty", typeJson: "{\"collection\":{\"elementtype\":{\"union\":{\"types\":[{\"primitive\":\"number\"},{\"fqn\":\"@scope/jsii-calc-lib.Value\"}]}},\"kind\":\"array\"}}")] public virtual object[] UnionArrayProperty { get => GetInstanceProperty(); set => SetInstanceProperty(value); } - /// stability: Experimental - [JsiiProperty(name: "unionMapProperty", typeJson: "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"},{\"fqn\":\"@scope/jsii-calc-lib.Number\"}]}}}}")] - public virtual IDictionary UnionMapProperty + /// + /// stability: Experimental + /// + [JsiiProperty(name: "unionMapProperty", typeJson: "{\"collection\":{\"elementtype\":{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"},{\"fqn\":\"@scope/jsii-calc-lib.Number\"}]}},\"kind\":\"map\"}}")] + public virtual System.Collections.Generic.IDictionary UnionMapProperty { - get => GetInstanceProperty>(); + get => GetInstanceProperty>(); set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "unionProperty", typeJson: "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.Multiply\"},{\"fqn\":\"@scope/jsii-calc-lib.Number\"}]}}")] public virtual object UnionProperty { @@ -145,23 +199,29 @@ public virtual object UnionProperty set => SetInstanceProperty(value); } - /// stability: Experimental - [JsiiProperty(name: "unknownArrayProperty", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"any\"}}}")] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "unknownArrayProperty", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"any\"},\"kind\":\"array\"}}")] public virtual object[] UnknownArrayProperty { get => GetInstanceProperty(); set => SetInstanceProperty(value); } - /// stability: Experimental - [JsiiProperty(name: "unknownMapProperty", typeJson: "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"primitive\":\"any\"}}}")] - public virtual IDictionary UnknownMapProperty + /// + /// stability: Experimental + /// + [JsiiProperty(name: "unknownMapProperty", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"any\"},\"kind\":\"map\"}}")] + public virtual System.Collections.Generic.IDictionary UnknownMapProperty { - get => GetInstanceProperty>(); + get => GetInstanceProperty>(); set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "unknownProperty", typeJson: "{\"primitive\":\"any\"}")] public virtual object UnknownProperty { @@ -169,33 +229,14 @@ public virtual object UnknownProperty set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "optionalEnumValue", typeJson: "{\"fqn\":\"jsii-calc.StringEnum\"}", isOptional: true)] public virtual Amazon.JSII.Tests.CalculatorNamespace.StringEnum? OptionalEnumValue { - get => GetInstanceProperty(); + get => GetInstanceProperty(); set => SetInstanceProperty(value); } - - /// stability: Experimental - [JsiiMethod(name: "anyIn", parametersJson: "[{\"name\":\"inp\",\"type\":{\"primitive\":\"any\"}}]")] - public virtual void AnyIn(object inp) - { - InvokeInstanceVoidMethod(new object[]{inp}); - } - - /// stability: Experimental - [JsiiMethod(name: "anyOut", returnsJson: "{\"type\":{\"primitive\":\"any\"}}")] - public virtual object AnyOut() - { - return InvokeInstanceMethod(new object[]{}); - } - - /// stability: Experimental - [JsiiMethod(name: "enumMethod", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.StringEnum\"}}", parametersJson: "[{\"name\":\"value\",\"type\":{\"fqn\":\"jsii-calc.StringEnum\"}}]")] - public virtual Amazon.JSII.Tests.CalculatorNamespace.StringEnum EnumMethod(Amazon.JSII.Tests.CalculatorNamespace.StringEnum value) - { - return InvokeInstanceMethod(new object[]{value}); - } } -} \ 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/AllTypesEnum.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AllTypesEnum.cs index cb2743f148..f4c68574a0 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AllTypesEnum.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AllTypesEnum.cs @@ -2,18 +2,27 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + + /// + /// stability: Experimental + /// [JsiiEnum(nativeType: typeof(AllTypesEnum), fullyQualifiedName: "jsii-calc.AllTypesEnum")] public enum AllTypesEnum { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiEnumMember(name: "MY_ENUM_VALUE")] MY_ENUM_VALUE, - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiEnumMember(name: "YOUR_ENUM_VALUE")] YOUR_ENUM_VALUE, - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiEnumMember(name: "THIS_IS_GREAT")] THIS_IS_GREAT } -} \ 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/AllowedMethodNames.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AllowedMethodNames.cs index 052838806a..480811084f 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AllowedMethodNames.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AllowedMethodNames.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(AllowedMethodNames), fullyQualifiedName: "jsii-calc.AllowedMethodNames")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AllowedMethodNames), fullyQualifiedName: "jsii-calc.AllowedMethodNames")] public class AllowedMethodNames : DeputyBase { public AllowedMethodNames(): base(new DeputyProps(new object[]{})) @@ -18,34 +20,42 @@ protected AllowedMethodNames(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "getBar", parametersJson: "[{\"name\":\"_p1\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"_p2\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual void GetBar(string _p1, double _p2) + public virtual void GetBar(string p1, double p2) { - InvokeInstanceVoidMethod(new object[]{_p1, _p2}); + InvokeInstanceVoidMethod(new object[]{p1, p2}); } /// getXxx() is not allowed (see negatives), but getXxx(a, ...) is okay. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "getFoo", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"withParam\",\"type\":{\"primitive\":\"string\"}}]")] public virtual string GetFoo(string withParam) { return InvokeInstanceMethod(new object[]{withParam}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "setBar", parametersJson: "[{\"name\":\"_x\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"_y\",\"type\":{\"primitive\":\"number\"}},{\"name\":\"_z\",\"type\":{\"primitive\":\"boolean\"}}]")] - public virtual void SetBar(string _x, double _y, bool _z) + public virtual void SetBar(string x, double y, bool z) { - InvokeInstanceVoidMethod(new object[]{_x, _y, _z}); + InvokeInstanceVoidMethod(new object[]{x, y, z}); } /// setFoo(x) is not allowed (see negatives), but setXxx(a, b, ...) is okay. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "setFoo", parametersJson: "[{\"name\":\"_x\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"_y\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual void SetFoo(string _x, double _y) + public virtual void SetFoo(string x, double y) { - InvokeInstanceVoidMethod(new object[]{_x, _y}); + InvokeInstanceVoidMethod(new object[]{x, y}); } } -} \ 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/AsyncVirtualMethods.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AsyncVirtualMethods.cs index f712bd5b47..1472b2fcc7 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AsyncVirtualMethods.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AsyncVirtualMethods.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(AsyncVirtualMethods), fullyQualifiedName: "jsii-calc.AsyncVirtualMethods")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AsyncVirtualMethods), fullyQualifiedName: "jsii-calc.AsyncVirtualMethods")] public class AsyncVirtualMethods : DeputyBase { public AsyncVirtualMethods(): base(new DeputyProps(new object[]{})) @@ -18,7 +20,9 @@ protected AsyncVirtualMethods(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "callMe", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", isAsync: true)] public virtual double CallMe() { @@ -26,7 +30,9 @@ public virtual double CallMe() } /// Just calls "overrideMeToo". - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "callMe2", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", isAsync: true)] public virtual double CallMe2() { @@ -46,25 +52,31 @@ public virtual double CallMeDoublePromise() return InvokeInstanceMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "dontOverrideMe", returnsJson: "{\"type\":{\"primitive\":\"number\"}}")] public virtual double DontOverrideMe() { return InvokeInstanceMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "overrideMe", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"mult\",\"type\":{\"primitive\":\"number\"}}]", isAsync: true)] public virtual double OverrideMe(double mult) { return InvokeInstanceMethod(new object[]{mult}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "overrideMeToo", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", isAsync: true)] public virtual double OverrideMeToo() { return InvokeInstanceMethod(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/AugmentableClass.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AugmentableClass.cs index c2b96277c7..0e5f708bae 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AugmentableClass.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AugmentableClass.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(AugmentableClass), fullyQualifiedName: "jsii-calc.AugmentableClass")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AugmentableClass), fullyQualifiedName: "jsii-calc.AugmentableClass")] public class AugmentableClass : DeputyBase { public AugmentableClass(): base(new DeputyProps(new object[]{})) @@ -18,18 +20,22 @@ protected AugmentableClass(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "methodOne")] public virtual void MethodOne() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "methodTwo")] public virtual void MethodTwo() { 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/BinaryOperation.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/BinaryOperation.cs index a651df090c..41c3a82456 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 @@ -3,14 +3,18 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Represents an operation with two operands. - /// stability: Experimental - [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\"}}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.BinaryOperation), fullyQualifiedName: "jsii-calc.BinaryOperation", parametersJson: "[{\"docs\":{\"summary\":\"Left-hand side operand.\"},\"name\":\"lhs\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}},{\"docs\":{\"summary\":\"Right-hand side operand.\"},\"name\":\"rhs\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}]")] public abstract class BinaryOperation : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Operation, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IIFriendly { /// Creates a BinaryOperation. /// Left-hand side operand. /// Right-hand side operand. - /// stability: Experimental + /// + /// stability: Experimental + /// protected BinaryOperation(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ lhs, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ rhs): base(new DeputyProps(new object[]{lhs, rhs})) { } @@ -23,8 +27,20 @@ protected BinaryOperation(DeputyProps props): base(props) { } + /// Say hello! + /// + /// stability: Experimental + /// + [JsiiMethod(name: "hello", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] + public virtual string Hello() + { + return InvokeInstanceMethod(new object[]{}); + } + /// Left-hand side operand. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "lhs", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Lhs { @@ -32,19 +48,13 @@ public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Lhs } /// Right-hand side operand. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "rhs", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Rhs { get => GetInstanceProperty(); } - - /// Say hello! - /// stability: Experimental - [JsiiMethod(name: "hello", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] - public virtual string Hello() - { - return InvokeInstanceMethod(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/BinaryOperationProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/BinaryOperationProxy.cs index 3018058dea..6f9502b239 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/BinaryOperationProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/BinaryOperationProxy.cs @@ -3,8 +3,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Represents an operation with two operands. - /// stability: Experimental - [JsiiTypeProxy(nativeType: typeof(BinaryOperation), fullyQualifiedName: "jsii-calc.BinaryOperation")] + /// + /// stability: Experimental + /// + [JsiiTypeProxy(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.BinaryOperation), fullyQualifiedName: "jsii-calc.BinaryOperation")] internal sealed class BinaryOperationProxy : Amazon.JSII.Tests.CalculatorNamespace.BinaryOperation { private BinaryOperationProxy(ByRefValue reference): base(reference) @@ -12,7 +14,9 @@ private BinaryOperationProxy(ByRefValue reference): base(reference) } /// The value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"number\"}")] [System.Obsolete()] public override double Value @@ -21,7 +25,9 @@ public override double Value } /// String representation of the value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiMethod(name: "toString", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] [System.Obsolete()] public override string ToString() @@ -29,4 +35,4 @@ public override string ToString() return InvokeInstanceMethod(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/Calculator.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Calculator.cs index ab2332701b..945d41773a 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 @@ -1,16 +1,19 @@ using Amazon.JSII.Runtime.Deputy; -using System.Collections.Generic; namespace Amazon.JSII.Tests.CalculatorNamespace { /// A calculator which maintains a current value and allows adding operations. - /// stability: Experimental - [JsiiClass(nativeType: typeof(Calculator), fullyQualifiedName: "jsii-calc.Calculator", parametersJson: "[{\"name\":\"props\",\"type\":{\"fqn\":\"jsii-calc.CalculatorProps\"},\"optional\":true}]")] - public class Calculator : Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperation_ + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Calculator), fullyQualifiedName: "jsii-calc.Calculator", parametersJson: "[{\"docs\":{\"summary\":\"Initialization properties.\"},\"name\":\"props\",\"optional\":true,\"type\":{\"fqn\":\"jsii-calc.CalculatorProps\"}}]")] + public class Calculator : Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperation { /// Creates a Calculator object. /// Initialization properties. - /// stability: Experimental + /// + /// stability: Experimental + /// public Calculator(Amazon.JSII.Tests.CalculatorNamespace.ICalculatorProps props): base(new DeputyProps(new object[]{props})) { } @@ -23,8 +26,60 @@ protected Calculator(DeputyProps props): base(props) { } + /// Adds a number to the current value. + /// + /// stability: Experimental + /// + [JsiiMethod(name: "add", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"number\"}}]")] + public virtual void Add(double @value) + { + InvokeInstanceVoidMethod(new object[]{@value}); + } + + /// Multiplies the current value by a number. + /// + /// stability: Experimental + /// + [JsiiMethod(name: "mul", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"number\"}}]")] + public virtual void Mul(double @value) + { + InvokeInstanceVoidMethod(new object[]{@value}); + } + + /// Negates the current value. + /// + /// stability: Experimental + /// + [JsiiMethod(name: "neg")] + public virtual void Neg() + { + InvokeInstanceVoidMethod(new object[]{}); + } + + /// Raises the current value by a power. + /// + /// stability: Experimental + /// + [JsiiMethod(name: "pow", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"number\"}}]")] + public virtual void Pow(double @value) + { + InvokeInstanceVoidMethod(new object[]{@value}); + } + + /// Returns teh value of the union property (if defined). + /// + /// stability: Experimental + /// + [JsiiMethod(name: "readUnionValue", returnsJson: "{\"type\":{\"primitive\":\"number\"}}")] + public virtual double ReadUnionValue() + { + return InvokeInstanceMethod(new object[]{}); + } + /// Returns the expression. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "expression", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] public override Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Expression { @@ -32,23 +87,29 @@ public override Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Expres } /// A log of all operations. - /// stability: Experimental - [JsiiProperty(name: "operationsLog", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}}")] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "operationsLog", typeJson: "{\"collection\":{\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"},\"kind\":\"array\"}}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_[] OperationsLog { get => GetInstanceProperty(); } /// A map of per operation name of all operations performed. - /// stability: Experimental - [JsiiProperty(name: "operationsMap", typeJson: "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}}}}")] - public virtual IDictionary OperationsMap + /// + /// stability: Experimental + /// + [JsiiProperty(name: "operationsMap", typeJson: "{\"collection\":{\"elementtype\":{\"collection\":{\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"},\"kind\":\"array\"}},\"kind\":\"map\"}}")] + public virtual System.Collections.Generic.IDictionary OperationsMap { - get => GetInstanceProperty>(); + get => GetInstanceProperty>(); } /// The current value. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "curr", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Curr { @@ -57,61 +118,25 @@ public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Curr } /// The maximum value allows in this calculator. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "maxValue", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] public virtual double? MaxValue { - get => GetInstanceProperty(); + get => GetInstanceProperty(); set => SetInstanceProperty(value); } /// Example of a property that accepts a union of types. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "unionProperty", typeJson: "{\"union\":{\"types\":[{\"fqn\":\"jsii-calc.Add\"},{\"fqn\":\"jsii-calc.Multiply\"},{\"fqn\":\"jsii-calc.Power\"}]}}", isOptional: true)] public virtual object UnionProperty { get => GetInstanceProperty(); set => SetInstanceProperty(value); } - - /// Adds a number to the current value. - /// stability: Experimental - [JsiiMethod(name: "add", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual void Add(double value) - { - InvokeInstanceVoidMethod(new object[]{value}); - } - - /// Multiplies the current value by a number. - /// stability: Experimental - [JsiiMethod(name: "mul", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual void Mul(double value) - { - InvokeInstanceVoidMethod(new object[]{value}); - } - - /// Negates the current value. - /// stability: Experimental - [JsiiMethod(name: "neg")] - public virtual void Neg() - { - InvokeInstanceVoidMethod(new object[]{}); - } - - /// Raises the current value by a power. - /// stability: Experimental - [JsiiMethod(name: "pow", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual void Pow(double value) - { - InvokeInstanceVoidMethod(new object[]{value}); - } - - /// Returns teh value of the union property (if defined). - /// stability: Experimental - [JsiiMethod(name: "readUnionValue", returnsJson: "{\"type\":{\"primitive\":\"number\"}}")] - public virtual double ReadUnionValue() - { - return InvokeInstanceMethod(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/CalculatorProps.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/CalculatorProps.cs index c8f892d858..e6fe4c9cab 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/CalculatorProps.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/CalculatorProps.cs @@ -3,11 +3,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Properties for Calculator. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiByValue] public class CalculatorProps : Amazon.JSII.Tests.CalculatorNamespace.ICalculatorProps { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "initialValue", typeJson: "{\"primitive\":\"number\"}", isOptional: true, isOverride: true)] public double? InitialValue { @@ -15,7 +19,9 @@ public double? InitialValue set; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "maximumValue", typeJson: "{\"primitive\":\"number\"}", isOptional: true, isOverride: true)] public double? MaximumValue { @@ -23,4 +29,4 @@ public double? MaximumValue 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/CalculatorPropsProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/CalculatorPropsProxy.cs index 01aae09a7b..9582baa158 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/CalculatorPropsProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/CalculatorPropsProxy.cs @@ -3,7 +3,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Properties for Calculator. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(ICalculatorProps), fullyQualifiedName: "jsii-calc.CalculatorProps")] internal sealed class CalculatorPropsProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.ICalculatorProps { @@ -11,18 +13,22 @@ private CalculatorPropsProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "initialValue", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] public double? InitialValue { - get => GetInstanceProperty(); + get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "maximumValue", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] public double? MaximumValue { - get => GetInstanceProperty(); + 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/ClassThatImplementsTheInternalInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassThatImplementsTheInternalInterface.cs index e5aa5e8c19..8e87d396a7 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassThatImplementsTheInternalInterface.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassThatImplementsTheInternalInterface.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(ClassThatImplementsTheInternalInterface), fullyQualifiedName: "jsii-calc.ClassThatImplementsTheInternalInterface")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ClassThatImplementsTheInternalInterface), fullyQualifiedName: "jsii-calc.ClassThatImplementsTheInternalInterface")] public class ClassThatImplementsTheInternalInterface : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IINonInternalInterface { public ClassThatImplementsTheInternalInterface(): base(new DeputyProps(new object[]{})) @@ -18,7 +20,9 @@ protected ClassThatImplementsTheInternalInterface(DeputyProps props): base(props { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "a", typeJson: "{\"primitive\":\"string\"}")] public virtual string A { @@ -26,7 +30,9 @@ public virtual string A set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "b", typeJson: "{\"primitive\":\"string\"}")] public virtual string B { @@ -34,7 +40,9 @@ public virtual string B set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "c", typeJson: "{\"primitive\":\"string\"}")] public virtual string C { @@ -42,7 +50,9 @@ public virtual string C set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "d", typeJson: "{\"primitive\":\"string\"}")] public virtual string D { @@ -50,4 +60,4 @@ public virtual string D set => SetInstanceProperty(value); } } -} \ 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/ClassThatImplementsThePrivateInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassThatImplementsThePrivateInterface.cs index 600f36c34f..cb9fc4d864 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassThatImplementsThePrivateInterface.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassThatImplementsThePrivateInterface.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(ClassThatImplementsThePrivateInterface), fullyQualifiedName: "jsii-calc.ClassThatImplementsThePrivateInterface")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ClassThatImplementsThePrivateInterface), fullyQualifiedName: "jsii-calc.ClassThatImplementsThePrivateInterface")] public class ClassThatImplementsThePrivateInterface : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IINonInternalInterface { public ClassThatImplementsThePrivateInterface(): base(new DeputyProps(new object[]{})) @@ -18,7 +20,9 @@ protected ClassThatImplementsThePrivateInterface(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "a", typeJson: "{\"primitive\":\"string\"}")] public virtual string A { @@ -26,7 +30,9 @@ public virtual string A set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "b", typeJson: "{\"primitive\":\"string\"}")] public virtual string B { @@ -34,7 +40,9 @@ public virtual string B set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "c", typeJson: "{\"primitive\":\"string\"}")] public virtual string C { @@ -42,7 +50,9 @@ public virtual string C set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "e", typeJson: "{\"primitive\":\"string\"}")] public virtual string E { @@ -50,4 +60,4 @@ public virtual string E set => SetInstanceProperty(value); } } -} \ 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/ClassWithDocs.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithDocs.cs index 4cb1a27104..a926b728cf 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 @@ -7,14 +7,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// The docs are great. They're a bunch of tags. /// stability: Stable /// example: - /// <code> + /// /// function anExample() { /// } - /// </code> - /// https://aws.amazon.com/ + /// + /// see: + /// https://aws.amazon.com/ /// customAttribute: hasAValue /// - [JsiiClass(nativeType: typeof(ClassWithDocs), fullyQualifiedName: "jsii-calc.ClassWithDocs")] + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ClassWithDocs), fullyQualifiedName: "jsii-calc.ClassWithDocs")] public class ClassWithDocs : DeputyBase { public ClassWithDocs(): base(new DeputyProps(new object[]{})) @@ -29,4 +30,4 @@ protected ClassWithDocs(DeputyProps props): base(props) { } } -} \ 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/ClassWithMutableObjectLiteralProperty.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithMutableObjectLiteralProperty.cs index 6193e0c0d6..1f19f052e4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithMutableObjectLiteralProperty.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithMutableObjectLiteralProperty.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(ClassWithMutableObjectLiteralProperty), fullyQualifiedName: "jsii-calc.ClassWithMutableObjectLiteralProperty")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ClassWithMutableObjectLiteralProperty), fullyQualifiedName: "jsii-calc.ClassWithMutableObjectLiteralProperty")] public class ClassWithMutableObjectLiteralProperty : DeputyBase { public ClassWithMutableObjectLiteralProperty(): base(new DeputyProps(new object[]{})) @@ -18,7 +20,9 @@ protected ClassWithMutableObjectLiteralProperty(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "mutableObject", typeJson: "{\"fqn\":\"jsii-calc.IMutableObjectLiteral\"}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.IIMutableObjectLiteral MutableObject { @@ -26,4 +30,4 @@ public virtual Amazon.JSII.Tests.CalculatorNamespace.IIMutableObjectLiteral Muta set => SetInstanceProperty(value); } } -} \ 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/ClassWithPrivateConstructorAndAutomaticProperties.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithPrivateConstructorAndAutomaticProperties.cs index f992d9103b..206e6d99e9 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithPrivateConstructorAndAutomaticProperties.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithPrivateConstructorAndAutomaticProperties.cs @@ -3,8 +3,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Class that implements interface properties automatically, but using a private constructor. - /// stability: Experimental - [JsiiClass(nativeType: typeof(ClassWithPrivateConstructorAndAutomaticProperties), fullyQualifiedName: "jsii-calc.ClassWithPrivateConstructorAndAutomaticProperties")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ClassWithPrivateConstructorAndAutomaticProperties), fullyQualifiedName: "jsii-calc.ClassWithPrivateConstructorAndAutomaticProperties")] public class ClassWithPrivateConstructorAndAutomaticProperties : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceWithProperties { protected ClassWithPrivateConstructorAndAutomaticProperties(ByRefValue reference): base(reference) @@ -15,26 +17,32 @@ protected ClassWithPrivateConstructorAndAutomaticProperties(DeputyProps props): { } - /// stability: Experimental + /// + /// stability: Experimental + /// + [JsiiMethod(name: "create", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.ClassWithPrivateConstructorAndAutomaticProperties\"}}", parametersJson: "[{\"name\":\"readOnlyString\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"readWriteString\",\"type\":{\"primitive\":\"string\"}}]")] + public static Amazon.JSII.Tests.CalculatorNamespace.ClassWithPrivateConstructorAndAutomaticProperties Create(string readOnlyString, string readWriteString) + { + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.ClassWithPrivateConstructorAndAutomaticProperties), new object[]{readOnlyString, readWriteString}); + } + + /// + /// stability: Experimental + /// [JsiiProperty(name: "readOnlyString", typeJson: "{\"primitive\":\"string\"}")] public virtual string ReadOnlyString { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "readWriteString", typeJson: "{\"primitive\":\"string\"}")] public virtual string ReadWriteString { get => GetInstanceProperty(); set => SetInstanceProperty(value); } - - /// stability: Experimental - [JsiiMethod(name: "create", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.ClassWithPrivateConstructorAndAutomaticProperties\"}}", parametersJson: "[{\"name\":\"readOnlyString\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"readWriteString\",\"type\":{\"primitive\":\"string\"}}]")] - public static Amazon.JSII.Tests.CalculatorNamespace.ClassWithPrivateConstructorAndAutomaticProperties Create(string readOnlyString, string readWriteString) - { - return InvokeStaticMethod(typeof(ClassWithPrivateConstructorAndAutomaticProperties), new object[]{readOnlyString, readWriteString}); - } } -} \ 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/ConstructorPassesThisOut.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ConstructorPassesThisOut.cs index 07b31209b5..b8bd08d669 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ConstructorPassesThisOut.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ConstructorPassesThisOut.cs @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(ConstructorPassesThisOut), fullyQualifiedName: "jsii-calc.ConstructorPassesThisOut", parametersJson: "[{\"name\":\"consumer\",\"type\":{\"fqn\":\"jsii-calc.PartiallyInitializedThisConsumer\"}}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ConstructorPassesThisOut), fullyQualifiedName: "jsii-calc.ConstructorPassesThisOut", parametersJson: "[{\"name\":\"consumer\",\"type\":{\"fqn\":\"jsii-calc.PartiallyInitializedThisConsumer\"}}]")] public class ConstructorPassesThisOut : DeputyBase { - /// stability: Experimental + /// + /// stability: Experimental + /// public ConstructorPassesThisOut(Amazon.JSII.Tests.CalculatorNamespace.PartiallyInitializedThisConsumer consumer): base(new DeputyProps(new object[]{consumer})) { } @@ -19,4 +23,4 @@ protected ConstructorPassesThisOut(DeputyProps props): base(props) { } } -} \ 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/Constructors.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Constructors.cs index c3bd5c29cd..3e2b670ebe 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Constructors.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Constructors.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(Constructors), fullyQualifiedName: "jsii-calc.Constructors")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Constructors), fullyQualifiedName: "jsii-calc.Constructors")] public class Constructors : DeputyBase { public Constructors(): base(new DeputyProps(new object[]{})) @@ -18,53 +20,67 @@ protected Constructors(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "hiddenInterface", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.IPublicInterface\"}}")] public static Amazon.JSII.Tests.CalculatorNamespace.IIPublicInterface HiddenInterface() { - return InvokeStaticMethod(typeof(Constructors), new object[]{}); + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.Constructors), new object[]{}); } - /// stability: Experimental - [JsiiMethod(name: "hiddenInterfaces", returnsJson: "{\"type\":{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"fqn\":\"jsii-calc.IPublicInterface\"}}}}")] + /// + /// stability: Experimental + /// + [JsiiMethod(name: "hiddenInterfaces", returnsJson: "{\"type\":{\"collection\":{\"elementtype\":{\"fqn\":\"jsii-calc.IPublicInterface\"},\"kind\":\"array\"}}}")] public static Amazon.JSII.Tests.CalculatorNamespace.IIPublicInterface[] HiddenInterfaces() { - return InvokeStaticMethod(typeof(Constructors), new object[]{}); + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.Constructors), new object[]{}); } - /// stability: Experimental - [JsiiMethod(name: "hiddenSubInterfaces", returnsJson: "{\"type\":{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"fqn\":\"jsii-calc.IPublicInterface\"}}}}")] + /// + /// stability: Experimental + /// + [JsiiMethod(name: "hiddenSubInterfaces", returnsJson: "{\"type\":{\"collection\":{\"elementtype\":{\"fqn\":\"jsii-calc.IPublicInterface\"},\"kind\":\"array\"}}}")] public static Amazon.JSII.Tests.CalculatorNamespace.IIPublicInterface[] HiddenSubInterfaces() { - return InvokeStaticMethod(typeof(Constructors), new object[]{}); + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.Constructors), new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "makeClass", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.PublicClass\"}}")] public static Amazon.JSII.Tests.CalculatorNamespace.PublicClass MakeClass() { - return InvokeStaticMethod(typeof(Constructors), new object[]{}); + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.Constructors), new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "makeInterface", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.IPublicInterface\"}}")] public static Amazon.JSII.Tests.CalculatorNamespace.IIPublicInterface MakeInterface() { - return InvokeStaticMethod(typeof(Constructors), new object[]{}); + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.Constructors), new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "makeInterface2", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.IPublicInterface2\"}}")] public static Amazon.JSII.Tests.CalculatorNamespace.IIPublicInterface2 MakeInterface2() { - return InvokeStaticMethod(typeof(Constructors), new object[]{}); + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.Constructors), new object[]{}); } - /// stability: Experimental - [JsiiMethod(name: "makeInterfaces", returnsJson: "{\"type\":{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"fqn\":\"jsii-calc.IPublicInterface\"}}}}")] + /// + /// stability: Experimental + /// + [JsiiMethod(name: "makeInterfaces", returnsJson: "{\"type\":{\"collection\":{\"elementtype\":{\"fqn\":\"jsii-calc.IPublicInterface\"},\"kind\":\"array\"}}}")] public static Amazon.JSII.Tests.CalculatorNamespace.IIPublicInterface[] MakeInterfaces() { - return InvokeStaticMethod(typeof(Constructors), new object[]{}); + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.Constructors), 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/ConsumersOfThisCrazyTypeSystem.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ConsumersOfThisCrazyTypeSystem.cs index ffa6006c40..db39b873ea 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ConsumersOfThisCrazyTypeSystem.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ConsumersOfThisCrazyTypeSystem.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(ConsumersOfThisCrazyTypeSystem), fullyQualifiedName: "jsii-calc.ConsumersOfThisCrazyTypeSystem")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ConsumersOfThisCrazyTypeSystem), fullyQualifiedName: "jsii-calc.ConsumersOfThisCrazyTypeSystem")] public class ConsumersOfThisCrazyTypeSystem : DeputyBase { public ConsumersOfThisCrazyTypeSystem(): base(new DeputyProps(new object[]{})) @@ -18,18 +20,22 @@ protected ConsumersOfThisCrazyTypeSystem(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "consumeAnotherPublicInterface", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"obj\",\"type\":{\"fqn\":\"jsii-calc.IAnotherPublicInterface\"}}]")] public virtual string ConsumeAnotherPublicInterface(Amazon.JSII.Tests.CalculatorNamespace.IIAnotherPublicInterface obj) { return InvokeInstanceMethod(new object[]{obj}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "consumeNonInternalInterface", returnsJson: "{\"type\":{\"primitive\":\"any\"}}", parametersJson: "[{\"name\":\"obj\",\"type\":{\"fqn\":\"jsii-calc.INonInternalInterface\"}}]")] public virtual object ConsumeNonInternalInterface(Amazon.JSII.Tests.CalculatorNamespace.IINonInternalInterface obj) { return InvokeInstanceMethod(new object[]{obj}); } } -} \ 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/DataRenderer.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DataRenderer.cs index bf43c2360e..9f5471593a 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DataRenderer.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DataRenderer.cs @@ -1,14 +1,17 @@ using Amazon.JSII.Runtime.Deputy; -using System.Collections.Generic; namespace Amazon.JSII.Tests.CalculatorNamespace { /// Verifies proper type handling through dynamic overrides. - /// stability: Experimental - [JsiiClass(nativeType: typeof(DataRenderer), fullyQualifiedName: "jsii-calc.DataRenderer")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DataRenderer), fullyQualifiedName: "jsii-calc.DataRenderer")] public class DataRenderer : DeputyBase { - /// stability: Experimental + /// + /// stability: Experimental + /// public DataRenderer(): base(new DeputyProps(new object[]{})) { } @@ -21,18 +24,22 @@ protected DataRenderer(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiMethod(name: "render", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"data\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.MyFirstStruct\"},\"optional\":true}]")] + /// + /// stability: Experimental + /// + [JsiiMethod(name: "render", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"data\",\"optional\":true,\"type\":{\"fqn\":\"@scope/jsii-calc-lib.MyFirstStruct\"}}]")] public virtual string Render(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IMyFirstStruct data) { return InvokeInstanceMethod(new object[]{data}); } - /// stability: Experimental - [JsiiMethod(name: "renderMap", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"map\",\"type\":{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"primitive\":\"any\"}}}}]")] - public virtual string RenderMap(IDictionary map) + /// + /// stability: Experimental + /// + [JsiiMethod(name: "renderMap", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"map\",\"type\":{\"collection\":{\"elementtype\":{\"primitive\":\"any\"},\"kind\":\"map\"}}}]")] + public virtual string RenderMap(System.Collections.Generic.IDictionary map) { return InvokeInstanceMethod(new object[]{map}); } } -} \ 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/DefaultedConstructorArgument.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DefaultedConstructorArgument.cs index f1de886de6..28648ca6e9 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DefaultedConstructorArgument.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DefaultedConstructorArgument.cs @@ -1,14 +1,17 @@ using Amazon.JSII.Runtime.Deputy; -using System; namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(DefaultedConstructorArgument), fullyQualifiedName: "jsii-calc.DefaultedConstructorArgument", parametersJson: "[{\"name\":\"arg1\",\"type\":{\"primitive\":\"number\"},\"optional\":true},{\"name\":\"arg2\",\"type\":{\"primitive\":\"string\"},\"optional\":true},{\"name\":\"arg3\",\"type\":{\"primitive\":\"date\"},\"optional\":true}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DefaultedConstructorArgument), fullyQualifiedName: "jsii-calc.DefaultedConstructorArgument", parametersJson: "[{\"name\":\"arg1\",\"optional\":true,\"type\":{\"primitive\":\"number\"}},{\"name\":\"arg2\",\"optional\":true,\"type\":{\"primitive\":\"string\"}},{\"name\":\"arg3\",\"optional\":true,\"type\":{\"primitive\":\"date\"}}]")] public class DefaultedConstructorArgument : DeputyBase { - /// stability: Experimental - public DefaultedConstructorArgument(double? arg1, string arg2, DateTime? arg3): base(new DeputyProps(new object[]{arg1, arg2, arg3})) + /// + /// stability: Experimental + /// + public DefaultedConstructorArgument(double? arg1, string arg2, System.DateTime? arg3): base(new DeputyProps(new object[]{arg1, arg2, arg3})) { } @@ -20,25 +23,31 @@ protected DefaultedConstructorArgument(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "arg1", typeJson: "{\"primitive\":\"number\"}")] public virtual double Arg1 { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "arg3", typeJson: "{\"primitive\":\"date\"}")] - public virtual DateTime Arg3 + public virtual System.DateTime Arg3 { - get => GetInstanceProperty(); + get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "arg2", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] public virtual string Arg2 { 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/DeprecatedClass.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DeprecatedClass.cs index b4709f9158..fc8f8e9550 100644 --- 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 @@ -2,12 +2,16 @@ 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}]")] + /// + /// stability: Deprecated + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DeprecatedClass), fullyQualifiedName: "jsii-calc.DeprecatedClass", parametersJson: "[{\"name\":\"readonlyString\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"mutableNumber\",\"optional\":true,\"type\":{\"primitive\":\"number\"}}]")] [System.Obsolete("a pretty boring class")] public class DeprecatedClass : DeputyBase { - /// stability: Deprecated + /// + /// stability: Deprecated + /// [System.Obsolete("this constructor is \"just\" okay")] public DeprecatedClass(string readonlyString, double? mutableNumber): base(new DeputyProps(new object[]{readonlyString, mutableNumber})) { @@ -23,7 +27,19 @@ protected DeprecatedClass(DeputyProps props): base(props) { } - /// stability: Deprecated + /// + /// stability: Deprecated + /// + [JsiiMethod(name: "method")] + [System.Obsolete("it was a bad idea")] + public virtual void Method() + { + InvokeInstanceVoidMethod(new object[]{}); + } + + /// + /// stability: Deprecated + /// [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] [System.Obsolete("this is not always \"wazoo\", be ready to be disappointed")] public virtual string ReadonlyProperty @@ -31,21 +47,15 @@ public virtual string ReadonlyProperty get => GetInstanceProperty(); } - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] [System.Obsolete("shouldn't have been mutable")] public virtual double? MutableProperty { - get => GetInstanceProperty(); + 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 index 3aa8714d25..ada26208af 100644 --- 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 @@ -2,18 +2,25 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Deprecated + + /// + /// stability: Deprecated + /// [JsiiEnum(nativeType: typeof(DeprecatedEnum), fullyQualifiedName: "jsii-calc.DeprecatedEnum")] [System.Obsolete("your deprecated selection of bad options")] public enum DeprecatedEnum { - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiEnumMember(name: "OPTION_A")] [System.Obsolete("option A is not great")] OPTION_A, - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiEnumMember(name: "OPTION_B")] [System.Obsolete("option B is kinda bad, too")] OPTION_B } -} \ 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 index 610708cfe3..7cd57722a6 100644 --- 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 @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiByValue] public class DeprecatedStruct : Amazon.JSII.Tests.CalculatorNamespace.IDeprecatedStruct { - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}", isOverride: true)] [System.Obsolete("well, yeah")] public string ReadonlyProperty @@ -15,4 +19,4 @@ public string ReadonlyProperty 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 index 4acc0b467b..e1bfacb618 100644 --- 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 @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiTypeProxy(nativeType: typeof(IDeprecatedStruct), fullyQualifiedName: "jsii-calc.DeprecatedStruct")] [System.Obsolete("it just wraps a string")] internal sealed class DeprecatedStructProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IDeprecatedStruct @@ -11,7 +13,9 @@ private DeprecatedStructProxy(ByRefValue reference): base(reference) { } - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] [System.Obsolete("well, yeah")] public string ReadonlyProperty @@ -19,4 +23,4 @@ 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/DerivedClassHasNoProperties/Base.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DerivedClassHasNoProperties/Base.cs index dfdad02b6e..b7c0b8caac 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DerivedClassHasNoProperties/Base.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DerivedClassHasNoProperties/Base.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.DerivedClassHasNoProperties { - /// stability: Experimental - [JsiiClass(nativeType: typeof(Base), fullyQualifiedName: "jsii-calc.DerivedClassHasNoProperties.Base")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DerivedClassHasNoProperties.Base), fullyQualifiedName: "jsii-calc.DerivedClassHasNoProperties.Base")] public class Base : DeputyBase { public Base(): base(new DeputyProps(new object[]{})) @@ -18,7 +20,9 @@ protected Base(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "prop", typeJson: "{\"primitive\":\"string\"}")] public virtual string Prop { @@ -26,4 +30,4 @@ public virtual string Prop set => SetInstanceProperty(value); } } -} \ 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/DerivedClassHasNoProperties/Derived.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DerivedClassHasNoProperties/Derived.cs index 71cc816a41..ae13636a20 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DerivedClassHasNoProperties/Derived.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DerivedClassHasNoProperties/Derived.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.DerivedClassHasNoProperties { - /// stability: Experimental - [JsiiClass(nativeType: typeof(Derived), fullyQualifiedName: "jsii-calc.DerivedClassHasNoProperties.Derived")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DerivedClassHasNoProperties.Derived), fullyQualifiedName: "jsii-calc.DerivedClassHasNoProperties.Derived")] public class Derived : Amazon.JSII.Tests.CalculatorNamespace.DerivedClassHasNoProperties.Base { public Derived(): base(new DeputyProps(new object[]{})) @@ -18,4 +20,4 @@ protected Derived(DeputyProps props): base(props) { } } -} \ 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/DerivedStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DerivedStruct.cs index f6905c034f..5d82d1ad0a 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DerivedStruct.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DerivedStruct.cs @@ -1,23 +1,27 @@ using Amazon.JSII.Runtime.Deputy; -using System; -using System.Collections.Generic; namespace Amazon.JSII.Tests.CalculatorNamespace { /// A struct which derives from another struct. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiByValue] public class DerivedStruct : Amazon.JSII.Tests.CalculatorNamespace.IDerivedStruct { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "anotherRequired", typeJson: "{\"primitive\":\"date\"}", isOverride: true)] - public DateTime AnotherRequired + public System.DateTime AnotherRequired { get; set; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "bool", typeJson: "{\"primitive\":\"boolean\"}", isOverride: true)] public bool Bool { @@ -26,7 +30,9 @@ public bool Bool } /// An example of a non primitive property. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "nonPrimitive", typeJson: "{\"fqn\":\"jsii-calc.DoubleTrouble\"}", isOverride: true)] public Amazon.JSII.Tests.CalculatorNamespace.DoubleTrouble NonPrimitive { @@ -35,15 +41,19 @@ public Amazon.JSII.Tests.CalculatorNamespace.DoubleTrouble NonPrimitive } /// This is optional. - /// stability: Experimental - [JsiiProperty(name: "anotherOptional", typeJson: "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}}", isOptional: true, isOverride: true)] - public IDictionary AnotherOptional + /// + /// stability: Experimental + /// + [JsiiProperty(name: "anotherOptional", typeJson: "{\"collection\":{\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"},\"kind\":\"map\"}}", isOptional: true, isOverride: true)] + public System.Collections.Generic.IDictionary AnotherOptional { get; set; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "optionalAny", typeJson: "{\"primitive\":\"any\"}", isOptional: true, isOverride: true)] public object OptionalAny { @@ -51,8 +61,10 @@ public object OptionalAny set; } - /// stability: Experimental - [JsiiProperty(name: "optionalArray", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}", isOptional: true, isOverride: true)] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "optionalArray", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"string\"},\"kind\":\"array\"}}", isOptional: true, isOverride: true)] public string[] OptionalArray { get; @@ -60,7 +72,9 @@ public string[] OptionalArray } /// An awesome number value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "anumber", typeJson: "{\"primitive\":\"number\"}", isOverride: true)] [System.Obsolete()] public double Anumber @@ -70,7 +84,9 @@ public double Anumber } /// A string value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "astring", typeJson: "{\"primitive\":\"string\"}", isOverride: true)] [System.Obsolete()] public string Astring @@ -79,8 +95,10 @@ public string Astring set; } - /// stability: Deprecated - [JsiiProperty(name: "firstOptional", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}", isOptional: true, isOverride: true)] + /// + /// stability: Deprecated + /// + [JsiiProperty(name: "firstOptional", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"string\"},\"kind\":\"array\"}}", isOptional: true, isOverride: true)] [System.Obsolete()] public string[] FirstOptional { @@ -88,4 +106,4 @@ public string[] FirstOptional 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/DerivedStructProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DerivedStructProxy.cs index b4b3a73ee0..da0836ab8f 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DerivedStructProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DerivedStructProxy.cs @@ -1,11 +1,11 @@ using Amazon.JSII.Runtime.Deputy; -using System; -using System.Collections.Generic; namespace Amazon.JSII.Tests.CalculatorNamespace { /// A struct which derives from another struct. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IDerivedStruct), fullyQualifiedName: "jsii-calc.DerivedStruct")] internal sealed class DerivedStructProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IDerivedStruct { @@ -13,14 +13,18 @@ private DerivedStructProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "anotherRequired", typeJson: "{\"primitive\":\"date\"}")] - public DateTime AnotherRequired + public System.DateTime AnotherRequired { - get => GetInstanceProperty(); + get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "bool", typeJson: "{\"primitive\":\"boolean\"}")] public bool Bool { @@ -28,7 +32,9 @@ public bool Bool } /// An example of a non primitive property. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "nonPrimitive", typeJson: "{\"fqn\":\"jsii-calc.DoubleTrouble\"}")] public Amazon.JSII.Tests.CalculatorNamespace.DoubleTrouble NonPrimitive { @@ -36,29 +42,37 @@ public Amazon.JSII.Tests.CalculatorNamespace.DoubleTrouble NonPrimitive } /// This is optional. - /// stability: Experimental - [JsiiProperty(name: "anotherOptional", typeJson: "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}}", isOptional: true)] - public IDictionary AnotherOptional + /// + /// stability: Experimental + /// + [JsiiProperty(name: "anotherOptional", typeJson: "{\"collection\":{\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"},\"kind\":\"map\"}}", isOptional: true)] + public System.Collections.Generic.IDictionary AnotherOptional { - get => GetInstanceProperty>(); + get => GetInstanceProperty>(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "optionalAny", typeJson: "{\"primitive\":\"any\"}", isOptional: true)] public object OptionalAny { get => GetInstanceProperty(); } - /// stability: Experimental - [JsiiProperty(name: "optionalArray", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}", isOptional: true)] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "optionalArray", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"string\"},\"kind\":\"array\"}}", isOptional: true)] public string[] OptionalArray { get => GetInstanceProperty(); } /// An awesome number value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "anumber", typeJson: "{\"primitive\":\"number\"}")] [System.Obsolete()] public double Anumber @@ -67,7 +81,9 @@ public double Anumber } /// A string value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "astring", typeJson: "{\"primitive\":\"string\"}")] [System.Obsolete()] public string Astring @@ -75,12 +91,14 @@ public string Astring get => GetInstanceProperty(); } - /// stability: Deprecated - [JsiiProperty(name: "firstOptional", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}", isOptional: true)] + /// + /// stability: Deprecated + /// + [JsiiProperty(name: "firstOptional", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"string\"},\"kind\":\"array\"}}", isOptional: true)] [System.Obsolete()] public string[] FirstOptional { 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/DoNotOverridePrivates.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DoNotOverridePrivates.cs index 69ad72e4da..ea2e62f8ac 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DoNotOverridePrivates.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DoNotOverridePrivates.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(DoNotOverridePrivates), fullyQualifiedName: "jsii-calc.DoNotOverridePrivates")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DoNotOverridePrivates), fullyQualifiedName: "jsii-calc.DoNotOverridePrivates")] public class DoNotOverridePrivates : DeputyBase { public DoNotOverridePrivates(): base(new DeputyProps(new object[]{})) @@ -18,25 +20,31 @@ protected DoNotOverridePrivates(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "changePrivatePropertyValue", parametersJson: "[{\"name\":\"newValue\",\"type\":{\"primitive\":\"string\"}}]")] public virtual void ChangePrivatePropertyValue(string newValue) { InvokeInstanceVoidMethod(new object[]{newValue}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "privateMethodValue", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] public virtual string PrivateMethodValue() { return InvokeInstanceMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "privatePropertyValue", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] public virtual string PrivatePropertyValue() { return InvokeInstanceMethod(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/DoNotRecognizeAnyAsOptional.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DoNotRecognizeAnyAsOptional.cs index 02346bc6b8..5558f78b15 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DoNotRecognizeAnyAsOptional.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DoNotRecognizeAnyAsOptional.cs @@ -3,8 +3,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// jsii#284: do not recognize "any" as an optional argument. - /// stability: Experimental - [JsiiClass(nativeType: typeof(DoNotRecognizeAnyAsOptional), fullyQualifiedName: "jsii-calc.DoNotRecognizeAnyAsOptional")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DoNotRecognizeAnyAsOptional), fullyQualifiedName: "jsii-calc.DoNotRecognizeAnyAsOptional")] public class DoNotRecognizeAnyAsOptional : DeputyBase { public DoNotRecognizeAnyAsOptional(): base(new DeputyProps(new object[]{})) @@ -19,11 +21,13 @@ protected DoNotRecognizeAnyAsOptional(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiMethod(name: "method", parametersJson: "[{\"name\":\"_requiredAny\",\"type\":{\"primitive\":\"any\"}},{\"name\":\"_optionalAny\",\"type\":{\"primitive\":\"any\"},\"optional\":true},{\"name\":\"_optionalString\",\"type\":{\"primitive\":\"string\"},\"optional\":true}]")] - public virtual void Method(object _requiredAny, object _optionalAny, string _optionalString) + /// + /// stability: Experimental + /// + [JsiiMethod(name: "method", parametersJson: "[{\"name\":\"_requiredAny\",\"type\":{\"primitive\":\"any\"}},{\"name\":\"_optionalAny\",\"optional\":true,\"type\":{\"primitive\":\"any\"}},{\"name\":\"_optionalString\",\"optional\":true,\"type\":{\"primitive\":\"string\"}}]")] + public virtual void Method(object requiredAny, object optionalAny, string optionalString) { - InvokeInstanceVoidMethod(new object[]{_requiredAny, _optionalAny, _optionalString}); + InvokeInstanceVoidMethod(new object[]{requiredAny, optionalAny, optionalString}); } } -} \ 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/DocumentedClass.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DocumentedClass.cs index bef0caf02e..de3ef71b01 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DocumentedClass.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DocumentedClass.cs @@ -10,7 +10,7 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// Multiple paragraphs are separated by an empty line. /// stability: Stable /// - [JsiiClass(nativeType: typeof(DocumentedClass), fullyQualifiedName: "jsii-calc.DocumentedClass")] + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DocumentedClass), fullyQualifiedName: "jsii-calc.DocumentedClass")] public class DocumentedClass : DeputyBase { public DocumentedClass(): base(new DeputyProps(new object[]{})) @@ -27,24 +27,28 @@ protected DocumentedClass(DeputyProps props): base(props) /// Greet the indicated person. /// The person to be greeted. - /// A number that everyone knows very well + /// + /// A number that everyone knows very well + /// /// /// This will print out a friendly greeting intended for /// the indicated person. /// stability: Stable /// - [JsiiMethod(name: "greet", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"greetee\",\"type\":{\"fqn\":\"jsii-calc.Greetee\"},\"optional\":true}]")] + [JsiiMethod(name: "greet", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"docs\":{\"summary\":\"The person to be greeted.\"},\"name\":\"greetee\",\"optional\":true,\"type\":{\"fqn\":\"jsii-calc.Greetee\"}}]")] public virtual double Greet(Amazon.JSII.Tests.CalculatorNamespace.IGreetee greetee) { return InvokeInstanceMethod(new object[]{greetee}); } /// Say ¡Hola! - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "hola")] public virtual void Hola() { 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/DontComplainAboutVariadicAfterOptional.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DontComplainAboutVariadicAfterOptional.cs index e91ab59a49..8e3f212f97 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DontComplainAboutVariadicAfterOptional.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DontComplainAboutVariadicAfterOptional.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(DontComplainAboutVariadicAfterOptional), fullyQualifiedName: "jsii-calc.DontComplainAboutVariadicAfterOptional")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DontComplainAboutVariadicAfterOptional), fullyQualifiedName: "jsii-calc.DontComplainAboutVariadicAfterOptional")] public class DontComplainAboutVariadicAfterOptional : DeputyBase { public DontComplainAboutVariadicAfterOptional(): base(new DeputyProps(new object[]{})) @@ -18,11 +20,13 @@ protected DontComplainAboutVariadicAfterOptional(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiMethod(name: "optionalAndVariadic", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"optional\",\"type\":{\"primitive\":\"string\"},\"optional\":true},{\"name\":\"things\",\"variadic\":true,\"type\":{\"primitive\":\"string\"}}]")] + /// + /// stability: Experimental + /// + [JsiiMethod(name: "optionalAndVariadic", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"optional\",\"optional\":true,\"type\":{\"primitive\":\"string\"}},{\"name\":\"things\",\"type\":{\"primitive\":\"string\"},\"variadic\":true}]")] public virtual string OptionalAndVariadic(string optional, string things) { return InvokeInstanceMethod(new object[]{optional, things}); } } -} \ 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/DoubleTrouble.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DoubleTrouble.cs index c198f3c4fd..3c56b16b6a 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DoubleTrouble.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DoubleTrouble.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(DoubleTrouble), fullyQualifiedName: "jsii-calc.DoubleTrouble")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DoubleTrouble), fullyQualifiedName: "jsii-calc.DoubleTrouble")] public class DoubleTrouble : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIFriendlyRandomGenerator { public DoubleTrouble(): base(new DeputyProps(new object[]{})) @@ -19,7 +21,9 @@ protected DoubleTrouble(DeputyProps props): base(props) } /// Say hello! - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "hello", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] public virtual string Hello() { @@ -27,11 +31,13 @@ public virtual string Hello() } /// Returns another random number. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "next", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", isOverride: true)] public virtual double Next() { return InvokeInstanceMethod(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/EraseUndefinedHashValues.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/EraseUndefinedHashValues.cs index 30e22a7ae4..b68d2ac52a 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/EraseUndefinedHashValues.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/EraseUndefinedHashValues.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(EraseUndefinedHashValues), fullyQualifiedName: "jsii-calc.EraseUndefinedHashValues")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.EraseUndefinedHashValues), fullyQualifiedName: "jsii-calc.EraseUndefinedHashValues")] public class EraseUndefinedHashValues : DeputyBase { public EraseUndefinedHashValues(): base(new DeputyProps(new object[]{})) @@ -27,23 +29,27 @@ protected EraseUndefinedHashValues(DeputyProps props): base(props) [JsiiMethod(name: "doesKeyExist", returnsJson: "{\"type\":{\"primitive\":\"boolean\"}}", parametersJson: "[{\"name\":\"opts\",\"type\":{\"fqn\":\"jsii-calc.EraseUndefinedHashValuesOptions\"}},{\"name\":\"key\",\"type\":{\"primitive\":\"string\"}}]")] public static bool DoesKeyExist(Amazon.JSII.Tests.CalculatorNamespace.IEraseUndefinedHashValuesOptions opts, string key) { - return InvokeStaticMethod(typeof(EraseUndefinedHashValues), new object[]{opts, key}); + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.EraseUndefinedHashValues), new object[]{opts, key}); } /// We expect "prop1" to be erased. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "prop1IsNull", returnsJson: "{\"type\":{\"primitive\":\"any\"}}")] public static object Prop1IsNull() { - return InvokeStaticMethod(typeof(EraseUndefinedHashValues), new object[]{}); + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.EraseUndefinedHashValues), new object[]{}); } /// We expect "prop2" to be erased. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "prop2IsUndefined", returnsJson: "{\"type\":{\"primitive\":\"any\"}}")] public static object Prop2IsUndefined() { - return InvokeStaticMethod(typeof(EraseUndefinedHashValues), new object[]{}); + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.EraseUndefinedHashValues), 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/EraseUndefinedHashValuesOptions.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/EraseUndefinedHashValuesOptions.cs index 6c9812886b..4ed1aa61a3 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/EraseUndefinedHashValuesOptions.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/EraseUndefinedHashValuesOptions.cs @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiByValue] public class EraseUndefinedHashValuesOptions : Amazon.JSII.Tests.CalculatorNamespace.IEraseUndefinedHashValuesOptions { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "option1", typeJson: "{\"primitive\":\"string\"}", isOptional: true, isOverride: true)] public string Option1 { @@ -14,7 +18,9 @@ public string Option1 set; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "option2", typeJson: "{\"primitive\":\"string\"}", isOptional: true, isOverride: true)] public string Option2 { @@ -22,4 +28,4 @@ public string Option2 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/EraseUndefinedHashValuesOptionsProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/EraseUndefinedHashValuesOptionsProxy.cs index 8d18bebd78..84dc19301f 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/EraseUndefinedHashValuesOptionsProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/EraseUndefinedHashValuesOptionsProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IEraseUndefinedHashValuesOptions), fullyQualifiedName: "jsii-calc.EraseUndefinedHashValuesOptions")] internal sealed class EraseUndefinedHashValuesOptionsProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IEraseUndefinedHashValuesOptions { @@ -10,18 +12,22 @@ private EraseUndefinedHashValuesOptionsProxy(ByRefValue reference): base(referen { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "option1", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] public string Option1 { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "option2", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] public string Option2 { 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 index a652fd8761..3e56dc5010 100644 --- 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 @@ -2,11 +2,15 @@ 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}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ExperimentalClass), fullyQualifiedName: "jsii-calc.ExperimentalClass", parametersJson: "[{\"name\":\"readonlyString\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"mutableNumber\",\"optional\":true,\"type\":{\"primitive\":\"number\"}}]")] public class ExperimentalClass : DeputyBase { - /// stability: Experimental + /// + /// stability: Experimental + /// public ExperimentalClass(string readonlyString, double? mutableNumber): base(new DeputyProps(new object[]{readonlyString, mutableNumber})) { } @@ -19,26 +23,32 @@ protected ExperimentalClass(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// + [JsiiMethod(name: "method")] + public virtual void Method() + { + InvokeInstanceVoidMethod(new object[]{}); + } + + /// + /// stability: Experimental + /// [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] public virtual string ReadonlyProperty { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] public virtual double? MutableProperty { - get => GetInstanceProperty(); + 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 index 9f81524b2b..220c8f215d 100644 --- 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 @@ -2,15 +2,22 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + + /// + /// stability: Experimental + /// [JsiiEnum(nativeType: typeof(ExperimentalEnum), fullyQualifiedName: "jsii-calc.ExperimentalEnum")] public enum ExperimentalEnum { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiEnumMember(name: "OPTION_A")] OPTION_A, - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiEnumMember(name: "OPTION_B")] OPTION_B } -} \ 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 index 6f0a509173..cff617e65a 100644 --- 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 @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiByValue] public class ExperimentalStruct : Amazon.JSII.Tests.CalculatorNamespace.IExperimentalStruct { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}", isOverride: true)] public string ReadonlyProperty { @@ -14,4 +18,4 @@ public string ReadonlyProperty 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 index 9bec7f0b42..46429259d2 100644 --- 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 @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IExperimentalStruct), fullyQualifiedName: "jsii-calc.ExperimentalStruct")] internal sealed class ExperimentalStructProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IExperimentalStruct { @@ -10,11 +12,13 @@ private ExperimentalStructProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// 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/ExportedBaseClass.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExportedBaseClass.cs index ed6f88c9f5..8ae95d112a 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExportedBaseClass.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExportedBaseClass.cs @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(ExportedBaseClass), fullyQualifiedName: "jsii-calc.ExportedBaseClass", parametersJson: "[{\"name\":\"success\",\"type\":{\"primitive\":\"boolean\"}}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ExportedBaseClass), fullyQualifiedName: "jsii-calc.ExportedBaseClass", parametersJson: "[{\"name\":\"success\",\"type\":{\"primitive\":\"boolean\"}}]")] public class ExportedBaseClass : DeputyBase { - /// stability: Experimental + /// + /// stability: Experimental + /// public ExportedBaseClass(bool success): base(new DeputyProps(new object[]{success})) { } @@ -19,11 +23,13 @@ protected ExportedBaseClass(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "success", typeJson: "{\"primitive\":\"boolean\"}")] public virtual bool Success { 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/ExtendsInternalInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExtendsInternalInterface.cs index 5d3d7edb17..7637816445 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExtendsInternalInterface.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExtendsInternalInterface.cs @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiByValue] public class ExtendsInternalInterface : Amazon.JSII.Tests.CalculatorNamespace.IExtendsInternalInterface { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "boom", typeJson: "{\"primitive\":\"boolean\"}", isOverride: true)] public bool Boom { @@ -14,7 +18,9 @@ public bool Boom set; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "prop", typeJson: "{\"primitive\":\"string\"}", isOverride: true)] public string Prop { @@ -22,4 +28,4 @@ public string Prop 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/ExtendsInternalInterfaceProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExtendsInternalInterfaceProxy.cs index ab6ec0ce14..adcb9fde03 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExtendsInternalInterfaceProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ExtendsInternalInterfaceProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IExtendsInternalInterface), fullyQualifiedName: "jsii-calc.ExtendsInternalInterface")] internal sealed class ExtendsInternalInterfaceProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IExtendsInternalInterface { @@ -10,18 +12,22 @@ private ExtendsInternalInterfaceProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "boom", typeJson: "{\"primitive\":\"boolean\"}")] public bool Boom { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "prop", typeJson: "{\"primitive\":\"string\"}")] public string Prop { 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/GiveMeStructs.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/GiveMeStructs.cs index c96653ae92..29b5efe884 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/GiveMeStructs.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/GiveMeStructs.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(GiveMeStructs), fullyQualifiedName: "jsii-calc.GiveMeStructs")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.GiveMeStructs), fullyQualifiedName: "jsii-calc.GiveMeStructs")] public class GiveMeStructs : DeputyBase { public GiveMeStructs(): base(new DeputyProps(new object[]{})) @@ -18,15 +20,10 @@ protected GiveMeStructs(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiProperty(name: "structLiteral", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.StructWithOnlyOptionals\"}")] - public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IStructWithOnlyOptionals StructLiteral - { - get => GetInstanceProperty(); - } - /// Accepts a struct of type DerivedStruct and returns a struct of type FirstStruct. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "derivedToFirst", returnsJson: "{\"type\":{\"fqn\":\"@scope/jsii-calc-lib.MyFirstStruct\"}}", parametersJson: "[{\"name\":\"derived\",\"type\":{\"fqn\":\"jsii-calc.DerivedStruct\"}}]")] public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IMyFirstStruct DerivedToFirst(Amazon.JSII.Tests.CalculatorNamespace.IDerivedStruct derived) { @@ -34,7 +31,9 @@ public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IMyFirstStruct } /// Returns the boolean from a DerivedStruct struct. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "readDerivedNonPrimitive", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.DoubleTrouble\"}}", parametersJson: "[{\"name\":\"derived\",\"type\":{\"fqn\":\"jsii-calc.DerivedStruct\"}}]")] public virtual Amazon.JSII.Tests.CalculatorNamespace.DoubleTrouble ReadDerivedNonPrimitive(Amazon.JSII.Tests.CalculatorNamespace.IDerivedStruct derived) { @@ -42,11 +41,22 @@ public virtual Amazon.JSII.Tests.CalculatorNamespace.DoubleTrouble ReadDerivedNo } /// Returns the "anumber" from a MyFirstStruct struct; - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "readFirstNumber", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"first\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.MyFirstStruct\"}}]")] public virtual double ReadFirstNumber(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IMyFirstStruct first) { return InvokeInstanceMethod(new object[]{first}); } + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "structLiteral", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.StructWithOnlyOptionals\"}")] + public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IStructWithOnlyOptionals StructLiteral + { + 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/Greetee.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Greetee.cs index dbb144b072..ccd8effa38 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Greetee.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Greetee.cs @@ -3,13 +3,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// These are some arguments you can pass to a method. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiByValue] public class Greetee : Amazon.JSII.Tests.CalculatorNamespace.IGreetee { /// The name of the greetee. /// - /// default: world + /// default: + /// world /// stability: Experimental /// [JsiiProperty(name: "name", typeJson: "{\"primitive\":\"string\"}", isOptional: true, isOverride: true)] @@ -19,4 +22,4 @@ public string Name 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/GreeteeProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/GreeteeProxy.cs index 48375c5bac..bf9232f9ab 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/GreeteeProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/GreeteeProxy.cs @@ -3,7 +3,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// These are some arguments you can pass to a method. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IGreetee), fullyQualifiedName: "jsii-calc.Greetee")] internal sealed class GreeteeProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IGreetee { @@ -13,7 +15,8 @@ private GreeteeProxy(ByRefValue reference): base(reference) /// The name of the greetee. /// - /// default: world + /// default: + /// world /// stability: Experimental /// [JsiiProperty(name: "name", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] @@ -22,4 +25,4 @@ public string Name 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/GreetingAugmenter.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/GreetingAugmenter.cs index e9f9b4398f..16fd9e4295 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/GreetingAugmenter.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/GreetingAugmenter.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(GreetingAugmenter), fullyQualifiedName: "jsii-calc.GreetingAugmenter")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.GreetingAugmenter), fullyQualifiedName: "jsii-calc.GreetingAugmenter")] public class GreetingAugmenter : DeputyBase { public GreetingAugmenter(): base(new DeputyProps(new object[]{})) @@ -18,11 +20,13 @@ protected GreetingAugmenter(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "betterGreeting", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"friendly\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.IFriendly\"}}]")] public virtual string BetterGreeting(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IIFriendly friendly) { return InvokeInstanceMethod(new object[]{friendly}); } } -} \ 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/IAnotherPublicInterfaceProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IAnotherPublicInterfaceProxy.cs index c33375bac0..08f9a4b5fd 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IAnotherPublicInterfaceProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IAnotherPublicInterfaceProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIAnotherPublicInterface), fullyQualifiedName: "jsii-calc.IAnotherPublicInterface")] internal sealed class IAnotherPublicInterfaceProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIAnotherPublicInterface { @@ -10,7 +12,9 @@ private IAnotherPublicInterfaceProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "a", typeJson: "{\"primitive\":\"string\"}")] public string A { @@ -18,4 +22,4 @@ public string A set => SetInstanceProperty(value); } } -} \ 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/ICalculatorProps.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ICalculatorProps.cs index fee089223a..5c7915c541 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ICalculatorProps.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ICalculatorProps.cs @@ -3,22 +3,28 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Properties for Calculator. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(ICalculatorProps), fullyQualifiedName: "jsii-calc.CalculatorProps")] public interface ICalculatorProps { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "initialValue", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] double? InitialValue { get; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "maximumValue", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] double? MaximumValue { 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/IDeprecatedInterfaceProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IDeprecatedInterfaceProxy.cs index b91ac32df8..5ff524fc78 100644 --- 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 @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiTypeProxy(nativeType: typeof(IIDeprecatedInterface), fullyQualifiedName: "jsii-calc.IDeprecatedInterface")] [System.Obsolete("useless interface")] internal sealed class IDeprecatedInterfaceProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIDeprecatedInterface @@ -11,16 +13,20 @@ private IDeprecatedInterfaceProxy(ByRefValue reference): base(reference) { } - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] [System.Obsolete("could be better")] public double? MutableProperty { - get => GetInstanceProperty(); + get => GetInstanceProperty(); set => SetInstanceProperty(value); } - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiMethod(name: "method")] [System.Obsolete("services no purpose")] public void Method() @@ -28,4 +34,4 @@ 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 index 313d2d6755..b1d86462b7 100644 --- 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 @@ -2,12 +2,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiInterface(nativeType: typeof(IDeprecatedStruct), fullyQualifiedName: "jsii-calc.DeprecatedStruct")] [System.Obsolete("it just wraps a string")] public interface IDeprecatedStruct { - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] [System.Obsolete("well, yeah")] string ReadonlyProperty @@ -15,4 +19,4 @@ 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/IDerivedStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IDerivedStruct.cs index 21f1c5c407..c757d31530 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IDerivedStruct.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IDerivedStruct.cs @@ -1,22 +1,26 @@ using Amazon.JSII.Runtime.Deputy; -using System; -using System.Collections.Generic; namespace Amazon.JSII.Tests.CalculatorNamespace { /// A struct which derives from another struct. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IDerivedStruct), fullyQualifiedName: "jsii-calc.DerivedStruct")] public interface IDerivedStruct : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IMyFirstStruct { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "anotherRequired", typeJson: "{\"primitive\":\"date\"}")] - DateTime AnotherRequired + System.DateTime AnotherRequired { get; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "bool", typeJson: "{\"primitive\":\"boolean\"}")] bool Bool { @@ -24,7 +28,9 @@ bool Bool } /// An example of a non primitive property. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "nonPrimitive", typeJson: "{\"fqn\":\"jsii-calc.DoubleTrouble\"}")] Amazon.JSII.Tests.CalculatorNamespace.DoubleTrouble NonPrimitive { @@ -32,25 +38,31 @@ Amazon.JSII.Tests.CalculatorNamespace.DoubleTrouble NonPrimitive } /// This is optional. - /// stability: Experimental - [JsiiProperty(name: "anotherOptional", typeJson: "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}}", isOptional: true)] - IDictionary AnotherOptional + /// + /// stability: Experimental + /// + [JsiiProperty(name: "anotherOptional", typeJson: "{\"collection\":{\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"},\"kind\":\"map\"}}", isOptional: true)] + System.Collections.Generic.IDictionary AnotherOptional { get; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "optionalAny", typeJson: "{\"primitive\":\"any\"}", isOptional: true)] object OptionalAny { get; } - /// stability: Experimental - [JsiiProperty(name: "optionalArray", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}", isOptional: true)] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "optionalArray", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"string\"},\"kind\":\"array\"}}", isOptional: true)] string[] OptionalArray { 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/IEraseUndefinedHashValuesOptions.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IEraseUndefinedHashValuesOptions.cs index 5f1fa43ad1..979958786b 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IEraseUndefinedHashValuesOptions.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IEraseUndefinedHashValuesOptions.cs @@ -2,22 +2,28 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IEraseUndefinedHashValuesOptions), fullyQualifiedName: "jsii-calc.EraseUndefinedHashValuesOptions")] public interface IEraseUndefinedHashValuesOptions { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "option1", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] string Option1 { get; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "option2", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] string Option2 { 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 index bfe1124231..65affce51e 100644 --- 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 @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIExperimentalInterface), fullyQualifiedName: "jsii-calc.IExperimentalInterface")] internal sealed class IExperimentalInterfaceProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIExperimentalInterface { @@ -10,19 +12,23 @@ private IExperimentalInterfaceProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] public double? MutableProperty { - get => GetInstanceProperty(); + get => GetInstanceProperty(); set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// 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 index 13dc6db4c9..af9fa7ee17 100644 --- 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 @@ -2,15 +2,19 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IExperimentalStruct), fullyQualifiedName: "jsii-calc.ExperimentalStruct")] public interface IExperimentalStruct { - /// stability: Experimental + /// + /// 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/IExtendsInternalInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IExtendsInternalInterface.cs index 4e435b30c8..6bb9a7f017 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IExtendsInternalInterface.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IExtendsInternalInterface.cs @@ -2,22 +2,28 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IExtendsInternalInterface), fullyQualifiedName: "jsii-calc.ExtendsInternalInterface")] public interface IExtendsInternalInterface { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "boom", typeJson: "{\"primitive\":\"boolean\"}")] bool Boom { get; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "prop", typeJson: "{\"primitive\":\"string\"}")] string Prop { 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/IExtendsPrivateInterfaceProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IExtendsPrivateInterfaceProxy.cs index 794bf313ef..3f75003d7c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IExtendsPrivateInterfaceProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IExtendsPrivateInterfaceProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIExtendsPrivateInterface), fullyQualifiedName: "jsii-calc.IExtendsPrivateInterface")] internal sealed class IExtendsPrivateInterfaceProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIExtendsPrivateInterface { @@ -10,14 +12,18 @@ private IExtendsPrivateInterfaceProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental - [JsiiProperty(name: "moreThings", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}")] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "moreThings", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"string\"},\"kind\":\"array\"}}")] public string[] MoreThings { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "private", typeJson: "{\"primitive\":\"string\"}")] public string Private { @@ -25,4 +31,4 @@ public string Private set => SetInstanceProperty(value); } } -} \ 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/IFriendlierProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IFriendlierProxy.cs index 1584c4860a..9d5888b743 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IFriendlierProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IFriendlierProxy.cs @@ -3,7 +3,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Even friendlier classes can implement this interface. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIFriendlier), fullyQualifiedName: "jsii-calc.IFriendlier")] internal sealed class IFriendlierProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIFriendlier { @@ -12,7 +14,9 @@ private IFriendlierProxy(ByRefValue reference): base(reference) } /// Say farewell. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "farewell", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] public string Farewell() { @@ -20,8 +24,12 @@ public string Farewell() } /// Say goodbye. - /// A goodbye blessing. - /// stability: Experimental + /// + /// A goodbye blessing. + /// + /// + /// stability: Experimental + /// [JsiiMethod(name: "goodbye", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] public string Goodbye() { @@ -29,7 +37,9 @@ public string Goodbye() } /// Say hello! - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiMethod(name: "hello", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] [System.Obsolete()] public string Hello() @@ -37,4 +47,4 @@ public string Hello() return InvokeInstanceMethod(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/IFriendlyRandomGeneratorProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IFriendlyRandomGeneratorProxy.cs index 35ba32f39c..083c6dc46c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IFriendlyRandomGeneratorProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IFriendlyRandomGeneratorProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIFriendlyRandomGenerator), fullyQualifiedName: "jsii-calc.IFriendlyRandomGenerator")] internal sealed class IFriendlyRandomGeneratorProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIFriendlyRandomGenerator { @@ -11,8 +13,12 @@ private IFriendlyRandomGeneratorProxy(ByRefValue reference): base(reference) } /// Returns another random number. - /// A random number. - /// stability: Experimental + /// + /// A random number. + /// + /// + /// stability: Experimental + /// [JsiiMethod(name: "next", returnsJson: "{\"type\":{\"primitive\":\"number\"}}")] public double Next() { @@ -20,7 +26,9 @@ public double Next() } /// Say hello! - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiMethod(name: "hello", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] [System.Obsolete()] public string Hello() @@ -28,4 +36,4 @@ public string Hello() return InvokeInstanceMethod(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/IGreetee.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IGreetee.cs index 22a81e3f92..c82087b6db 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IGreetee.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IGreetee.cs @@ -3,13 +3,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// These are some arguments you can pass to a method. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IGreetee), fullyQualifiedName: "jsii-calc.Greetee")] public interface IGreetee { /// The name of the greetee. /// - /// default: world + /// default: + /// world /// stability: Experimental /// [JsiiProperty(name: "name", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] @@ -18,4 +21,4 @@ string Name 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/IIAnotherPublicInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIAnotherPublicInterface.cs index 31b2c3ee24..ac2a925ea2 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIAnotherPublicInterface.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIAnotherPublicInterface.cs @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIAnotherPublicInterface), fullyQualifiedName: "jsii-calc.IAnotherPublicInterface")] public interface IIAnotherPublicInterface { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "a", typeJson: "{\"primitive\":\"string\"}")] string A { @@ -14,4 +18,4 @@ string A 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/IIDeprecatedInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIDeprecatedInterface.cs index 83fe6ecf8e..6ced4a5178 100644 --- 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 @@ -2,12 +2,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiInterface(nativeType: typeof(IIDeprecatedInterface), fullyQualifiedName: "jsii-calc.IDeprecatedInterface")] [System.Obsolete("useless interface")] public interface IIDeprecatedInterface { - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] [System.Obsolete("could be better")] double? MutableProperty @@ -15,10 +19,11 @@ public interface IIDeprecatedInterface get; set; } - - /// stability: Deprecated + /// + /// 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 index 9c413e4d2c..0de15c1bfc 100644 --- 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 @@ -2,20 +2,25 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIExperimentalInterface), fullyQualifiedName: "jsii-calc.IExperimentalInterface")] public interface IIExperimentalInterface { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] double? MutableProperty { get; set; } - - /// stability: Experimental + /// + /// 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/IIExtendsPrivateInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIExtendsPrivateInterface.cs index 7954262ba0..d1a28dcefe 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIExtendsPrivateInterface.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIExtendsPrivateInterface.cs @@ -2,18 +2,24 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIExtendsPrivateInterface), fullyQualifiedName: "jsii-calc.IExtendsPrivateInterface")] public interface IIExtendsPrivateInterface { - /// stability: Experimental - [JsiiProperty(name: "moreThings", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}")] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "moreThings", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"string\"},\"kind\":\"array\"}}")] string[] MoreThings { get; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "private", typeJson: "{\"primitive\":\"string\"}")] string Private { @@ -21,4 +27,4 @@ string Private 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/IIFriendlier.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIFriendlier.cs index a47dcb04db..30257dc39b 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIFriendlier.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIFriendlier.cs @@ -3,18 +3,26 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Even friendlier classes can implement this interface. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIFriendlier), fullyQualifiedName: "jsii-calc.IFriendlier")] public interface IIFriendlier : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IIFriendly { /// Say farewell. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "farewell", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] string Farewell(); /// Say goodbye. - /// A goodbye blessing. - /// stability: Experimental + /// + /// A goodbye blessing. + /// + /// + /// stability: Experimental + /// [JsiiMethod(name: "goodbye", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] string Goodbye(); } -} \ 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/IIFriendlyRandomGenerator.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIFriendlyRandomGenerator.cs index a568e5c2cc..06ac1b653b 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIFriendlyRandomGenerator.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIFriendlyRandomGenerator.cs @@ -2,9 +2,11 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIFriendlyRandomGenerator), fullyQualifiedName: "jsii-calc.IFriendlyRandomGenerator")] public interface IIFriendlyRandomGenerator : Amazon.JSII.Tests.CalculatorNamespace.IIRandomNumberGenerator, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IIFriendly { } -} \ 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/IIInterfaceImplementedByAbstractClass.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceImplementedByAbstractClass.cs index c52ffc51e8..f532a8a752 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceImplementedByAbstractClass.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceImplementedByAbstractClass.cs @@ -3,15 +3,19 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// awslabs/jsii#220 Abstract return type. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIInterfaceImplementedByAbstractClass), fullyQualifiedName: "jsii-calc.IInterfaceImplementedByAbstractClass")] public interface IIInterfaceImplementedByAbstractClass { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "propFromInterface", typeJson: "{\"primitive\":\"string\"}")] string PropFromInterface { 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/IIInterfaceThatShouldNotBeADataType.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceThatShouldNotBeADataType.cs index 185b99e867..1c6107a5e7 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceThatShouldNotBeADataType.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceThatShouldNotBeADataType.cs @@ -3,15 +3,19 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Even though this interface has only properties, it is disqualified from being a datatype because it inherits from an interface that is not a datatype. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIInterfaceThatShouldNotBeADataType), fullyQualifiedName: "jsii-calc.IInterfaceThatShouldNotBeADataType")] public interface IIInterfaceThatShouldNotBeADataType : Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceWithMethods { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "otherValue", typeJson: "{\"primitive\":\"string\"}")] string OtherValue { 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/IIInterfaceWithInternal.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithInternal.cs index bfbefe68f1..b9b7aa1d06 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithInternal.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithInternal.cs @@ -2,12 +2,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIInterfaceWithInternal), fullyQualifiedName: "jsii-calc.IInterfaceWithInternal")] public interface IIInterfaceWithInternal { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "visible")] void Visible(); } -} \ 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/IIInterfaceWithMethods.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithMethods.cs index 0c1c7285a1..968a670532 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithMethods.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithMethods.cs @@ -2,19 +2,24 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIInterfaceWithMethods), fullyQualifiedName: "jsii-calc.IInterfaceWithMethods")] public interface IIInterfaceWithMethods { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"string\"}")] string Value { get; } - - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "doThings")] void DoThings(); } -} \ 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/IIInterfaceWithOptionalMethodArguments.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithOptionalMethodArguments.cs index 812187c255..473ffa2500 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithOptionalMethodArguments.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithOptionalMethodArguments.cs @@ -3,12 +3,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// awslabs/jsii#175 Interface proxies (and builders) do not respect optional arguments in methods. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIInterfaceWithOptionalMethodArguments), fullyQualifiedName: "jsii-calc.IInterfaceWithOptionalMethodArguments")] public interface IIInterfaceWithOptionalMethodArguments { - /// stability: Experimental - [JsiiMethod(name: "hello", parametersJson: "[{\"name\":\"arg1\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"arg2\",\"type\":{\"primitive\":\"number\"},\"optional\":true}]")] + /// + /// stability: Experimental + /// + [JsiiMethod(name: "hello", parametersJson: "[{\"name\":\"arg1\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"arg2\",\"optional\":true,\"type\":{\"primitive\":\"number\"}}]")] void Hello(string arg1, double? arg2); } -} \ 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/IIInterfaceWithProperties.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithProperties.cs index 68eb2e0cc2..095cdda4bc 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithProperties.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithProperties.cs @@ -2,18 +2,24 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIInterfaceWithProperties), fullyQualifiedName: "jsii-calc.IInterfaceWithProperties")] public interface IIInterfaceWithProperties { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "readOnlyString", typeJson: "{\"primitive\":\"string\"}")] string ReadOnlyString { get; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "readWriteString", typeJson: "{\"primitive\":\"string\"}")] string ReadWriteString { @@ -21,4 +27,4 @@ string ReadWriteString 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/IIInterfaceWithPropertiesExtension.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithPropertiesExtension.cs index af9f27cd5b..56191c6bb5 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithPropertiesExtension.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithPropertiesExtension.cs @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIInterfaceWithPropertiesExtension), fullyQualifiedName: "jsii-calc.IInterfaceWithPropertiesExtension")] public interface IIInterfaceWithPropertiesExtension : Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceWithProperties { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "foo", typeJson: "{\"primitive\":\"number\"}")] double Foo { @@ -14,4 +18,4 @@ double Foo 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/IIJSII417Derived.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIJSII417Derived.cs index 2475dd40f6..b7dafdf1e2 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIJSII417Derived.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIJSII417Derived.cs @@ -2,22 +2,29 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIJSII417Derived), fullyQualifiedName: "jsii-calc.IJSII417Derived")] public interface IIJSII417Derived : Amazon.JSII.Tests.CalculatorNamespace.IIJSII417PublicBaseOfBase { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "property", typeJson: "{\"primitive\":\"string\"}")] string Property { get; } - - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "bar")] void Bar(); - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "baz")] void Baz(); } -} \ 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/IIJSII417PublicBaseOfBase.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIJSII417PublicBaseOfBase.cs index 1a954c1be0..83b9193c4a 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIJSII417PublicBaseOfBase.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIJSII417PublicBaseOfBase.cs @@ -2,19 +2,24 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIJSII417PublicBaseOfBase), fullyQualifiedName: "jsii-calc.IJSII417PublicBaseOfBase")] public interface IIJSII417PublicBaseOfBase { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "hasRoot", typeJson: "{\"primitive\":\"boolean\"}")] bool HasRoot { get; } - - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "foo")] void Foo(); } -} \ 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/IIJsii487External.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIJsii487External.cs index 63052484fa..53acc4b9e4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIJsii487External.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIJsii487External.cs @@ -2,9 +2,11 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIJsii487External), fullyQualifiedName: "jsii-calc.IJsii487External")] public interface IIJsii487External { } -} \ 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/IIJsii487External2.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIJsii487External2.cs index 659d6925e5..cb9b1f4b56 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIJsii487External2.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIJsii487External2.cs @@ -2,9 +2,11 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIJsii487External2), fullyQualifiedName: "jsii-calc.IJsii487External2")] public interface IIJsii487External2 { } -} \ 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/IIJsii496.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIJsii496.cs index 04e6e84ac2..202d307cec 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIJsii496.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIJsii496.cs @@ -2,9 +2,11 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIJsii496), fullyQualifiedName: "jsii-calc.IJsii496")] public interface IIJsii496 { } -} \ 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/IIMutableObjectLiteral.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIMutableObjectLiteral.cs index 6294e9ad0c..8c4ecdc0d1 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIMutableObjectLiteral.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIMutableObjectLiteral.cs @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIMutableObjectLiteral), fullyQualifiedName: "jsii-calc.IMutableObjectLiteral")] public interface IIMutableObjectLiteral { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"string\"}")] string Value { @@ -14,4 +18,4 @@ string Value 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/IINonInternalInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IINonInternalInterface.cs index a506998963..5af14cbe42 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IINonInternalInterface.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IINonInternalInterface.cs @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IINonInternalInterface), fullyQualifiedName: "jsii-calc.INonInternalInterface")] public interface IINonInternalInterface : Amazon.JSII.Tests.CalculatorNamespace.IIAnotherPublicInterface { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "b", typeJson: "{\"primitive\":\"string\"}")] string B { @@ -14,7 +18,9 @@ string B set; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "c", typeJson: "{\"primitive\":\"string\"}")] string C { @@ -22,4 +28,4 @@ string C 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/IIPrivatelyImplemented.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIPrivatelyImplemented.cs index bdff53395c..aa88cc4211 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIPrivatelyImplemented.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIPrivatelyImplemented.cs @@ -2,15 +2,19 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIPrivatelyImplemented), fullyQualifiedName: "jsii-calc.IPrivatelyImplemented")] public interface IIPrivatelyImplemented { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "success", typeJson: "{\"primitive\":\"boolean\"}")] bool Success { 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/IIPublicInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIPublicInterface.cs index 841ccb9287..c1cf520744 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIPublicInterface.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIPublicInterface.cs @@ -2,12 +2,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIPublicInterface), fullyQualifiedName: "jsii-calc.IPublicInterface")] public interface IIPublicInterface { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "bye", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] string Bye(); } -} \ 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/IIPublicInterface2.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIPublicInterface2.cs index 2a59d3a766..22707653d1 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIPublicInterface2.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIPublicInterface2.cs @@ -2,12 +2,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIPublicInterface2), fullyQualifiedName: "jsii-calc.IPublicInterface2")] public interface IIPublicInterface2 { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "ciao", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] string Ciao(); } -} \ 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/IIRandomNumberGenerator.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIRandomNumberGenerator.cs index ab95141189..0e7d3795cc 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIRandomNumberGenerator.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIRandomNumberGenerator.cs @@ -3,14 +3,20 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Generates random numbers. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIRandomNumberGenerator), fullyQualifiedName: "jsii-calc.IRandomNumberGenerator")] public interface IIRandomNumberGenerator { /// Returns another random number. - /// A random number. - /// stability: Experimental + /// + /// A random number. + /// + /// + /// stability: Experimental + /// [JsiiMethod(name: "next", returnsJson: "{\"type\":{\"primitive\":\"number\"}}")] double Next(); } -} \ 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/IIReturnsNumber.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIReturnsNumber.cs index 9cb28714da..a073af5a70 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIReturnsNumber.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIReturnsNumber.cs @@ -2,19 +2,24 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IIReturnsNumber), fullyQualifiedName: "jsii-calc.IReturnsNumber")] public interface IIReturnsNumber { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "numberProp", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.Number\"}")] Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Number NumberProp { get; } - - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "obtainNumber", returnsJson: "{\"type\":{\"fqn\":\"@scope/jsii-calc-lib.IDoublable\"}}")] Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IIDoublable ObtainNumber(); } -} \ 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 index 8667119549..6357802197 100644 --- 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 @@ -2,20 +2,25 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Stable + /// + /// stability: Stable + /// [JsiiInterface(nativeType: typeof(IIStableInterface), fullyQualifiedName: "jsii-calc.IStableInterface")] public interface IIStableInterface { - /// stability: Stable + /// + /// stability: Stable + /// [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] double? MutableProperty { get; set; } - - /// stability: Stable + /// + /// 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/IImplictBaseOfBase.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IImplictBaseOfBase.cs index ccef661881..780c4ff6f4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IImplictBaseOfBase.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IImplictBaseOfBase.cs @@ -1,17 +1,20 @@ using Amazon.JSII.Runtime.Deputy; -using System; namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IImplictBaseOfBase), fullyQualifiedName: "jsii-calc.ImplictBaseOfBase")] public interface IImplictBaseOfBase : Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.IBaseProps { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "goo", typeJson: "{\"primitive\":\"date\"}")] - DateTime Goo + System.DateTime Goo { 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/IInterfaceImplementedByAbstractClassProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceImplementedByAbstractClassProxy.cs index 400109e05e..f0da96169a 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceImplementedByAbstractClassProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceImplementedByAbstractClassProxy.cs @@ -3,7 +3,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// awslabs/jsii#220 Abstract return type. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIInterfaceImplementedByAbstractClass), fullyQualifiedName: "jsii-calc.IInterfaceImplementedByAbstractClass")] internal sealed class IInterfaceImplementedByAbstractClassProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceImplementedByAbstractClass { @@ -11,11 +13,13 @@ private IInterfaceImplementedByAbstractClassProxy(ByRefValue reference): base(re { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "propFromInterface", typeJson: "{\"primitive\":\"string\"}")] public string PropFromInterface { 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/IInterfaceThatShouldNotBeADataTypeProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceThatShouldNotBeADataTypeProxy.cs index 737cef10bb..bd46944bda 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceThatShouldNotBeADataTypeProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceThatShouldNotBeADataTypeProxy.cs @@ -3,7 +3,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Even though this interface has only properties, it is disqualified from being a datatype because it inherits from an interface that is not a datatype. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIInterfaceThatShouldNotBeADataType), fullyQualifiedName: "jsii-calc.IInterfaceThatShouldNotBeADataType")] internal sealed class IInterfaceThatShouldNotBeADataTypeProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceThatShouldNotBeADataType { @@ -11,25 +13,31 @@ private IInterfaceThatShouldNotBeADataTypeProxy(ByRefValue reference): base(refe { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "otherValue", typeJson: "{\"primitive\":\"string\"}")] public string OtherValue { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"string\"}")] public string Value { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "doThings")] public void DoThings() { 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/IInterfaceWithInternalProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithInternalProxy.cs index aba7573b4f..ecb493141a 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithInternalProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithInternalProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIInterfaceWithInternal), fullyQualifiedName: "jsii-calc.IInterfaceWithInternal")] internal sealed class IInterfaceWithInternalProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceWithInternal { @@ -10,11 +12,13 @@ private IInterfaceWithInternalProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "visible")] public void Visible() { 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/IInterfaceWithMethodsProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithMethodsProxy.cs index 977a983f7e..4ca0b05cea 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithMethodsProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithMethodsProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIInterfaceWithMethods), fullyQualifiedName: "jsii-calc.IInterfaceWithMethods")] internal sealed class IInterfaceWithMethodsProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceWithMethods { @@ -10,18 +12,22 @@ private IInterfaceWithMethodsProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"string\"}")] public string Value { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "doThings")] public void DoThings() { 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/IInterfaceWithOptionalMethodArgumentsProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithOptionalMethodArgumentsProxy.cs index 7968cce0f1..2ca248c312 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithOptionalMethodArgumentsProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithOptionalMethodArgumentsProxy.cs @@ -3,7 +3,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// awslabs/jsii#175 Interface proxies (and builders) do not respect optional arguments in methods. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIInterfaceWithOptionalMethodArguments), fullyQualifiedName: "jsii-calc.IInterfaceWithOptionalMethodArguments")] internal sealed class IInterfaceWithOptionalMethodArgumentsProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceWithOptionalMethodArguments { @@ -11,11 +13,13 @@ private IInterfaceWithOptionalMethodArgumentsProxy(ByRefValue reference): base(r { } - /// stability: Experimental - [JsiiMethod(name: "hello", parametersJson: "[{\"name\":\"arg1\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"arg2\",\"type\":{\"primitive\":\"number\"},\"optional\":true}]")] + /// + /// stability: Experimental + /// + [JsiiMethod(name: "hello", parametersJson: "[{\"name\":\"arg1\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"arg2\",\"optional\":true,\"type\":{\"primitive\":\"number\"}}]")] public void Hello(string arg1, double? arg2) { InvokeInstanceVoidMethod(new object[]{arg1, arg2}); } } -} \ 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/IInterfaceWithPropertiesExtensionProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesExtensionProxy.cs index 05f2a4dc34..efd1addffa 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesExtensionProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesExtensionProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIInterfaceWithPropertiesExtension), fullyQualifiedName: "jsii-calc.IInterfaceWithPropertiesExtension")] internal sealed class IInterfaceWithPropertiesExtensionProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceWithPropertiesExtension { @@ -10,7 +12,9 @@ private IInterfaceWithPropertiesExtensionProxy(ByRefValue reference): base(refer { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "foo", typeJson: "{\"primitive\":\"number\"}")] public double Foo { @@ -18,14 +22,18 @@ public double Foo set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "readOnlyString", typeJson: "{\"primitive\":\"string\"}")] public string ReadOnlyString { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "readWriteString", typeJson: "{\"primitive\":\"string\"}")] public string ReadWriteString { @@ -33,4 +41,4 @@ public string ReadWriteString set => SetInstanceProperty(value); } } -} \ 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/IInterfaceWithPropertiesProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesProxy.cs index 53fd0cba21..c921efdce7 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIInterfaceWithProperties), fullyQualifiedName: "jsii-calc.IInterfaceWithProperties")] internal sealed class IInterfaceWithPropertiesProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceWithProperties { @@ -10,14 +12,18 @@ private IInterfaceWithPropertiesProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "readOnlyString", typeJson: "{\"primitive\":\"string\"}")] public string ReadOnlyString { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "readWriteString", typeJson: "{\"primitive\":\"string\"}")] public string ReadWriteString { @@ -25,4 +31,4 @@ public string ReadWriteString set => SetInstanceProperty(value); } } -} \ 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/IJSII417DerivedProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IJSII417DerivedProxy.cs index 19e568e930..78331161d5 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IJSII417DerivedProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IJSII417DerivedProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIJSII417Derived), fullyQualifiedName: "jsii-calc.IJSII417Derived")] internal sealed class IJSII417DerivedProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIJSII417Derived { @@ -10,39 +12,49 @@ private IJSII417DerivedProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "property", typeJson: "{\"primitive\":\"string\"}")] public string Property { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "hasRoot", typeJson: "{\"primitive\":\"boolean\"}")] public bool HasRoot { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "bar")] public void Bar() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "baz")] public void Baz() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "foo")] public void Foo() { 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/IJSII417PublicBaseOfBaseProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IJSII417PublicBaseOfBaseProxy.cs index cbbdb3e399..ee40c4a3c1 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IJSII417PublicBaseOfBaseProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IJSII417PublicBaseOfBaseProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIJSII417PublicBaseOfBase), fullyQualifiedName: "jsii-calc.IJSII417PublicBaseOfBase")] internal sealed class IJSII417PublicBaseOfBaseProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIJSII417PublicBaseOfBase { @@ -10,18 +12,22 @@ private IJSII417PublicBaseOfBaseProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "hasRoot", typeJson: "{\"primitive\":\"boolean\"}")] public bool HasRoot { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "foo")] public void Foo() { 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/IJsii487External2Proxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IJsii487External2Proxy.cs index 8194535c76..b7cc9d1b15 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IJsii487External2Proxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IJsii487External2Proxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIJsii487External2), fullyQualifiedName: "jsii-calc.IJsii487External2")] internal sealed class IJsii487External2Proxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIJsii487External2 { @@ -10,4 +12,4 @@ private IJsii487External2Proxy(ByRefValue reference): base(reference) { } } -} \ 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/IJsii487ExternalProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IJsii487ExternalProxy.cs index 03cc564f18..853d02fff3 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IJsii487ExternalProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IJsii487ExternalProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIJsii487External), fullyQualifiedName: "jsii-calc.IJsii487External")] internal sealed class IJsii487ExternalProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIJsii487External { @@ -10,4 +12,4 @@ private IJsii487ExternalProxy(ByRefValue reference): base(reference) { } } -} \ 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/IJsii496Proxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IJsii496Proxy.cs index cebe80b4aa..169b4132b4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IJsii496Proxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IJsii496Proxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIJsii496), fullyQualifiedName: "jsii-calc.IJsii496")] internal sealed class IJsii496Proxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIJsii496 { @@ -10,4 +12,4 @@ private IJsii496Proxy(ByRefValue reference): base(reference) { } } -} \ 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/ILoadBalancedFargateServiceProps.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ILoadBalancedFargateServiceProps.cs index 7965488294..d0452eb2df 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ILoadBalancedFargateServiceProps.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ILoadBalancedFargateServiceProps.cs @@ -3,14 +3,17 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// jsii#298: show default values in sphinx documentation, and respect newlines. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(ILoadBalancedFargateServiceProps), fullyQualifiedName: "jsii-calc.LoadBalancedFargateServiceProps")] public interface ILoadBalancedFargateServiceProps { /// The container port of the application load balancer attached to your Fargate service. /// /// Corresponds to container port mapping. - /// default: 80 + /// default: + /// 80 /// stability: Experimental /// [JsiiProperty(name: "containerPort", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] @@ -22,7 +25,8 @@ public interface ILoadBalancedFargateServiceProps /// The number of cpu units used by the task. Valid values, which determines your range of valid values for the memory parameter: 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments. /// /// This default is set in the underlying FargateTaskDefinition construct. - /// default: 256 + /// default: + /// 256 /// stability: Experimental /// [JsiiProperty(name: "cpu", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] @@ -47,7 +51,8 @@ string Cpu /// Between 8GB and 30GB in 1GB increments - Available cpu values: 4096 (4 vCPU) /// /// This default is set in the underlying FargateTaskDefinition construct. - /// default: 512 + /// default: + /// 512 /// stability: Experimental /// [JsiiProperty(name: "memoryMiB", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] @@ -58,7 +63,8 @@ string MemoryMiB /// Determines whether the Application Load Balancer will be internet-facing. /// - /// default: true + /// default: + /// true /// stability: Experimental /// [JsiiProperty(name: "publicLoadBalancer", typeJson: "{\"primitive\":\"boolean\"}", isOptional: true)] @@ -69,7 +75,8 @@ string MemoryMiB /// Determines whether your Fargate Service will be assigned a public IP address. /// - /// default: false + /// default: + /// false /// stability: Experimental /// [JsiiProperty(name: "publicTasks", typeJson: "{\"primitive\":\"boolean\"}", isOptional: true)] @@ -78,4 +85,4 @@ string MemoryMiB 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/IMutableObjectLiteralProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IMutableObjectLiteralProxy.cs index 37688071de..0026b5b8d4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IMutableObjectLiteralProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IMutableObjectLiteralProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIMutableObjectLiteral), fullyQualifiedName: "jsii-calc.IMutableObjectLiteral")] internal sealed class IMutableObjectLiteralProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIMutableObjectLiteral { @@ -10,7 +12,9 @@ private IMutableObjectLiteralProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"string\"}")] public string Value { @@ -18,4 +22,4 @@ public string Value set => SetInstanceProperty(value); } } -} \ 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/INonInternalInterfaceProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/INonInternalInterfaceProxy.cs index 23c5ac797d..5f02cb1966 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/INonInternalInterfaceProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/INonInternalInterfaceProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IINonInternalInterface), fullyQualifiedName: "jsii-calc.INonInternalInterface")] internal sealed class INonInternalInterfaceProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IINonInternalInterface { @@ -10,7 +12,9 @@ private INonInternalInterfaceProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "b", typeJson: "{\"primitive\":\"string\"}")] public string B { @@ -18,7 +22,9 @@ public string B set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "c", typeJson: "{\"primitive\":\"string\"}")] public string C { @@ -26,7 +32,9 @@ public string C set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "a", typeJson: "{\"primitive\":\"string\"}")] public string A { @@ -34,4 +42,4 @@ public string A set => SetInstanceProperty(value); } } -} \ 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/INullShouldBeTreatedAsUndefinedData.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/INullShouldBeTreatedAsUndefinedData.cs index 7ee5e72791..f2cda4473b 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/INullShouldBeTreatedAsUndefinedData.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/INullShouldBeTreatedAsUndefinedData.cs @@ -2,22 +2,28 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(INullShouldBeTreatedAsUndefinedData), fullyQualifiedName: "jsii-calc.NullShouldBeTreatedAsUndefinedData")] public interface INullShouldBeTreatedAsUndefinedData { - /// stability: Experimental - [JsiiProperty(name: "arrayWithThreeElementsAndUndefinedAsSecondArgument", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"any\"}}}")] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "arrayWithThreeElementsAndUndefinedAsSecondArgument", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"any\"},\"kind\":\"array\"}}")] object[] ArrayWithThreeElementsAndUndefinedAsSecondArgument { get; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "thisShouldBeUndefined", typeJson: "{\"primitive\":\"any\"}", isOptional: true)] object ThisShouldBeUndefined { 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/IOptionalStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IOptionalStruct.cs index c184688fb1..6fed1c1d17 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IOptionalStruct.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IOptionalStruct.cs @@ -2,15 +2,19 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IOptionalStruct), fullyQualifiedName: "jsii-calc.OptionalStruct")] public interface IOptionalStruct { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "field", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] string Field { 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/IPrivatelyImplementedProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IPrivatelyImplementedProxy.cs index 63d1922ba9..885449c5a3 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IPrivatelyImplementedProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IPrivatelyImplementedProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIPrivatelyImplemented), fullyQualifiedName: "jsii-calc.IPrivatelyImplemented")] internal sealed class IPrivatelyImplementedProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIPrivatelyImplemented { @@ -10,11 +12,13 @@ private IPrivatelyImplementedProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "success", typeJson: "{\"primitive\":\"boolean\"}")] public bool Success { 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/IPublicInterface2Proxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IPublicInterface2Proxy.cs index 1c71deee4a..b1766627d5 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IPublicInterface2Proxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IPublicInterface2Proxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIPublicInterface2), fullyQualifiedName: "jsii-calc.IPublicInterface2")] internal sealed class IPublicInterface2Proxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIPublicInterface2 { @@ -10,11 +12,13 @@ private IPublicInterface2Proxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "ciao", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] public string Ciao() { return InvokeInstanceMethod(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/IPublicInterfaceProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IPublicInterfaceProxy.cs index 819e6ae95e..8a2bf4a4c8 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IPublicInterfaceProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IPublicInterfaceProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIPublicInterface), fullyQualifiedName: "jsii-calc.IPublicInterface")] internal sealed class IPublicInterfaceProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIPublicInterface { @@ -10,11 +12,13 @@ private IPublicInterfaceProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "bye", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] public string Bye() { return InvokeInstanceMethod(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/IRandomNumberGeneratorProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IRandomNumberGeneratorProxy.cs index 09180a935a..b0d6ebc322 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IRandomNumberGeneratorProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IRandomNumberGeneratorProxy.cs @@ -3,7 +3,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Generates random numbers. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIRandomNumberGenerator), fullyQualifiedName: "jsii-calc.IRandomNumberGenerator")] internal sealed class IRandomNumberGeneratorProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIRandomNumberGenerator { @@ -12,12 +14,16 @@ private IRandomNumberGeneratorProxy(ByRefValue reference): base(reference) } /// Returns another random number. - /// A random number. - /// stability: Experimental + /// + /// A random number. + /// + /// + /// stability: Experimental + /// [JsiiMethod(name: "next", returnsJson: "{\"type\":{\"primitive\":\"number\"}}")] public double Next() { return InvokeInstanceMethod(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/IReturnsNumberProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IReturnsNumberProxy.cs index 0f07c38743..f89d4b0a03 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IReturnsNumberProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IReturnsNumberProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IIReturnsNumber), fullyQualifiedName: "jsii-calc.IReturnsNumber")] internal sealed class IReturnsNumberProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIReturnsNumber { @@ -10,18 +12,22 @@ private IReturnsNumberProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "numberProp", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.Number\"}")] public Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Number NumberProp { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "obtainNumber", returnsJson: "{\"type\":{\"fqn\":\"@scope/jsii-calc-lib.IDoublable\"}}")] public Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IIDoublable ObtainNumber() { return InvokeInstanceMethod(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/ISecondLevelStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ISecondLevelStruct.cs index 87a2cf3158..cbf60a85ee 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ISecondLevelStruct.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ISecondLevelStruct.cs @@ -2,12 +2,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(ISecondLevelStruct), fullyQualifiedName: "jsii-calc.SecondLevelStruct")] public interface ISecondLevelStruct { /// It's long and required. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "deeperRequiredProp", typeJson: "{\"primitive\":\"string\"}")] string DeeperRequiredProp { @@ -15,11 +19,13 @@ string DeeperRequiredProp } /// It's long, but you'll almost never pass it. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "deeperOptionalProp", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] string DeeperOptionalProp { 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/IStableInterfaceProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IStableInterfaceProxy.cs index e1c1805591..5d97900f75 100644 --- 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 @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Stable + /// + /// stability: Stable + /// [JsiiTypeProxy(nativeType: typeof(IIStableInterface), fullyQualifiedName: "jsii-calc.IStableInterface")] internal sealed class IStableInterfaceProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIStableInterface { @@ -10,19 +12,23 @@ private IStableInterfaceProxy(ByRefValue reference): base(reference) { } - /// stability: Stable + /// + /// stability: Stable + /// [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] public double? MutableProperty { - get => GetInstanceProperty(); + get => GetInstanceProperty(); set => SetInstanceProperty(value); } - /// stability: Stable + /// + /// 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 index d97b6c563c..f3a861f35f 100644 --- 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 @@ -2,15 +2,19 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Stable + /// + /// stability: Stable + /// [JsiiInterface(nativeType: typeof(IStableStruct), fullyQualifiedName: "jsii-calc.StableStruct")] public interface IStableStruct { - /// stability: Stable + /// + /// 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/ITopLevelStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ITopLevelStruct.cs index 9ef1e315b0..cacaf15a97 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ITopLevelStruct.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ITopLevelStruct.cs @@ -2,12 +2,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(ITopLevelStruct), fullyQualifiedName: "jsii-calc.TopLevelStruct")] public interface ITopLevelStruct { /// This is a required field. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "required", typeJson: "{\"primitive\":\"string\"}")] string Required { @@ -15,7 +19,9 @@ string Required } /// A union to really stress test our serialization. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "secondLevel", typeJson: "{\"union\":{\"types\":[{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.SecondLevelStruct\"}]}}")] object SecondLevel { @@ -23,11 +29,13 @@ object SecondLevel } /// You don't have to pass this. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "optional", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] string Optional { 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/IUnionProperties.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IUnionProperties.cs index 68a92a3100..ffed2786ba 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IUnionProperties.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IUnionProperties.cs @@ -2,22 +2,28 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IUnionProperties), fullyQualifiedName: "jsii-calc.UnionProperties")] public interface IUnionProperties { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "bar", typeJson: "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.AllTypes\"}]}}")] object Bar { get; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "foo", typeJson: "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"}]}}", isOptional: true)] object Foo { 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/ImplementInternalInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplementInternalInterface.cs index 850be692ac..7512d16e8d 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplementInternalInterface.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplementInternalInterface.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(ImplementInternalInterface), fullyQualifiedName: "jsii-calc.ImplementInternalInterface")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ImplementInternalInterface), fullyQualifiedName: "jsii-calc.ImplementInternalInterface")] public class ImplementInternalInterface : DeputyBase { public ImplementInternalInterface(): base(new DeputyProps(new object[]{})) @@ -18,7 +20,9 @@ protected ImplementInternalInterface(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "prop", typeJson: "{\"primitive\":\"string\"}")] public virtual string Prop { @@ -26,4 +30,4 @@ public virtual string Prop set => SetInstanceProperty(value); } } -} \ 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/ImplementsInterfaceWithInternal.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplementsInterfaceWithInternal.cs index 6332bb694e..d97f178e33 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplementsInterfaceWithInternal.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplementsInterfaceWithInternal.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(ImplementsInterfaceWithInternal), fullyQualifiedName: "jsii-calc.ImplementsInterfaceWithInternal")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ImplementsInterfaceWithInternal), fullyQualifiedName: "jsii-calc.ImplementsInterfaceWithInternal")] public class ImplementsInterfaceWithInternal : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceWithInternal { public ImplementsInterfaceWithInternal(): base(new DeputyProps(new object[]{})) @@ -18,11 +20,13 @@ protected ImplementsInterfaceWithInternal(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "visible", isOverride: true)] public virtual void Visible() { 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/ImplementsInterfaceWithInternalSubclass.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplementsInterfaceWithInternalSubclass.cs index 1866949996..38e140ac08 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplementsInterfaceWithInternalSubclass.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplementsInterfaceWithInternalSubclass.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(ImplementsInterfaceWithInternalSubclass), fullyQualifiedName: "jsii-calc.ImplementsInterfaceWithInternalSubclass")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ImplementsInterfaceWithInternalSubclass), fullyQualifiedName: "jsii-calc.ImplementsInterfaceWithInternalSubclass")] public class ImplementsInterfaceWithInternalSubclass : Amazon.JSII.Tests.CalculatorNamespace.ImplementsInterfaceWithInternal { public ImplementsInterfaceWithInternalSubclass(): base(new DeputyProps(new object[]{})) @@ -18,4 +20,4 @@ protected ImplementsInterfaceWithInternalSubclass(DeputyProps props): base(props { } } -} \ 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/ImplementsPrivateInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplementsPrivateInterface.cs index 5f2e6ed529..0826252605 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplementsPrivateInterface.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplementsPrivateInterface.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(ImplementsPrivateInterface), fullyQualifiedName: "jsii-calc.ImplementsPrivateInterface")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ImplementsPrivateInterface), fullyQualifiedName: "jsii-calc.ImplementsPrivateInterface")] public class ImplementsPrivateInterface : DeputyBase { public ImplementsPrivateInterface(): base(new DeputyProps(new object[]{})) @@ -18,7 +20,9 @@ protected ImplementsPrivateInterface(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "private", typeJson: "{\"primitive\":\"string\"}")] public virtual string Private { @@ -26,4 +30,4 @@ public virtual string Private set => SetInstanceProperty(value); } } -} \ 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/ImplictBaseOfBase.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplictBaseOfBase.cs index 6ee1f806cf..bba03b980e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplictBaseOfBase.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplictBaseOfBase.cs @@ -1,15 +1,18 @@ using Amazon.JSII.Runtime.Deputy; -using System; namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiByValue] public class ImplictBaseOfBase : Amazon.JSII.Tests.CalculatorNamespace.IImplictBaseOfBase { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "goo", typeJson: "{\"primitive\":\"date\"}", isOverride: true)] - public DateTime Goo + public System.DateTime Goo { get; set; @@ -29,4 +32,4 @@ public Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace.Very Foo 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/ImplictBaseOfBaseProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplictBaseOfBaseProxy.cs index 366d5ecfa6..e26e09a8b0 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplictBaseOfBaseProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplictBaseOfBaseProxy.cs @@ -1,9 +1,10 @@ using Amazon.JSII.Runtime.Deputy; -using System; namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IImplictBaseOfBase), fullyQualifiedName: "jsii-calc.ImplictBaseOfBase")] internal sealed class ImplictBaseOfBaseProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IImplictBaseOfBase { @@ -11,11 +12,13 @@ private ImplictBaseOfBaseProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "goo", typeJson: "{\"primitive\":\"date\"}")] - public DateTime Goo + public System.DateTime Goo { - get => GetInstanceProperty(); + get => GetInstanceProperty(); } [JsiiProperty(name: "bar", typeJson: "{\"primitive\":\"string\"}")] @@ -30,4 +33,4 @@ public Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace.Very Foo 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/InbetweenClass.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InbetweenClass.cs index ae5d4bb450..d3898d2e3f 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InbetweenClass.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InbetweenClass.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(InbetweenClass), fullyQualifiedName: "jsii-calc.InbetweenClass")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.InbetweenClass), fullyQualifiedName: "jsii-calc.InbetweenClass")] public class InbetweenClass : Amazon.JSII.Tests.CalculatorNamespace.PublicClass, Amazon.JSII.Tests.CalculatorNamespace.IIPublicInterface2 { public InbetweenClass(): base(new DeputyProps(new object[]{})) @@ -18,11 +20,13 @@ protected InbetweenClass(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "ciao", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] public virtual string Ciao() { return InvokeInstanceMethod(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/InterfaceInNamespaceIncludesClasses/Foo.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceIncludesClasses/Foo.cs index e8482461e7..4f9fab38a5 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceIncludesClasses/Foo.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceIncludesClasses/Foo.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.InterfaceInNamespaceIncludesClasses { - /// stability: Experimental - [JsiiClass(nativeType: typeof(Foo), fullyQualifiedName: "jsii-calc.InterfaceInNamespaceIncludesClasses.Foo")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.InterfaceInNamespaceIncludesClasses.Foo), fullyQualifiedName: "jsii-calc.InterfaceInNamespaceIncludesClasses.Foo")] public class Foo : DeputyBase { public Foo(): base(new DeputyProps(new object[]{})) @@ -18,7 +20,9 @@ protected Foo(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "bar", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] public virtual string Bar { @@ -26,4 +30,4 @@ public virtual string Bar set => SetInstanceProperty(value); } } -} \ 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/InterfaceInNamespaceIncludesClasses/Hello.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceIncludesClasses/Hello.cs index ba0bfb5140..2d4e5cd749 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceIncludesClasses/Hello.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceIncludesClasses/Hello.cs @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.InterfaceInNamespaceIncludesClasses { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiByValue] public class Hello : Amazon.JSII.Tests.CalculatorNamespace.InterfaceInNamespaceIncludesClasses.IHello { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "foo", typeJson: "{\"primitive\":\"number\"}", isOverride: true)] public double Foo { @@ -14,4 +18,4 @@ public double Foo 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/InterfaceInNamespaceIncludesClasses/HelloProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceIncludesClasses/HelloProxy.cs index 7955c278df..3589994e38 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceIncludesClasses/HelloProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceIncludesClasses/HelloProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.InterfaceInNamespaceIncludesClasses { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IHello), fullyQualifiedName: "jsii-calc.InterfaceInNamespaceIncludesClasses.Hello")] internal sealed class HelloProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.InterfaceInNamespaceIncludesClasses.IHello { @@ -10,11 +12,13 @@ private HelloProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "foo", typeJson: "{\"primitive\":\"number\"}")] public double Foo { 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/InterfaceInNamespaceIncludesClasses/IHello.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceIncludesClasses/IHello.cs index 2bb7176990..4a12ce3430 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceIncludesClasses/IHello.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceIncludesClasses/IHello.cs @@ -2,15 +2,19 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.InterfaceInNamespaceIncludesClasses { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IHello), fullyQualifiedName: "jsii-calc.InterfaceInNamespaceIncludesClasses.Hello")] public interface IHello { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "foo", typeJson: "{\"primitive\":\"number\"}")] double Foo { 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/InterfaceInNamespaceOnlyInterface/Hello.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceOnlyInterface/Hello.cs index cafc0c793c..04dd91db41 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceOnlyInterface/Hello.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceOnlyInterface/Hello.cs @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.InterfaceInNamespaceOnlyInterface { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiByValue] public class Hello : Amazon.JSII.Tests.CalculatorNamespace.InterfaceInNamespaceOnlyInterface.IHello { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "foo", typeJson: "{\"primitive\":\"number\"}", isOverride: true)] public double Foo { @@ -14,4 +18,4 @@ public double Foo 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/InterfaceInNamespaceOnlyInterface/HelloProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceOnlyInterface/HelloProxy.cs index f7251f317c..95e1cbf269 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceOnlyInterface/HelloProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceOnlyInterface/HelloProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.InterfaceInNamespaceOnlyInterface { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IHello), fullyQualifiedName: "jsii-calc.InterfaceInNamespaceOnlyInterface.Hello")] internal sealed class HelloProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.InterfaceInNamespaceOnlyInterface.IHello { @@ -10,11 +12,13 @@ private HelloProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "foo", typeJson: "{\"primitive\":\"number\"}")] public double Foo { 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/InterfaceInNamespaceOnlyInterface/IHello.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceOnlyInterface/IHello.cs index 156d8b0ce8..ebe33168a4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceOnlyInterface/IHello.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceInNamespaceOnlyInterface/IHello.cs @@ -2,15 +2,19 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.InterfaceInNamespaceOnlyInterface { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiInterface(nativeType: typeof(IHello), fullyQualifiedName: "jsii-calc.InterfaceInNamespaceOnlyInterface.Hello")] public interface IHello { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "foo", typeJson: "{\"primitive\":\"number\"}")] double Foo { 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/Internal/DependencyResolution/Anchor.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Internal/DependencyResolution/Anchor.cs index d7d966706c..84d4ce489f 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Internal/DependencyResolution/Anchor.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Internal/DependencyResolution/Anchor.cs @@ -9,4 +9,4 @@ public Anchor() new Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Internal.DependencyResolution.Anchor(); } } -} \ 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/JSII417Derived.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JSII417Derived.cs index 4d6867f70b..bd628b9591 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JSII417Derived.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JSII417Derived.cs @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(JSII417Derived), fullyQualifiedName: "jsii-calc.JSII417Derived", parametersJson: "[{\"name\":\"property\",\"type\":{\"primitive\":\"string\"}}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.JSII417Derived), fullyQualifiedName: "jsii-calc.JSII417Derived", parametersJson: "[{\"name\":\"property\",\"type\":{\"primitive\":\"string\"}}]")] public class JSII417Derived : Amazon.JSII.Tests.CalculatorNamespace.JSII417PublicBaseOfBase { - /// stability: Experimental + /// + /// stability: Experimental + /// public JSII417Derived(string property): base(new DeputyProps(new object[]{property})) { } @@ -19,25 +23,31 @@ protected JSII417Derived(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiProperty(name: "property", typeJson: "{\"primitive\":\"string\"}")] - protected virtual string Property - { - get => GetInstanceProperty(); - } - - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "bar")] public virtual void Bar() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "baz")] public virtual void Baz() { InvokeInstanceVoidMethod(new object[]{}); } + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "property", typeJson: "{\"primitive\":\"string\"}")] + protected virtual string Property + { + 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/JSII417PublicBaseOfBase.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JSII417PublicBaseOfBase.cs index 839376f9cf..b7ea79e216 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JSII417PublicBaseOfBase.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JSII417PublicBaseOfBase.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(JSII417PublicBaseOfBase), fullyQualifiedName: "jsii-calc.JSII417PublicBaseOfBase")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.JSII417PublicBaseOfBase), fullyQualifiedName: "jsii-calc.JSII417PublicBaseOfBase")] public class JSII417PublicBaseOfBase : DeputyBase { public JSII417PublicBaseOfBase(): base(new DeputyProps(new object[]{})) @@ -18,25 +20,31 @@ protected JSII417PublicBaseOfBase(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiProperty(name: "hasRoot", typeJson: "{\"primitive\":\"boolean\"}")] - public virtual bool HasRoot - { - get => GetInstanceProperty(); - } - - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "makeInstance", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.JSII417PublicBaseOfBase\"}}")] public static Amazon.JSII.Tests.CalculatorNamespace.JSII417PublicBaseOfBase MakeInstance() { - return InvokeStaticMethod(typeof(JSII417PublicBaseOfBase), new object[]{}); + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.JSII417PublicBaseOfBase), new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "foo")] public virtual void Foo() { InvokeInstanceVoidMethod(new object[]{}); } + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "hasRoot", typeJson: "{\"primitive\":\"boolean\"}")] + public virtual bool HasRoot + { + 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/JSObjectLiteralForInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JSObjectLiteralForInterface.cs index 28d2001b44..5bd3acfba4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JSObjectLiteralForInterface.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JSObjectLiteralForInterface.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(JSObjectLiteralForInterface), fullyQualifiedName: "jsii-calc.JSObjectLiteralForInterface")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.JSObjectLiteralForInterface), fullyQualifiedName: "jsii-calc.JSObjectLiteralForInterface")] public class JSObjectLiteralForInterface : DeputyBase { public JSObjectLiteralForInterface(): base(new DeputyProps(new object[]{})) @@ -18,18 +20,22 @@ protected JSObjectLiteralForInterface(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "giveMeFriendly", returnsJson: "{\"type\":{\"fqn\":\"@scope/jsii-calc-lib.IFriendly\"}}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IIFriendly GiveMeFriendly() { return InvokeInstanceMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "giveMeFriendlyGenerator", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.IFriendlyRandomGenerator\"}}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.IIFriendlyRandomGenerator GiveMeFriendlyGenerator() { return InvokeInstanceMethod(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/JSObjectLiteralToNative.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JSObjectLiteralToNative.cs index bf185ea4b9..04b636c52e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JSObjectLiteralToNative.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JSObjectLiteralToNative.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(JSObjectLiteralToNative), fullyQualifiedName: "jsii-calc.JSObjectLiteralToNative")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.JSObjectLiteralToNative), fullyQualifiedName: "jsii-calc.JSObjectLiteralToNative")] public class JSObjectLiteralToNative : DeputyBase { public JSObjectLiteralToNative(): base(new DeputyProps(new object[]{})) @@ -18,11 +20,13 @@ protected JSObjectLiteralToNative(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "returnLiteral", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.JSObjectLiteralToNativeClass\"}}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.JSObjectLiteralToNativeClass ReturnLiteral() { return InvokeInstanceMethod(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/JSObjectLiteralToNativeClass.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JSObjectLiteralToNativeClass.cs index debdf6a88a..b86dce079e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JSObjectLiteralToNativeClass.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JSObjectLiteralToNativeClass.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(JSObjectLiteralToNativeClass), fullyQualifiedName: "jsii-calc.JSObjectLiteralToNativeClass")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.JSObjectLiteralToNativeClass), fullyQualifiedName: "jsii-calc.JSObjectLiteralToNativeClass")] public class JSObjectLiteralToNativeClass : DeputyBase { public JSObjectLiteralToNativeClass(): base(new DeputyProps(new object[]{})) @@ -18,7 +20,9 @@ protected JSObjectLiteralToNativeClass(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "propA", typeJson: "{\"primitive\":\"string\"}")] public virtual string PropA { @@ -26,7 +30,9 @@ public virtual string PropA set => SetInstanceProperty(value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "propB", typeJson: "{\"primitive\":\"number\"}")] public virtual double PropB { @@ -34,4 +40,4 @@ public virtual double PropB set => SetInstanceProperty(value); } } -} \ 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/JavaReservedWords.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JavaReservedWords.cs index 4daa069d7e..ba907d7b36 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JavaReservedWords.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JavaReservedWords.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(JavaReservedWords), fullyQualifiedName: "jsii-calc.JavaReservedWords")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.JavaReservedWords), fullyQualifiedName: "jsii-calc.JavaReservedWords")] public class JavaReservedWords : DeputyBase { public JavaReservedWords(): base(new DeputyProps(new object[]{})) @@ -18,376 +20,482 @@ protected JavaReservedWords(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiProperty(name: "while", typeJson: "{\"primitive\":\"string\"}")] - public virtual string While - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "abstract")] public virtual void Abstract() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "assert")] public virtual void Assert() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "boolean")] public virtual void Boolean() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "break")] public virtual void Break() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "byte")] public virtual void Byte() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "case")] public virtual void Case() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "catch")] public virtual void Catch() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "char")] public virtual void Char() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "class")] public virtual void Class() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "const")] public virtual void Const() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "continue")] public virtual void Continue() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "default")] public virtual void Default() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "do")] public virtual void Do() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "double")] public virtual void Double() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "else")] public virtual void Else() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "enum")] public virtual void Enum() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "extends")] public virtual void Extends() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "false")] public virtual void False() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "final")] public virtual void Final() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "finally")] public virtual void Finally() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "float")] public virtual void Float() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "for")] public virtual void For() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "goto")] public virtual void Goto() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "if")] public virtual void If() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "implements")] public virtual void Implements() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "import")] public virtual void Import() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "instanceof")] public virtual void Instanceof() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "int")] public virtual void Int() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "interface")] public virtual void Interface() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "long")] public virtual void Long() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "native")] public virtual void Native() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "new")] public virtual void New() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "null")] public virtual void Null() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "package")] public virtual void Package() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "private")] public virtual void Private() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "protected")] public virtual void Protected() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "public")] public virtual void Public() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "return")] public virtual void Return() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "short")] public virtual void Short() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "static")] public virtual void Static() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "strictfp")] public virtual void Strictfp() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "super")] public virtual void Super() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "switch")] public virtual void Switch() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "synchronized")] public virtual void Synchronized() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "this")] public virtual void This() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "throw")] public virtual void Throw() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "throws")] public virtual void Throws() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "transient")] public virtual void Transient() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "true")] public virtual void True() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "try")] public virtual void Try() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "void")] public virtual void Void() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "volatile")] public virtual void Volatile() { InvokeInstanceVoidMethod(new object[]{}); } + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "while", typeJson: "{\"primitive\":\"string\"}")] + public virtual string While + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } } -} \ 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/Jsii487Derived.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Jsii487Derived.cs index f6ec98feb6..1aa85b2c8e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Jsii487Derived.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Jsii487Derived.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(Jsii487Derived), fullyQualifiedName: "jsii-calc.Jsii487Derived")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Jsii487Derived), fullyQualifiedName: "jsii-calc.Jsii487Derived")] public class Jsii487Derived : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIJsii487External2, Amazon.JSII.Tests.CalculatorNamespace.IIJsii487External { public Jsii487Derived(): base(new DeputyProps(new object[]{})) @@ -18,4 +20,4 @@ protected Jsii487Derived(DeputyProps props): base(props) { } } -} \ 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/Jsii496Derived.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Jsii496Derived.cs index f1d9c15b1b..a513b28b17 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Jsii496Derived.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Jsii496Derived.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(Jsii496Derived), fullyQualifiedName: "jsii-calc.Jsii496Derived")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Jsii496Derived), fullyQualifiedName: "jsii-calc.Jsii496Derived")] public class Jsii496Derived : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IIJsii496 { public Jsii496Derived(): base(new DeputyProps(new object[]{})) @@ -18,4 +20,4 @@ protected Jsii496Derived(DeputyProps props): base(props) { } } -} \ 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/JsiiAgent_.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JsiiAgent_.cs index 263d99ee76..2759a17388 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JsiiAgent_.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/JsiiAgent_.cs @@ -3,8 +3,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Host runtime version should be set via JSII_AGENT. - /// stability: Experimental - [JsiiClass(nativeType: typeof(JsiiAgent_), fullyQualifiedName: "jsii-calc.JsiiAgent")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.JsiiAgent_), fullyQualifiedName: "jsii-calc.JsiiAgent")] public class JsiiAgent_ : DeputyBase { public JsiiAgent_(): base(new DeputyProps(new object[]{})) @@ -20,11 +22,13 @@ protected JsiiAgent_(DeputyProps props): base(props) } /// Returns the value of the JSII_AGENT environment variable. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "jsiiAgent", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] public static string JsiiAgent { - get => GetStaticProperty(typeof(JsiiAgent_)); + get => GetStaticProperty(typeof(Amazon.JSII.Tests.CalculatorNamespace.JsiiAgent_)); } } -} \ 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/LoadBalancedFargateServiceProps.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/LoadBalancedFargateServiceProps.cs index d4e08c8d38..25c3f9f42f 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/LoadBalancedFargateServiceProps.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/LoadBalancedFargateServiceProps.cs @@ -3,14 +3,17 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// jsii#298: show default values in sphinx documentation, and respect newlines. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiByValue] public class LoadBalancedFargateServiceProps : Amazon.JSII.Tests.CalculatorNamespace.ILoadBalancedFargateServiceProps { /// The container port of the application load balancer attached to your Fargate service. /// /// Corresponds to container port mapping. - /// default: 80 + /// default: + /// 80 /// stability: Experimental /// [JsiiProperty(name: "containerPort", typeJson: "{\"primitive\":\"number\"}", isOptional: true, isOverride: true)] @@ -23,7 +26,8 @@ public double? ContainerPort /// The number of cpu units used by the task. Valid values, which determines your range of valid values for the memory parameter: 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments. /// /// This default is set in the underlying FargateTaskDefinition construct. - /// default: 256 + /// default: + /// 256 /// stability: Experimental /// [JsiiProperty(name: "cpu", typeJson: "{\"primitive\":\"string\"}", isOptional: true, isOverride: true)] @@ -49,7 +53,8 @@ public string Cpu /// Between 8GB and 30GB in 1GB increments - Available cpu values: 4096 (4 vCPU) /// /// This default is set in the underlying FargateTaskDefinition construct. - /// default: 512 + /// default: + /// 512 /// stability: Experimental /// [JsiiProperty(name: "memoryMiB", typeJson: "{\"primitive\":\"string\"}", isOptional: true, isOverride: true)] @@ -61,7 +66,8 @@ public string MemoryMiB /// Determines whether the Application Load Balancer will be internet-facing. /// - /// default: true + /// default: + /// true /// stability: Experimental /// [JsiiProperty(name: "publicLoadBalancer", typeJson: "{\"primitive\":\"boolean\"}", isOptional: true, isOverride: true)] @@ -73,7 +79,8 @@ public bool? PublicLoadBalancer /// Determines whether your Fargate Service will be assigned a public IP address. /// - /// default: false + /// default: + /// false /// stability: Experimental /// [JsiiProperty(name: "publicTasks", typeJson: "{\"primitive\":\"boolean\"}", isOptional: true, isOverride: true)] @@ -83,4 +90,4 @@ public bool? PublicTasks 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/LoadBalancedFargateServicePropsProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/LoadBalancedFargateServicePropsProxy.cs index a3a055336a..56607197f6 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/LoadBalancedFargateServicePropsProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/LoadBalancedFargateServicePropsProxy.cs @@ -3,7 +3,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// jsii#298: show default values in sphinx documentation, and respect newlines. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(ILoadBalancedFargateServiceProps), fullyQualifiedName: "jsii-calc.LoadBalancedFargateServiceProps")] internal sealed class LoadBalancedFargateServicePropsProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.ILoadBalancedFargateServiceProps { @@ -14,19 +16,21 @@ private LoadBalancedFargateServicePropsProxy(ByRefValue reference): base(referen /// The container port of the application load balancer attached to your Fargate service. /// /// Corresponds to container port mapping. - /// default: 80 + /// default: + /// 80 /// stability: Experimental /// [JsiiProperty(name: "containerPort", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] public double? ContainerPort { - get => GetInstanceProperty(); + get => GetInstanceProperty(); } /// The number of cpu units used by the task. Valid values, which determines your range of valid values for the memory parameter: 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments. /// /// This default is set in the underlying FargateTaskDefinition construct. - /// default: 256 + /// default: + /// 256 /// stability: Experimental /// [JsiiProperty(name: "cpu", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] @@ -51,7 +55,8 @@ public string Cpu /// Between 8GB and 30GB in 1GB increments - Available cpu values: 4096 (4 vCPU) /// /// This default is set in the underlying FargateTaskDefinition construct. - /// default: 512 + /// default: + /// 512 /// stability: Experimental /// [JsiiProperty(name: "memoryMiB", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] @@ -62,24 +67,26 @@ public string MemoryMiB /// Determines whether the Application Load Balancer will be internet-facing. /// - /// default: true + /// default: + /// true /// stability: Experimental /// [JsiiProperty(name: "publicLoadBalancer", typeJson: "{\"primitive\":\"boolean\"}", isOptional: true)] public bool? PublicLoadBalancer { - get => GetInstanceProperty(); + get => GetInstanceProperty(); } /// Determines whether your Fargate Service will be assigned a public IP address. /// - /// default: false + /// default: + /// false /// stability: Experimental /// [JsiiProperty(name: "publicTasks", typeJson: "{\"primitive\":\"boolean\"}", isOptional: true)] public bool? PublicTasks { - get => GetInstanceProperty(); + 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/Multiply.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Multiply.cs index 6bea171ffc..ba6ccce043 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 @@ -3,14 +3,18 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// The "*" binary operation. - /// stability: Experimental - [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\"}}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Multiply), fullyQualifiedName: "jsii-calc.Multiply", parametersJson: "[{\"docs\":{\"summary\":\"Left-hand side operand.\"},\"name\":\"lhs\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}},{\"docs\":{\"summary\":\"Right-hand side operand.\"},\"name\":\"rhs\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}]")] public class Multiply : Amazon.JSII.Tests.CalculatorNamespace.BinaryOperation, Amazon.JSII.Tests.CalculatorNamespace.IIFriendlier, Amazon.JSII.Tests.CalculatorNamespace.IIRandomNumberGenerator { /// Creates a BinaryOperation. /// Left-hand side operand. /// Right-hand side operand. - /// stability: Experimental + /// + /// stability: Experimental + /// public Multiply(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ lhs, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ rhs): base(new DeputyProps(new object[]{lhs, rhs})) { } @@ -23,16 +27,10 @@ protected Multiply(DeputyProps props): base(props) { } - /// The value. - /// stability: Experimental - [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"number\"}")] - public override double Value - { - get => GetInstanceProperty(); - } - /// Say farewell. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "farewell", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] public virtual string Farewell() { @@ -40,7 +38,9 @@ public virtual string Farewell() } /// Say goodbye. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "goodbye", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] public virtual string Goodbye() { @@ -48,7 +48,9 @@ public virtual string Goodbye() } /// Returns another random number. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "next", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", isOverride: true)] public virtual double Next() { @@ -56,11 +58,23 @@ public virtual double Next() } /// String representation of the value. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "toString", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] public override string ToString() { return InvokeInstanceMethod(new object[]{}); } + + /// The value. + /// + /// stability: Experimental + /// + [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"number\"}")] + public override double Value + { + 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/Negate.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Negate.cs index 447dde69cc..757071dc07 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Negate.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Negate.cs @@ -3,11 +3,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// The negation operation ("-value"). - /// stability: Experimental - [JsiiClass(nativeType: typeof(Negate), fullyQualifiedName: "jsii-calc.Negate", parametersJson: "[{\"name\":\"operand\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Negate), fullyQualifiedName: "jsii-calc.Negate", parametersJson: "[{\"name\":\"operand\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}]")] public class Negate : Amazon.JSII.Tests.CalculatorNamespace.UnaryOperation, Amazon.JSII.Tests.CalculatorNamespace.IIFriendlier { - /// stability: Experimental + /// + /// stability: Experimental + /// public Negate(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ operand): base(new DeputyProps(new object[]{operand})) { } @@ -20,16 +24,10 @@ protected Negate(DeputyProps props): base(props) { } - /// The value. - /// stability: Experimental - [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"number\"}")] - public override double Value - { - get => GetInstanceProperty(); - } - /// Say farewell. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "farewell", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] public virtual string Farewell() { @@ -37,7 +35,9 @@ public virtual string Farewell() } /// Say goodbye. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "goodbye", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] public virtual string Goodbye() { @@ -45,7 +45,9 @@ public virtual string Goodbye() } /// Say hello! - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "hello", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] public virtual string Hello() { @@ -53,11 +55,23 @@ public virtual string Hello() } /// String representation of the value. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "toString", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] public override string ToString() { return InvokeInstanceMethod(new object[]{}); } + + /// The value. + /// + /// stability: Experimental + /// + [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"number\"}")] + public override double Value + { + 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/NodeStandardLibrary.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/NodeStandardLibrary.cs index 554dac07cd..befeec6121 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/NodeStandardLibrary.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/NodeStandardLibrary.cs @@ -3,8 +3,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Test fixture to verify that jsii modules can use the node standard library. - /// stability: Experimental - [JsiiClass(nativeType: typeof(NodeStandardLibrary), fullyQualifiedName: "jsii-calc.NodeStandardLibrary")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.NodeStandardLibrary), fullyQualifiedName: "jsii-calc.NodeStandardLibrary")] public class NodeStandardLibrary : DeputyBase { public NodeStandardLibrary(): base(new DeputyProps(new object[]{})) @@ -19,17 +21,13 @@ protected NodeStandardLibrary(DeputyProps props): base(props) { } - /// Returns the current os.platform() from the "os" node module. - /// stability: Experimental - [JsiiProperty(name: "osPlatform", typeJson: "{\"primitive\":\"string\"}")] - public virtual string OsPlatform - { - get => GetInstanceProperty(); - } - /// Uses node.js "crypto" module to calculate sha256 of a string. - /// "6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50" - /// stability: Experimental + /// + /// "6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50" + /// + /// + /// stability: Experimental + /// [JsiiMethod(name: "cryptoSha256", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] public virtual string CryptoSha256() { @@ -37,8 +35,12 @@ public virtual string CryptoSha256() } /// Reads a local resource file (resource.txt) asynchronously. - /// "Hello, resource!" - /// stability: Experimental + /// + /// "Hello, resource!" + /// + /// + /// stability: Experimental + /// [JsiiMethod(name: "fsReadFile", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isAsync: true)] public virtual string FsReadFile() { @@ -46,12 +48,26 @@ public virtual string FsReadFile() } /// Sync version of fsReadFile. - /// "Hello, resource! SYNC!" - /// stability: Experimental + /// + /// "Hello, resource! SYNC!" + /// + /// + /// stability: Experimental + /// [JsiiMethod(name: "fsReadFileSync", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] public virtual string FsReadFileSync() { return InvokeInstanceMethod(new object[]{}); } + + /// Returns the current os.platform() from the "os" node module. + /// + /// stability: Experimental + /// + [JsiiProperty(name: "osPlatform", typeJson: "{\"primitive\":\"string\"}")] + public virtual string OsPlatform + { + 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/NullShouldBeTreatedAsUndefined.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/NullShouldBeTreatedAsUndefined.cs index 6e0f969dce..92f9eb58a0 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/NullShouldBeTreatedAsUndefined.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/NullShouldBeTreatedAsUndefined.cs @@ -3,12 +3,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// jsii#282, aws-cdk#157: null should be treated as "undefined". - /// stability: Experimental - [JsiiClass(nativeType: typeof(NullShouldBeTreatedAsUndefined), fullyQualifiedName: "jsii-calc.NullShouldBeTreatedAsUndefined", parametersJson: "[{\"name\":\"_param1\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"optional\",\"type\":{\"primitive\":\"any\"},\"optional\":true}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.NullShouldBeTreatedAsUndefined), fullyQualifiedName: "jsii-calc.NullShouldBeTreatedAsUndefined", parametersJson: "[{\"name\":\"_param1\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"optional\",\"optional\":true,\"type\":{\"primitive\":\"any\"}}]")] public class NullShouldBeTreatedAsUndefined : DeputyBase { - /// stability: Experimental - public NullShouldBeTreatedAsUndefined(string _param1, object optional): base(new DeputyProps(new object[]{_param1, optional})) + /// + /// stability: Experimental + /// + public NullShouldBeTreatedAsUndefined(string param1, object optional): base(new DeputyProps(new object[]{param1, optional})) { } @@ -20,33 +24,41 @@ protected NullShouldBeTreatedAsUndefined(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiProperty(name: "changeMeToUndefined", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] - public virtual string ChangeMeToUndefined - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - - /// stability: Experimental - [JsiiMethod(name: "giveMeUndefined", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"any\"},\"optional\":true}]")] - public virtual void GiveMeUndefined(object value) + /// + /// stability: Experimental + /// + [JsiiMethod(name: "giveMeUndefined", parametersJson: "[{\"name\":\"value\",\"optional\":true,\"type\":{\"primitive\":\"any\"}}]")] + public virtual void GiveMeUndefined(object @value) { - InvokeInstanceVoidMethod(new object[]{value}); + InvokeInstanceVoidMethod(new object[]{@value}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "giveMeUndefinedInsideAnObject", parametersJson: "[{\"name\":\"input\",\"type\":{\"fqn\":\"jsii-calc.NullShouldBeTreatedAsUndefinedData\"}}]")] public virtual void GiveMeUndefinedInsideAnObject(Amazon.JSII.Tests.CalculatorNamespace.INullShouldBeTreatedAsUndefinedData input) { InvokeInstanceVoidMethod(new object[]{input}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "verifyPropertyIsUndefined")] public virtual void VerifyPropertyIsUndefined() { InvokeInstanceVoidMethod(new object[]{}); } + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "changeMeToUndefined", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] + public virtual string ChangeMeToUndefined + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } } -} \ 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/NullShouldBeTreatedAsUndefinedData.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/NullShouldBeTreatedAsUndefinedData.cs index d7341b19b4..9bf866fef9 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/NullShouldBeTreatedAsUndefinedData.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/NullShouldBeTreatedAsUndefinedData.cs @@ -2,19 +2,25 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiByValue] public class NullShouldBeTreatedAsUndefinedData : Amazon.JSII.Tests.CalculatorNamespace.INullShouldBeTreatedAsUndefinedData { - /// stability: Experimental - [JsiiProperty(name: "arrayWithThreeElementsAndUndefinedAsSecondArgument", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"any\"}}}", isOverride: true)] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "arrayWithThreeElementsAndUndefinedAsSecondArgument", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"any\"},\"kind\":\"array\"}}", isOverride: true)] public object[] ArrayWithThreeElementsAndUndefinedAsSecondArgument { get; set; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "thisShouldBeUndefined", typeJson: "{\"primitive\":\"any\"}", isOptional: true, isOverride: true)] public object ThisShouldBeUndefined { @@ -22,4 +28,4 @@ public object ThisShouldBeUndefined 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/NullShouldBeTreatedAsUndefinedDataProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/NullShouldBeTreatedAsUndefinedDataProxy.cs index 5287bec950..f409bb3aac 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/NullShouldBeTreatedAsUndefinedDataProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/NullShouldBeTreatedAsUndefinedDataProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(INullShouldBeTreatedAsUndefinedData), fullyQualifiedName: "jsii-calc.NullShouldBeTreatedAsUndefinedData")] internal sealed class NullShouldBeTreatedAsUndefinedDataProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.INullShouldBeTreatedAsUndefinedData { @@ -10,18 +12,22 @@ private NullShouldBeTreatedAsUndefinedDataProxy(ByRefValue reference): base(refe { } - /// stability: Experimental - [JsiiProperty(name: "arrayWithThreeElementsAndUndefinedAsSecondArgument", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"any\"}}}")] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "arrayWithThreeElementsAndUndefinedAsSecondArgument", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"any\"},\"kind\":\"array\"}}")] public object[] ArrayWithThreeElementsAndUndefinedAsSecondArgument { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "thisShouldBeUndefined", typeJson: "{\"primitive\":\"any\"}", isOptional: true)] public object ThisShouldBeUndefined { 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/NumberGenerator.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/NumberGenerator.cs index 57fd7c3fba..6419449f38 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/NumberGenerator.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/NumberGenerator.cs @@ -3,11 +3,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// This allows us to test that a reference can be stored for objects that implement interfaces. - /// stability: Experimental - [JsiiClass(nativeType: typeof(NumberGenerator), fullyQualifiedName: "jsii-calc.NumberGenerator", parametersJson: "[{\"name\":\"generator\",\"type\":{\"fqn\":\"jsii-calc.IRandomNumberGenerator\"}}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.NumberGenerator), fullyQualifiedName: "jsii-calc.NumberGenerator", parametersJson: "[{\"name\":\"generator\",\"type\":{\"fqn\":\"jsii-calc.IRandomNumberGenerator\"}}]")] public class NumberGenerator : DeputyBase { - /// stability: Experimental + /// + /// stability: Experimental + /// public NumberGenerator(Amazon.JSII.Tests.CalculatorNamespace.IIRandomNumberGenerator generator): base(new DeputyProps(new object[]{generator})) { } @@ -20,26 +24,32 @@ protected NumberGenerator(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiProperty(name: "generator", typeJson: "{\"fqn\":\"jsii-calc.IRandomNumberGenerator\"}")] - public virtual Amazon.JSII.Tests.CalculatorNamespace.IIRandomNumberGenerator Generator - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "isSameGenerator", returnsJson: "{\"type\":{\"primitive\":\"boolean\"}}", parametersJson: "[{\"name\":\"gen\",\"type\":{\"fqn\":\"jsii-calc.IRandomNumberGenerator\"}}]")] public virtual bool IsSameGenerator(Amazon.JSII.Tests.CalculatorNamespace.IIRandomNumberGenerator gen) { return InvokeInstanceMethod(new object[]{gen}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "nextTimes100", returnsJson: "{\"type\":{\"primitive\":\"number\"}}")] public virtual double NextTimes100() { return InvokeInstanceMethod(new object[]{}); } + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "generator", typeJson: "{\"fqn\":\"jsii-calc.IRandomNumberGenerator\"}")] + public virtual Amazon.JSII.Tests.CalculatorNamespace.IIRandomNumberGenerator Generator + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } } -} \ 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/ObjectRefsInCollections.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ObjectRefsInCollections.cs index c1183bf86e..2aa76b0ffd 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ObjectRefsInCollections.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ObjectRefsInCollections.cs @@ -1,11 +1,12 @@ using Amazon.JSII.Runtime.Deputy; -using System.Collections.Generic; namespace Amazon.JSII.Tests.CalculatorNamespace { /// Verify that object references can be passed inside collections. - /// stability: Experimental - [JsiiClass(nativeType: typeof(ObjectRefsInCollections), fullyQualifiedName: "jsii-calc.ObjectRefsInCollections")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ObjectRefsInCollections), fullyQualifiedName: "jsii-calc.ObjectRefsInCollections")] public class ObjectRefsInCollections : DeputyBase { public ObjectRefsInCollections(): base(new DeputyProps(new object[]{})) @@ -21,19 +22,23 @@ protected ObjectRefsInCollections(DeputyProps props): base(props) } /// Returns the sum of all values. - /// stability: Experimental - [JsiiMethod(name: "sumFromArray", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"values\",\"type\":{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}}}]")] + /// + /// stability: Experimental + /// + [JsiiMethod(name: "sumFromArray", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"values\",\"type\":{\"collection\":{\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"},\"kind\":\"array\"}}}]")] public virtual double SumFromArray(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_[] values) { return InvokeInstanceMethod(new object[]{values}); } /// Returns the sum of all values in a map. - /// stability: Experimental - [JsiiMethod(name: "sumFromMap", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"values\",\"type\":{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}}}]")] - public virtual double SumFromMap(IDictionary values) + /// + /// stability: Experimental + /// + [JsiiMethod(name: "sumFromMap", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"values\",\"type\":{\"collection\":{\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"},\"kind\":\"map\"}}}]")] + public virtual double SumFromMap(System.Collections.Generic.IDictionary values) { return InvokeInstanceMethod(new object[]{values}); } } -} \ 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/Old.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Old.cs index 49d1bcf59a..5adb217698 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,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Old class. - /// stability: Deprecated - [JsiiClass(nativeType: typeof(Old), fullyQualifiedName: "jsii-calc.Old")] + /// + /// stability: Deprecated + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Old), fullyQualifiedName: "jsii-calc.Old")] [System.Obsolete("Use the new class")] public class Old : DeputyBase { @@ -21,7 +23,9 @@ protected Old(DeputyProps props): base(props) } /// Doo wop that thing. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiMethod(name: "doAThing")] [System.Obsolete()] public virtual void DoAThing() @@ -29,4 +33,4 @@ public virtual void DoAThing() 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/OptionalConstructorArgument.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OptionalConstructorArgument.cs index 8548fd9920..6903a14cd7 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OptionalConstructorArgument.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OptionalConstructorArgument.cs @@ -1,14 +1,17 @@ using Amazon.JSII.Runtime.Deputy; -using System; namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(OptionalConstructorArgument), fullyQualifiedName: "jsii-calc.OptionalConstructorArgument", parametersJson: "[{\"name\":\"arg1\",\"type\":{\"primitive\":\"number\"}},{\"name\":\"arg2\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"arg3\",\"type\":{\"primitive\":\"date\"},\"optional\":true}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.OptionalConstructorArgument), fullyQualifiedName: "jsii-calc.OptionalConstructorArgument", parametersJson: "[{\"name\":\"arg1\",\"type\":{\"primitive\":\"number\"}},{\"name\":\"arg2\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"arg3\",\"optional\":true,\"type\":{\"primitive\":\"date\"}}]")] public class OptionalConstructorArgument : DeputyBase { - /// stability: Experimental - public OptionalConstructorArgument(double arg1, string arg2, DateTime? arg3): base(new DeputyProps(new object[]{arg1, arg2, arg3})) + /// + /// stability: Experimental + /// + public OptionalConstructorArgument(double arg1, string arg2, System.DateTime? arg3): base(new DeputyProps(new object[]{arg1, arg2, arg3})) { } @@ -20,25 +23,31 @@ protected OptionalConstructorArgument(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "arg1", typeJson: "{\"primitive\":\"number\"}")] public virtual double Arg1 { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "arg2", typeJson: "{\"primitive\":\"string\"}")] public virtual string Arg2 { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "arg3", typeJson: "{\"primitive\":\"date\"}", isOptional: true)] - public virtual DateTime? Arg3 + public virtual System.DateTime? Arg3 { - get => GetInstanceProperty(); + 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/OptionalStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OptionalStruct.cs index 8f9d46c0ac..685ed0bc75 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OptionalStruct.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OptionalStruct.cs @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiByValue] public class OptionalStruct : Amazon.JSII.Tests.CalculatorNamespace.IOptionalStruct { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "field", typeJson: "{\"primitive\":\"string\"}", isOptional: true, isOverride: true)] public string Field { @@ -14,4 +18,4 @@ public string Field 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/OptionalStructConsumer.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OptionalStructConsumer.cs index 7011f10c8c..169677ca25 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OptionalStructConsumer.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OptionalStructConsumer.cs @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(OptionalStructConsumer), fullyQualifiedName: "jsii-calc.OptionalStructConsumer", parametersJson: "[{\"name\":\"optionalStruct\",\"type\":{\"fqn\":\"jsii-calc.OptionalStruct\"},\"optional\":true}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.OptionalStructConsumer), fullyQualifiedName: "jsii-calc.OptionalStructConsumer", parametersJson: "[{\"name\":\"optionalStruct\",\"optional\":true,\"type\":{\"fqn\":\"jsii-calc.OptionalStruct\"}}]")] public class OptionalStructConsumer : DeputyBase { - /// stability: Experimental + /// + /// stability: Experimental + /// public OptionalStructConsumer(Amazon.JSII.Tests.CalculatorNamespace.IOptionalStruct optionalStruct): base(new DeputyProps(new object[]{optionalStruct})) { } @@ -19,18 +23,22 @@ protected OptionalStructConsumer(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "parameterWasUndefined", typeJson: "{\"primitive\":\"boolean\"}")] public virtual bool ParameterWasUndefined { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "fieldValue", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] public virtual string FieldValue { 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/OptionalStructProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OptionalStructProxy.cs index fd55c619b5..d831d90c68 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OptionalStructProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OptionalStructProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IOptionalStruct), fullyQualifiedName: "jsii-calc.OptionalStruct")] internal sealed class OptionalStructProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IOptionalStruct { @@ -10,11 +12,13 @@ private OptionalStructProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "field", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] public string Field { 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/OverrideReturnsObject.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OverrideReturnsObject.cs index 4f3a6fe4e3..8d53021f94 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OverrideReturnsObject.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OverrideReturnsObject.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(OverrideReturnsObject), fullyQualifiedName: "jsii-calc.OverrideReturnsObject")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.OverrideReturnsObject), fullyQualifiedName: "jsii-calc.OverrideReturnsObject")] public class OverrideReturnsObject : DeputyBase { public OverrideReturnsObject(): base(new DeputyProps(new object[]{})) @@ -18,11 +20,13 @@ protected OverrideReturnsObject(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "test", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"obj\",\"type\":{\"fqn\":\"jsii-calc.IReturnsNumber\"}}]")] public virtual double Test(Amazon.JSII.Tests.CalculatorNamespace.IIReturnsNumber obj) { return InvokeInstanceMethod(new object[]{obj}); } } -} \ 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/PartiallyInitializedThisConsumer.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/PartiallyInitializedThisConsumer.cs index 54545c27fd..4a3bef5a9c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/PartiallyInitializedThisConsumer.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/PartiallyInitializedThisConsumer.cs @@ -1,10 +1,11 @@ using Amazon.JSII.Runtime.Deputy; -using System; namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(PartiallyInitializedThisConsumer), fullyQualifiedName: "jsii-calc.PartiallyInitializedThisConsumer")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.PartiallyInitializedThisConsumer), fullyQualifiedName: "jsii-calc.PartiallyInitializedThisConsumer")] public abstract class PartiallyInitializedThisConsumer : DeputyBase { protected PartiallyInitializedThisConsumer(): base(new DeputyProps(new object[]{})) @@ -19,8 +20,11 @@ protected PartiallyInitializedThisConsumer(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "consumePartiallyInitializedThis", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"obj\",\"type\":{\"fqn\":\"jsii-calc.ConstructorPassesThisOut\"}},{\"name\":\"dt\",\"type\":{\"primitive\":\"date\"}},{\"name\":\"ev\",\"type\":{\"fqn\":\"jsii-calc.AllTypesEnum\"}}]")] - public abstract string ConsumePartiallyInitializedThis(Amazon.JSII.Tests.CalculatorNamespace.ConstructorPassesThisOut obj, DateTime dt, Amazon.JSII.Tests.CalculatorNamespace.AllTypesEnum ev); + public abstract string ConsumePartiallyInitializedThis(Amazon.JSII.Tests.CalculatorNamespace.ConstructorPassesThisOut obj, System.DateTime dt, Amazon.JSII.Tests.CalculatorNamespace.AllTypesEnum ev); + } -} \ 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/PartiallyInitializedThisConsumerProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/PartiallyInitializedThisConsumerProxy.cs index 8eb2f4be3b..4a68d2b684 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/PartiallyInitializedThisConsumerProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/PartiallyInitializedThisConsumerProxy.cs @@ -1,21 +1,24 @@ using Amazon.JSII.Runtime.Deputy; -using System; namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiTypeProxy(nativeType: typeof(PartiallyInitializedThisConsumer), fullyQualifiedName: "jsii-calc.PartiallyInitializedThisConsumer")] + /// + /// stability: Experimental + /// + [JsiiTypeProxy(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.PartiallyInitializedThisConsumer), fullyQualifiedName: "jsii-calc.PartiallyInitializedThisConsumer")] internal sealed class PartiallyInitializedThisConsumerProxy : Amazon.JSII.Tests.CalculatorNamespace.PartiallyInitializedThisConsumer { private PartiallyInitializedThisConsumerProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "consumePartiallyInitializedThis", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"obj\",\"type\":{\"fqn\":\"jsii-calc.ConstructorPassesThisOut\"}},{\"name\":\"dt\",\"type\":{\"primitive\":\"date\"}},{\"name\":\"ev\",\"type\":{\"fqn\":\"jsii-calc.AllTypesEnum\"}}]")] - public override string ConsumePartiallyInitializedThis(Amazon.JSII.Tests.CalculatorNamespace.ConstructorPassesThisOut obj, DateTime dt, Amazon.JSII.Tests.CalculatorNamespace.AllTypesEnum ev) + public override string ConsumePartiallyInitializedThis(Amazon.JSII.Tests.CalculatorNamespace.ConstructorPassesThisOut obj, System.DateTime dt, Amazon.JSII.Tests.CalculatorNamespace.AllTypesEnum ev) { return InvokeInstanceMethod(new object[]{obj, dt, ev}); } } -} \ 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/Polymorphism.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Polymorphism.cs index 6344055417..8746a613f3 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Polymorphism.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Polymorphism.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(Polymorphism), fullyQualifiedName: "jsii-calc.Polymorphism")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Polymorphism), fullyQualifiedName: "jsii-calc.Polymorphism")] public class Polymorphism : DeputyBase { public Polymorphism(): base(new DeputyProps(new object[]{})) @@ -18,11 +20,13 @@ protected Polymorphism(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "sayHello", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"friendly\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.IFriendly\"}}]")] public virtual string SayHello(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IIFriendly friendly) { return InvokeInstanceMethod(new object[]{friendly}); } } -} \ 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/Power.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Power.cs index 656ed246ef..dfdf8f0773 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 @@ -3,14 +3,18 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// The power operation. - /// stability: Experimental - [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 : Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperation_ + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Power), fullyQualifiedName: "jsii-calc.Power", parametersJson: "[{\"docs\":{\"summary\":\"The base of the power.\"},\"name\":\"base\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}},{\"docs\":{\"summary\":\"The number of times to multiply.\"},\"name\":\"pow\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}]")] + public class Power : Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperation { /// Creates a Power operation. /// The base of the power. /// The number of times to multiply. - /// stability: Experimental + /// + /// stability: Experimental + /// public Power(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ @base, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ pow): base(new DeputyProps(new object[]{@base, pow})) { } @@ -24,7 +28,9 @@ protected Power(DeputyProps props): base(props) } /// The base of the power. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "base", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Base { @@ -32,7 +38,9 @@ public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Base } /// The expression that this operation consists of. Must be implemented by derived classes. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "expression", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] public override Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Expression { @@ -40,11 +48,13 @@ public override Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Expres } /// The number of times to multiply. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "pow", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Pow { 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/PublicClass.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/PublicClass.cs index dbe687425a..ff5b33f36c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/PublicClass.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/PublicClass.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(PublicClass), fullyQualifiedName: "jsii-calc.PublicClass")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.PublicClass), fullyQualifiedName: "jsii-calc.PublicClass")] public class PublicClass : DeputyBase { public PublicClass(): base(new DeputyProps(new object[]{})) @@ -18,11 +20,13 @@ protected PublicClass(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "hello")] public virtual void Hello() { 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/PythonReservedWords.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/PythonReservedWords.cs index 35e9131e5b..d5740346be 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/PythonReservedWords.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/PythonReservedWords.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(PythonReservedWords), fullyQualifiedName: "jsii-calc.PythonReservedWords")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.PythonReservedWords), fullyQualifiedName: "jsii-calc.PythonReservedWords")] public class PythonReservedWords : DeputyBase { public PythonReservedWords(): base(new DeputyProps(new object[]{})) @@ -18,228 +20,292 @@ protected PythonReservedWords(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "and")] public virtual void And() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "as")] public virtual void As() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "assert")] public virtual void Assert() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "async")] public virtual void Async() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "await")] public virtual void Await() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "break")] public virtual void Break() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "class")] public virtual void Class() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "continue")] public virtual void Continue() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "def")] public virtual void Def() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "del")] public virtual void Del() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "elif")] public virtual void Elif() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "else")] public virtual void Else() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "except")] public virtual void Except() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "finally")] public virtual void Finally() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "for")] public virtual void For() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "from")] public virtual void From() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "global")] public virtual void Global() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "if")] public virtual void If() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "import")] public virtual void Import() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "in")] public virtual void In() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "is")] public virtual void Is() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "lambda")] public virtual void Lambda() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "nonlocal")] public virtual void Nonlocal() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "not")] public virtual void Not() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "or")] public virtual void Or() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "pass")] public virtual void Pass() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "raise")] public virtual void Raise() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "return")] public virtual void Return() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "try")] public virtual void Try() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "while")] public virtual void While() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "with")] public virtual void With() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "yield")] public virtual void Yield() { 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/ReferenceEnumFromScopedPackage.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ReferenceEnumFromScopedPackage.cs index 0e39c52b6d..d0822350e9 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ReferenceEnumFromScopedPackage.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ReferenceEnumFromScopedPackage.cs @@ -3,8 +3,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// See awslabs/jsii#138. - /// stability: Experimental - [JsiiClass(nativeType: typeof(ReferenceEnumFromScopedPackage), fullyQualifiedName: "jsii-calc.ReferenceEnumFromScopedPackage")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ReferenceEnumFromScopedPackage), fullyQualifiedName: "jsii-calc.ReferenceEnumFromScopedPackage")] public class ReferenceEnumFromScopedPackage : DeputyBase { public ReferenceEnumFromScopedPackage(): base(new DeputyProps(new object[]{})) @@ -19,26 +21,32 @@ protected ReferenceEnumFromScopedPackage(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiProperty(name: "foo", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.EnumFromScopedModule\"}", isOptional: true)] - public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.EnumFromScopedModule? Foo + /// + /// stability: Experimental + /// + [JsiiMethod(name: "loadFoo", returnsJson: "{\"optional\":true,\"type\":{\"fqn\":\"@scope/jsii-calc-lib.EnumFromScopedModule\"}}")] + public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.EnumFromScopedModule LoadFoo() { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); + return InvokeInstanceMethod(new object[]{}); } - /// stability: Experimental - [JsiiMethod(name: "loadFoo", returnsJson: "{\"type\":{\"fqn\":\"@scope/jsii-calc-lib.EnumFromScopedModule\"},\"optional\":true}")] - public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.EnumFromScopedModule? LoadFoo() + /// + /// stability: Experimental + /// + [JsiiMethod(name: "saveFoo", parametersJson: "[{\"name\":\"value\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.EnumFromScopedModule\"}}]")] + public virtual void SaveFoo(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.EnumFromScopedModule @value) { - return InvokeInstanceMethod(new object[]{}); + InvokeInstanceVoidMethod(new object[]{@value}); } - /// stability: Experimental - [JsiiMethod(name: "saveFoo", parametersJson: "[{\"name\":\"value\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.EnumFromScopedModule\"}}]")] - public virtual void SaveFoo(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.EnumFromScopedModule value) + /// + /// stability: Experimental + /// + [JsiiProperty(name: "foo", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.EnumFromScopedModule\"}", isOptional: true)] + public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.EnumFromScopedModule? Foo { - InvokeInstanceVoidMethod(new object[]{value}); + get => GetInstanceProperty(); + set => SetInstanceProperty(value); } } -} \ 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/ReturnsPrivateImplementationOfInterface.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ReturnsPrivateImplementationOfInterface.cs index 4e2391070e..e73956a6e2 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ReturnsPrivateImplementationOfInterface.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ReturnsPrivateImplementationOfInterface.cs @@ -2,12 +2,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// Helps ensure the JSII kernel & runtime cooperate correctly when an un-exported instance of a class is returned with a declared type that is an exported interface, and the instance inherits from an exported class. + /// Helps ensure the JSII kernel & runtime cooperate correctly when an un-exported instance of a class is returned with a declared type that is an exported interface, and the instance inherits from an exported class. + /// + /// an instance of an un-exported class that extends `ExportedBaseClass`, declared as `IPrivatelyImplemented`. + /// /// /// stability: Experimental - /// https://github.com/aws/jsii/issues/320 + /// see: + /// https://github.com/aws/jsii/issues/320 /// - [JsiiClass(nativeType: typeof(ReturnsPrivateImplementationOfInterface), fullyQualifiedName: "jsii-calc.ReturnsPrivateImplementationOfInterface")] + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ReturnsPrivateImplementationOfInterface), fullyQualifiedName: "jsii-calc.ReturnsPrivateImplementationOfInterface")] public class ReturnsPrivateImplementationOfInterface : DeputyBase { public ReturnsPrivateImplementationOfInterface(): base(new DeputyProps(new object[]{})) @@ -22,11 +26,13 @@ protected ReturnsPrivateImplementationOfInterface(DeputyProps props): base(props { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "privateImplementation", typeJson: "{\"fqn\":\"jsii-calc.IPrivatelyImplemented\"}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.IIPrivatelyImplemented PrivateImplementation { 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/RuntimeTypeChecking.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/RuntimeTypeChecking.cs index ef9320983b..23fb7ed883 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/RuntimeTypeChecking.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/RuntimeTypeChecking.cs @@ -1,10 +1,11 @@ using Amazon.JSII.Runtime.Deputy; -using System; namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(RuntimeTypeChecking), fullyQualifiedName: "jsii-calc.RuntimeTypeChecking")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.RuntimeTypeChecking), fullyQualifiedName: "jsii-calc.RuntimeTypeChecking")] public class RuntimeTypeChecking : DeputyBase { public RuntimeTypeChecking(): base(new DeputyProps(new object[]{})) @@ -19,26 +20,32 @@ protected RuntimeTypeChecking(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiMethod(name: "methodWithDefaultedArguments", parametersJson: "[{\"name\":\"arg1\",\"type\":{\"primitive\":\"number\"},\"optional\":true},{\"name\":\"arg2\",\"type\":{\"primitive\":\"string\"},\"optional\":true},{\"name\":\"arg3\",\"type\":{\"primitive\":\"date\"},\"optional\":true}]")] - public virtual void MethodWithDefaultedArguments(double? arg1, string arg2, DateTime? arg3) + /// + /// stability: Experimental + /// + [JsiiMethod(name: "methodWithDefaultedArguments", parametersJson: "[{\"name\":\"arg1\",\"optional\":true,\"type\":{\"primitive\":\"number\"}},{\"name\":\"arg2\",\"optional\":true,\"type\":{\"primitive\":\"string\"}},{\"name\":\"arg3\",\"optional\":true,\"type\":{\"primitive\":\"date\"}}]")] + public virtual void MethodWithDefaultedArguments(double? arg1, string arg2, System.DateTime? arg3) { InvokeInstanceVoidMethod(new object[]{arg1, arg2, arg3}); } - /// stability: Experimental - [JsiiMethod(name: "methodWithOptionalAnyArgument", parametersJson: "[{\"name\":\"arg\",\"type\":{\"primitive\":\"any\"},\"optional\":true}]")] + /// + /// stability: Experimental + /// + [JsiiMethod(name: "methodWithOptionalAnyArgument", parametersJson: "[{\"name\":\"arg\",\"optional\":true,\"type\":{\"primitive\":\"any\"}}]")] public virtual void MethodWithOptionalAnyArgument(object arg) { InvokeInstanceVoidMethod(new object[]{arg}); } /// Used to verify verification of number of method arguments. - /// stability: Experimental - [JsiiMethod(name: "methodWithOptionalArguments", parametersJson: "[{\"name\":\"arg1\",\"type\":{\"primitive\":\"number\"}},{\"name\":\"arg2\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"arg3\",\"type\":{\"primitive\":\"date\"},\"optional\":true}]")] - public virtual void MethodWithOptionalArguments(double arg1, string arg2, DateTime? arg3) + /// + /// stability: Experimental + /// + [JsiiMethod(name: "methodWithOptionalArguments", parametersJson: "[{\"name\":\"arg1\",\"type\":{\"primitive\":\"number\"}},{\"name\":\"arg2\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"arg3\",\"optional\":true,\"type\":{\"primitive\":\"date\"}}]")] + public virtual void MethodWithOptionalArguments(double arg1, string arg2, System.DateTime? arg3) { InvokeInstanceVoidMethod(new object[]{arg1, arg2, arg3}); } } -} \ 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/SecondLevelStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SecondLevelStruct.cs index 8bb6eb9ca4..3dbc4c062b 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SecondLevelStruct.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SecondLevelStruct.cs @@ -2,12 +2,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiByValue] public class SecondLevelStruct : Amazon.JSII.Tests.CalculatorNamespace.ISecondLevelStruct { /// It's long and required. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "deeperRequiredProp", typeJson: "{\"primitive\":\"string\"}", isOverride: true)] public string DeeperRequiredProp { @@ -16,7 +20,9 @@ public string DeeperRequiredProp } /// It's long, but you'll almost never pass it. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "deeperOptionalProp", typeJson: "{\"primitive\":\"string\"}", isOptional: true, isOverride: true)] public string DeeperOptionalProp { @@ -24,4 +30,4 @@ public string DeeperOptionalProp 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/SecondLevelStructProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SecondLevelStructProxy.cs index 4160ad011c..fa23095a8f 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SecondLevelStructProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SecondLevelStructProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(ISecondLevelStruct), fullyQualifiedName: "jsii-calc.SecondLevelStruct")] internal sealed class SecondLevelStructProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.ISecondLevelStruct { @@ -11,7 +13,9 @@ private SecondLevelStructProxy(ByRefValue reference): base(reference) } /// It's long and required. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "deeperRequiredProp", typeJson: "{\"primitive\":\"string\"}")] public string DeeperRequiredProp { @@ -19,11 +23,13 @@ public string DeeperRequiredProp } /// It's long, but you'll almost never pass it. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "deeperOptionalProp", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] public string DeeperOptionalProp { 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/SingleInstanceTwoTypes.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SingleInstanceTwoTypes.cs index 031d0574cb..1cab5614eb 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SingleInstanceTwoTypes.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SingleInstanceTwoTypes.cs @@ -9,7 +9,7 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// this it would break runtime type checks in the JVM or CLR. /// stability: Experimental /// - [JsiiClass(nativeType: typeof(SingleInstanceTwoTypes), fullyQualifiedName: "jsii-calc.SingleInstanceTwoTypes")] + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.SingleInstanceTwoTypes), fullyQualifiedName: "jsii-calc.SingleInstanceTwoTypes")] public class SingleInstanceTwoTypes : DeputyBase { public SingleInstanceTwoTypes(): base(new DeputyProps(new object[]{})) @@ -24,18 +24,22 @@ protected SingleInstanceTwoTypes(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "interface1", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.InbetweenClass\"}}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.InbetweenClass Interface1() { return InvokeInstanceMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "interface2", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.IPublicInterface\"}}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.IIPublicInterface Interface2() { return InvokeInstanceMethod(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/SingletonInt.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SingletonInt.cs index 29788fcad0..2a85d9eb22 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SingletonInt.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SingletonInt.cs @@ -7,7 +7,7 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// https://github.com/aws/jsii/issues/231 /// stability: Experimental /// - [JsiiClass(nativeType: typeof(SingletonInt), fullyQualifiedName: "jsii-calc.SingletonInt")] + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.SingletonInt), fullyQualifiedName: "jsii-calc.SingletonInt")] public class SingletonInt : DeputyBase { protected SingletonInt(ByRefValue reference): base(reference) @@ -18,11 +18,13 @@ protected SingletonInt(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "isSingletonInt", returnsJson: "{\"type\":{\"primitive\":\"boolean\"}}", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual bool IsSingletonInt(double value) + public virtual bool IsSingletonInt(double @value) { - return InvokeInstanceMethod(new object[]{value}); + return InvokeInstanceMethod(new object[]{@value}); } } -} \ 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/SingletonIntEnum.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SingletonIntEnum.cs index 631314be96..236de514f1 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SingletonIntEnum.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SingletonIntEnum.cs @@ -2,14 +2,19 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { + /// A singleton integer. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiEnum(nativeType: typeof(SingletonIntEnum), fullyQualifiedName: "jsii-calc.SingletonIntEnum")] public enum SingletonIntEnum { /// Elite! - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiEnumMember(name: "SINGLETON_INT")] SINGLETON_INT } -} \ 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/SingletonString.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SingletonString.cs index 856317a716..84c24c93aa 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SingletonString.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SingletonString.cs @@ -7,7 +7,7 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// https://github.com/aws/jsii/issues/231 /// stability: Experimental /// - [JsiiClass(nativeType: typeof(SingletonString), fullyQualifiedName: "jsii-calc.SingletonString")] + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.SingletonString), fullyQualifiedName: "jsii-calc.SingletonString")] public class SingletonString : DeputyBase { protected SingletonString(ByRefValue reference): base(reference) @@ -18,11 +18,13 @@ protected SingletonString(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "isSingletonString", returnsJson: "{\"type\":{\"primitive\":\"boolean\"}}", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"string\"}}]")] - public virtual bool IsSingletonString(string value) + public virtual bool IsSingletonString(string @value) { - return InvokeInstanceMethod(new object[]{value}); + return InvokeInstanceMethod(new object[]{@value}); } } -} \ 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/SingletonStringEnum.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SingletonStringEnum.cs index d538cbc616..dcb4fa7e80 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SingletonStringEnum.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SingletonStringEnum.cs @@ -2,14 +2,19 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { + /// A singleton string. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiEnum(nativeType: typeof(SingletonStringEnum), fullyQualifiedName: "jsii-calc.SingletonStringEnum")] public enum SingletonStringEnum { /// 1337. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiEnumMember(name: "SINGLETON_STRING")] SINGLETON_STRING } -} \ 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/StableClass.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StableClass.cs index 21d94ee115..86c453692a 100644 --- 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 @@ -2,11 +2,15 @@ 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}]")] + /// + /// stability: Stable + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.StableClass), fullyQualifiedName: "jsii-calc.StableClass", parametersJson: "[{\"name\":\"readonlyString\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"mutableNumber\",\"optional\":true,\"type\":{\"primitive\":\"number\"}}]")] public class StableClass : DeputyBase { - /// stability: Stable + /// + /// stability: Stable + /// public StableClass(string readonlyString, double? mutableNumber): base(new DeputyProps(new object[]{readonlyString, mutableNumber})) { } @@ -19,26 +23,32 @@ protected StableClass(DeputyProps props): base(props) { } - /// stability: Stable + /// + /// stability: Stable + /// + [JsiiMethod(name: "method")] + public virtual void Method() + { + InvokeInstanceVoidMethod(new object[]{}); + } + + /// + /// stability: Stable + /// [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] public virtual string ReadonlyProperty { get => GetInstanceProperty(); } - /// stability: Stable + /// + /// stability: Stable + /// [JsiiProperty(name: "mutableProperty", typeJson: "{\"primitive\":\"number\"}", isOptional: true)] public virtual double? MutableProperty { - get => GetInstanceProperty(); + 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 index 2fa56c7550..b221a04acf 100644 --- 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 @@ -2,15 +2,22 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Stable + + /// + /// stability: Stable + /// [JsiiEnum(nativeType: typeof(StableEnum), fullyQualifiedName: "jsii-calc.StableEnum")] public enum StableEnum { - /// stability: Stable + /// + /// stability: Stable + /// [JsiiEnumMember(name: "OPTION_A")] OPTION_A, - /// stability: Stable + /// + /// stability: Stable + /// [JsiiEnumMember(name: "OPTION_B")] OPTION_B } -} \ 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 index e12a147839..6ea50e0221 100644 --- 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 @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Stable + /// + /// stability: Stable + /// [JsiiByValue] public class StableStruct : Amazon.JSII.Tests.CalculatorNamespace.IStableStruct { - /// stability: Stable + /// + /// stability: Stable + /// [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}", isOverride: true)] public string ReadonlyProperty { @@ -14,4 +18,4 @@ public string ReadonlyProperty 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 index e87385bf52..9a296e9042 100644 --- 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 @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Stable + /// + /// stability: Stable + /// [JsiiTypeProxy(nativeType: typeof(IStableStruct), fullyQualifiedName: "jsii-calc.StableStruct")] internal sealed class StableStructProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IStableStruct { @@ -10,11 +12,13 @@ private StableStructProxy(ByRefValue reference): base(reference) { } - /// stability: Stable + /// + /// 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/StaticContext.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StaticContext.cs index c045df1ad7..cce773a9a4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StaticContext.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StaticContext.cs @@ -7,7 +7,7 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// https://github.com/awslabs/aws-cdk/issues/2304 /// stability: Experimental /// - [JsiiClass(nativeType: typeof(StaticContext), fullyQualifiedName: "jsii-calc.StaticContext")] + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.StaticContext), fullyQualifiedName: "jsii-calc.StaticContext")] public class StaticContext : DeputyBase { protected StaticContext(ByRefValue reference): base(reference) @@ -18,19 +18,23 @@ protected StaticContext(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiProperty(name: "staticVariable", typeJson: "{\"primitive\":\"boolean\"}")] - public static bool StaticVariable + /// + /// stability: Experimental + /// + [JsiiMethod(name: "canAccessStaticContext", returnsJson: "{\"type\":{\"primitive\":\"boolean\"}}")] + public static bool CanAccessStaticContext() { - get => GetStaticProperty(typeof(StaticContext)); - set => SetStaticProperty(typeof(StaticContext), value); + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.StaticContext), new object[]{}); } - /// stability: Experimental - [JsiiMethod(name: "canAccessStaticContext", returnsJson: "{\"type\":{\"primitive\":\"boolean\"}}")] - public static bool CanAccessStaticContext() + /// + /// stability: Experimental + /// + [JsiiProperty(name: "staticVariable", typeJson: "{\"primitive\":\"boolean\"}")] + public static bool StaticVariable { - return InvokeStaticMethod(typeof(StaticContext), new object[]{}); + get => GetStaticProperty(typeof(Amazon.JSII.Tests.CalculatorNamespace.StaticContext)); + set => SetStaticProperty(typeof(Amazon.JSII.Tests.CalculatorNamespace.StaticContext), value); } } -} \ 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/Statics.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Statics.cs index 0cbb997a13..6d2ea99961 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Statics.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Statics.cs @@ -1,14 +1,17 @@ using Amazon.JSII.Runtime.Deputy; -using System.Collections.Generic; namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(Statics), fullyQualifiedName: "jsii-calc.Statics", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"string\"}}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Statics), fullyQualifiedName: "jsii-calc.Statics", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"string\"}}]")] public class Statics : DeputyBase { - /// stability: Experimental - public Statics(string value): base(new DeputyProps(new object[]{value})) + /// + /// stability: Experimental + /// + public Statics(string @value): base(new DeputyProps(new object[]{@value})) { } @@ -20,79 +23,97 @@ protected Statics(DeputyProps props): base(props) { } + /// Jsdocs for static method. + /// The name of the person to say hello to. + /// + /// stability: Experimental + /// + [JsiiMethod(name: "staticMethod", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"docs\":{\"summary\":\"The name of the person to say hello to.\"},\"name\":\"name\",\"type\":{\"primitive\":\"string\"}}]")] + public static string StaticMethod(string name) + { + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.Statics), new object[]{name}); + } + + /// + /// stability: Experimental + /// + [JsiiMethod(name: "justMethod", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] + public virtual string JustMethod() + { + return InvokeInstanceMethod(new object[]{}); + } + /// Constants may also use all-caps. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "BAR", typeJson: "{\"primitive\":\"number\"}")] public static double BAR { get; } + = GetStaticProperty(typeof(Amazon.JSII.Tests.CalculatorNamespace.Statics)); - = GetStaticProperty(typeof(Statics)); - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "ConstObj", typeJson: "{\"fqn\":\"jsii-calc.DoubleTrouble\"}")] public static Amazon.JSII.Tests.CalculatorNamespace.DoubleTrouble ConstObj { get; } + = GetStaticProperty(typeof(Amazon.JSII.Tests.CalculatorNamespace.Statics)); - = GetStaticProperty(typeof(Statics)); /// Jsdocs for static property. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "Foo", typeJson: "{\"primitive\":\"string\"}")] public static string Foo { get; } + = GetStaticProperty(typeof(Amazon.JSII.Tests.CalculatorNamespace.Statics)); - = GetStaticProperty(typeof(Statics)); /// Constants can also use camelCase. - /// stability: Experimental - [JsiiProperty(name: "zooBar", typeJson: "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"primitive\":\"string\"}}}")] - public static IDictionary ZooBar + /// + /// stability: Experimental + /// + [JsiiProperty(name: "zooBar", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"string\"},\"kind\":\"map\"}}")] + public static System.Collections.Generic.IDictionary ZooBar { get; } + = GetStaticProperty>(typeof(Amazon.JSII.Tests.CalculatorNamespace.Statics)); - = GetStaticProperty>(typeof(Statics)); /// Jsdocs for static getter. Jsdocs for static setter. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "instance", typeJson: "{\"fqn\":\"jsii-calc.Statics\"}")] public static Amazon.JSII.Tests.CalculatorNamespace.Statics Instance { - get => GetStaticProperty(typeof(Statics)); - set => SetStaticProperty(typeof(Statics), value); + get => GetStaticProperty(typeof(Amazon.JSII.Tests.CalculatorNamespace.Statics)); + set => SetStaticProperty(typeof(Amazon.JSII.Tests.CalculatorNamespace.Statics), value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "nonConstStatic", typeJson: "{\"primitive\":\"number\"}")] public static double NonConstStatic { - get => GetStaticProperty(typeof(Statics)); - set => SetStaticProperty(typeof(Statics), value); + get => GetStaticProperty(typeof(Amazon.JSII.Tests.CalculatorNamespace.Statics)); + set => SetStaticProperty(typeof(Amazon.JSII.Tests.CalculatorNamespace.Statics), value); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"string\"}")] public virtual string Value { get => GetInstanceProperty(); } - - /// Jsdocs for static method. - /// The name of the person to say hello to. - /// stability: Experimental - [JsiiMethod(name: "staticMethod", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"name\",\"type\":{\"primitive\":\"string\"}}]")] - public static string StaticMethod(string name) - { - return InvokeStaticMethod(typeof(Statics), new object[]{name}); - } - - /// stability: Experimental - [JsiiMethod(name: "justMethod", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] - public virtual string JustMethod() - { - return InvokeInstanceMethod(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/StringEnum.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StringEnum.cs index 35d62a6a04..417f4df884 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StringEnum.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StringEnum.cs @@ -2,18 +2,27 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + + /// + /// stability: Experimental + /// [JsiiEnum(nativeType: typeof(StringEnum), fullyQualifiedName: "jsii-calc.StringEnum")] public enum StringEnum { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiEnumMember(name: "A")] A, - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiEnumMember(name: "B")] B, - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiEnumMember(name: "C")] C } -} \ 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/StripInternal.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StripInternal.cs index f44a0bc819..f1a990df17 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StripInternal.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StripInternal.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(StripInternal), fullyQualifiedName: "jsii-calc.StripInternal")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.StripInternal), fullyQualifiedName: "jsii-calc.StripInternal")] public class StripInternal : DeputyBase { public StripInternal(): base(new DeputyProps(new object[]{})) @@ -18,7 +20,9 @@ protected StripInternal(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "youSeeMe", typeJson: "{\"primitive\":\"string\"}")] public virtual string YouSeeMe { @@ -26,4 +30,4 @@ public virtual string YouSeeMe set => SetInstanceProperty(value); } } -} \ 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/StructPassing.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StructPassing.cs index 6a3209b68d..32f792f140 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StructPassing.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StructPassing.cs @@ -3,8 +3,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Just because we can. - /// stability: External - [JsiiClass(nativeType: typeof(StructPassing), fullyQualifiedName: "jsii-calc.StructPassing")] + /// + /// stability: External + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.StructPassing), fullyQualifiedName: "jsii-calc.StructPassing")] public class StructPassing : DeputyBase { public StructPassing(): base(new DeputyProps(new object[]{})) @@ -19,18 +21,22 @@ protected StructPassing(DeputyProps props): base(props) { } - /// stability: External - [JsiiMethod(name: "howManyVarArgsDidIPass", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"_positional\",\"type\":{\"primitive\":\"number\"}},{\"name\":\"inputs\",\"variadic\":true,\"type\":{\"fqn\":\"jsii-calc.TopLevelStruct\"}}]")] - public static double HowManyVarArgsDidIPass(double _positional, Amazon.JSII.Tests.CalculatorNamespace.ITopLevelStruct inputs) + /// + /// stability: External + /// + [JsiiMethod(name: "howManyVarArgsDidIPass", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"_positional\",\"type\":{\"primitive\":\"number\"}},{\"name\":\"inputs\",\"type\":{\"fqn\":\"jsii-calc.TopLevelStruct\"},\"variadic\":true}]")] + public static double HowManyVarArgsDidIPass(double positional, Amazon.JSII.Tests.CalculatorNamespace.ITopLevelStruct inputs) { - return InvokeStaticMethod(typeof(StructPassing), new object[]{_positional, inputs}); + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.StructPassing), new object[]{positional, inputs}); } - /// stability: External + /// + /// stability: External + /// [JsiiMethod(name: "roundTrip", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.TopLevelStruct\"}}", parametersJson: "[{\"name\":\"_positional\",\"type\":{\"primitive\":\"number\"}},{\"name\":\"input\",\"type\":{\"fqn\":\"jsii-calc.TopLevelStruct\"}}]")] - public static Amazon.JSII.Tests.CalculatorNamespace.ITopLevelStruct RoundTrip(double _positional, Amazon.JSII.Tests.CalculatorNamespace.ITopLevelStruct input) + public static Amazon.JSII.Tests.CalculatorNamespace.ITopLevelStruct RoundTrip(double positional, Amazon.JSII.Tests.CalculatorNamespace.ITopLevelStruct input) { - return InvokeStaticMethod(typeof(StructPassing), new object[]{_positional, input}); + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.StructPassing), new object[]{positional, input}); } } -} \ 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/Sum.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Sum.cs index 435a4e6f35..dd6b980f01 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Sum.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Sum.cs @@ -3,11 +3,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// An operation that sums multiple values. - /// stability: Experimental - [JsiiClass(nativeType: typeof(Sum), fullyQualifiedName: "jsii-calc.Sum")] - public class Sum : Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperation_ + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Sum), fullyQualifiedName: "jsii-calc.Sum")] + public class Sum : Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperation { - /// stability: Experimental + /// + /// stability: Experimental + /// public Sum(): base(new DeputyProps(new object[]{})) { } @@ -21,7 +25,9 @@ protected Sum(DeputyProps props): base(props) } /// The expression that this operation consists of. Must be implemented by derived classes. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "expression", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] public override Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Expression { @@ -29,12 +35,14 @@ public override Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Expres } /// The parts to sum. - /// stability: Experimental - [JsiiProperty(name: "parts", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}}")] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "parts", typeJson: "{\"collection\":{\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"},\"kind\":\"array\"}}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_[] Parts { get => GetInstanceProperty(); set => SetInstanceProperty(value); } } -} \ 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/SyncVirtualMethods.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SyncVirtualMethods.cs index d87c02eb98..04ecc4ad9a 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SyncVirtualMethods.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/SyncVirtualMethods.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(SyncVirtualMethods), fullyQualifiedName: "jsii-calc.SyncVirtualMethods")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.SyncVirtualMethods), fullyQualifiedName: "jsii-calc.SyncVirtualMethods")] public class SyncVirtualMethods : DeputyBase { public SyncVirtualMethods(): base(new DeputyProps(new object[]{})) @@ -18,121 +20,153 @@ protected SyncVirtualMethods(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] - public virtual string ReadonlyProperty - { - get => GetInstanceProperty(); - } - - /// stability: Experimental - [JsiiProperty(name: "a", typeJson: "{\"primitive\":\"number\"}")] - public virtual double A - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - - /// stability: Experimental - [JsiiProperty(name: "callerIsProperty", typeJson: "{\"primitive\":\"number\"}")] - public virtual double CallerIsProperty - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - - /// stability: Experimental - [JsiiProperty(name: "otherProperty", typeJson: "{\"primitive\":\"string\"}")] - public virtual string OtherProperty - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - - /// stability: Experimental - [JsiiProperty(name: "theProperty", typeJson: "{\"primitive\":\"string\"}")] - public virtual string TheProperty - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - - /// stability: Experimental - [JsiiProperty(name: "valueOfOtherProperty", typeJson: "{\"primitive\":\"string\"}")] - public virtual string ValueOfOtherProperty - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "callerIsAsync", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", isAsync: true)] public virtual double CallerIsAsync() { return InvokeInstanceMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "callerIsMethod", returnsJson: "{\"type\":{\"primitive\":\"number\"}}")] public virtual double CallerIsMethod() { return InvokeInstanceMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "modifyOtherProperty", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"string\"}}]")] - public virtual void ModifyOtherProperty(string value) + public virtual void ModifyOtherProperty(string @value) { - InvokeInstanceVoidMethod(new object[]{value}); + InvokeInstanceVoidMethod(new object[]{@value}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "modifyValueOfTheProperty", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"string\"}}]")] - public virtual void ModifyValueOfTheProperty(string value) + public virtual void ModifyValueOfTheProperty(string @value) { - InvokeInstanceVoidMethod(new object[]{value}); + InvokeInstanceVoidMethod(new object[]{@value}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "readA", returnsJson: "{\"type\":{\"primitive\":\"number\"}}")] public virtual double ReadA() { return InvokeInstanceMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "retrieveOtherProperty", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] public virtual string RetrieveOtherProperty() { return InvokeInstanceMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "retrieveReadOnlyProperty", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] public virtual string RetrieveReadOnlyProperty() { return InvokeInstanceMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "retrieveValueOfTheProperty", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] public virtual string RetrieveValueOfTheProperty() { return InvokeInstanceMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "virtualMethod", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"n\",\"type\":{\"primitive\":\"number\"}}]")] public virtual double VirtualMethod(double n) { return InvokeInstanceMethod(new object[]{n}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "writeA", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual void WriteA(double value) + public virtual void WriteA(double @value) { - InvokeInstanceVoidMethod(new object[]{value}); + InvokeInstanceVoidMethod(new object[]{@value}); + } + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "readonlyProperty", typeJson: "{\"primitive\":\"string\"}")] + public virtual string ReadonlyProperty + { + get => GetInstanceProperty(); + } + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "a", typeJson: "{\"primitive\":\"number\"}")] + public virtual double A + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "callerIsProperty", typeJson: "{\"primitive\":\"number\"}")] + public virtual double CallerIsProperty + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "otherProperty", typeJson: "{\"primitive\":\"string\"}")] + public virtual string OtherProperty + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "theProperty", typeJson: "{\"primitive\":\"string\"}")] + public virtual string TheProperty + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "valueOfOtherProperty", typeJson: "{\"primitive\":\"string\"}")] + public virtual string ValueOfOtherProperty + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); } } -} \ 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/Thrower.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Thrower.cs index 30ebc46af7..f7e9b10b84 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Thrower.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Thrower.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(Thrower), fullyQualifiedName: "jsii-calc.Thrower")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Thrower), fullyQualifiedName: "jsii-calc.Thrower")] public class Thrower : DeputyBase { public Thrower(): base(new DeputyProps(new object[]{})) @@ -18,11 +20,13 @@ protected Thrower(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "throwError")] public virtual void ThrowError() { 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/TopLevelStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/TopLevelStruct.cs index 643e6de3fc..107d1c91e6 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/TopLevelStruct.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/TopLevelStruct.cs @@ -2,12 +2,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiByValue] public class TopLevelStruct : Amazon.JSII.Tests.CalculatorNamespace.ITopLevelStruct { /// This is a required field. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "required", typeJson: "{\"primitive\":\"string\"}", isOverride: true)] public string Required { @@ -16,7 +20,9 @@ public string Required } /// A union to really stress test our serialization. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "secondLevel", typeJson: "{\"union\":{\"types\":[{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.SecondLevelStruct\"}]}}", isOverride: true)] public object SecondLevel { @@ -25,7 +31,9 @@ public object SecondLevel } /// You don't have to pass this. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "optional", typeJson: "{\"primitive\":\"string\"}", isOptional: true, isOverride: true)] public string Optional { @@ -33,4 +41,4 @@ public string Optional 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/TopLevelStructProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/TopLevelStructProxy.cs index 96fa076fbe..274ccb3ce9 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/TopLevelStructProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/TopLevelStructProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(ITopLevelStruct), fullyQualifiedName: "jsii-calc.TopLevelStruct")] internal sealed class TopLevelStructProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.ITopLevelStruct { @@ -11,7 +13,9 @@ private TopLevelStructProxy(ByRefValue reference): base(reference) } /// This is a required field. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "required", typeJson: "{\"primitive\":\"string\"}")] public string Required { @@ -19,7 +23,9 @@ public string Required } /// A union to really stress test our serialization. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "secondLevel", typeJson: "{\"union\":{\"types\":[{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.SecondLevelStruct\"}]}}")] public object SecondLevel { @@ -27,11 +33,13 @@ public object SecondLevel } /// You don't have to pass this. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "optional", typeJson: "{\"primitive\":\"string\"}", isOptional: true)] public string Optional { 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/UnaryOperation.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UnaryOperation.cs index 1bb70a1a0d..2f8b8258a2 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UnaryOperation.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UnaryOperation.cs @@ -3,11 +3,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// An operation on a single operand. - /// stability: Experimental - [JsiiClass(nativeType: typeof(UnaryOperation), fullyQualifiedName: "jsii-calc.UnaryOperation", parametersJson: "[{\"name\":\"operand\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.UnaryOperation), fullyQualifiedName: "jsii-calc.UnaryOperation", parametersJson: "[{\"name\":\"operand\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}]")] public abstract class UnaryOperation : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Operation { - /// stability: Experimental + /// + /// stability: Experimental + /// protected UnaryOperation(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ operand): base(new DeputyProps(new object[]{operand})) { } @@ -20,11 +24,13 @@ protected UnaryOperation(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "operand", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Operand { 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/UnaryOperationProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UnaryOperationProxy.cs index fadb207ed2..bfd8ed5652 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UnaryOperationProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UnaryOperationProxy.cs @@ -3,8 +3,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// An operation on a single operand. - /// stability: Experimental - [JsiiTypeProxy(nativeType: typeof(UnaryOperation), fullyQualifiedName: "jsii-calc.UnaryOperation")] + /// + /// stability: Experimental + /// + [JsiiTypeProxy(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.UnaryOperation), fullyQualifiedName: "jsii-calc.UnaryOperation")] internal sealed class UnaryOperationProxy : Amazon.JSII.Tests.CalculatorNamespace.UnaryOperation { private UnaryOperationProxy(ByRefValue reference): base(reference) @@ -12,7 +14,9 @@ private UnaryOperationProxy(ByRefValue reference): base(reference) } /// The value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"number\"}")] [System.Obsolete()] public override double Value @@ -21,7 +25,9 @@ public override double Value } /// String representation of the value. - /// stability: Deprecated + /// + /// stability: Deprecated + /// [JsiiMethod(name: "toString", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] [System.Obsolete()] public override string ToString() @@ -29,4 +35,4 @@ public override string ToString() return InvokeInstanceMethod(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/UnionProperties.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UnionProperties.cs index 1d9724b1c2..71b5875699 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UnionProperties.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UnionProperties.cs @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiByValue] public class UnionProperties : Amazon.JSII.Tests.CalculatorNamespace.IUnionProperties { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "bar", typeJson: "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.AllTypes\"}]}}", isOverride: true)] public object Bar { @@ -14,7 +18,9 @@ public object Bar set; } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "foo", typeJson: "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"}]}}", isOptional: true, isOverride: true)] public object Foo { @@ -22,4 +28,4 @@ public object Foo 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/UnionPropertiesProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UnionPropertiesProxy.cs index 3081fc51bc..41c79d7eea 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UnionPropertiesProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UnionPropertiesProxy.cs @@ -2,7 +2,9 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiTypeProxy(nativeType: typeof(IUnionProperties), fullyQualifiedName: "jsii-calc.UnionProperties")] internal sealed class UnionPropertiesProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IUnionProperties { @@ -10,18 +12,22 @@ private UnionPropertiesProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "bar", typeJson: "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.AllTypes\"}]}}")] public object Bar { get => GetInstanceProperty(); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "foo", typeJson: "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"}]}}", isOptional: true)] public object Foo { 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/UseBundledDependency.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UseBundledDependency.cs index ecf2dcc558..517e260907 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UseBundledDependency.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UseBundledDependency.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(UseBundledDependency), fullyQualifiedName: "jsii-calc.UseBundledDependency")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.UseBundledDependency), fullyQualifiedName: "jsii-calc.UseBundledDependency")] public class UseBundledDependency : DeputyBase { public UseBundledDependency(): base(new DeputyProps(new object[]{})) @@ -18,11 +20,13 @@ protected UseBundledDependency(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "value", returnsJson: "{\"type\":{\"primitive\":\"any\"}}")] public virtual object Value() { return InvokeInstanceMethod(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/UseCalcBase.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UseCalcBase.cs index a656237478..a9d8201ec5 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UseCalcBase.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UseCalcBase.cs @@ -3,8 +3,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Depend on a type from jsii-calc-base as a test for awslabs/jsii#128. - /// stability: Experimental - [JsiiClass(nativeType: typeof(UseCalcBase), fullyQualifiedName: "jsii-calc.UseCalcBase")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.UseCalcBase), fullyQualifiedName: "jsii-calc.UseCalcBase")] public class UseCalcBase : DeputyBase { public UseCalcBase(): base(new DeputyProps(new object[]{})) @@ -19,11 +21,13 @@ protected UseCalcBase(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "hello", returnsJson: "{\"type\":{\"fqn\":\"@scope/jsii-calc-base.Base\"}}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.Base Hello() { return InvokeInstanceMethod(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/UsesInterfaceWithProperties.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UsesInterfaceWithProperties.cs index 229f9257cd..3b5cf8b8f0 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UsesInterfaceWithProperties.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UsesInterfaceWithProperties.cs @@ -2,11 +2,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(UsesInterfaceWithProperties), fullyQualifiedName: "jsii-calc.UsesInterfaceWithProperties", parametersJson: "[{\"name\":\"obj\",\"type\":{\"fqn\":\"jsii-calc.IInterfaceWithProperties\"}}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.UsesInterfaceWithProperties), fullyQualifiedName: "jsii-calc.UsesInterfaceWithProperties", parametersJson: "[{\"name\":\"obj\",\"type\":{\"fqn\":\"jsii-calc.IInterfaceWithProperties\"}}]")] public class UsesInterfaceWithProperties : DeputyBase { - /// stability: Experimental + /// + /// stability: Experimental + /// public UsesInterfaceWithProperties(Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceWithProperties obj): base(new DeputyProps(new object[]{obj})) { } @@ -19,32 +23,40 @@ protected UsesInterfaceWithProperties(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiProperty(name: "obj", typeJson: "{\"fqn\":\"jsii-calc.IInterfaceWithProperties\"}")] - public virtual Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceWithProperties Obj - { - get => GetInstanceProperty(); - } - - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "justRead", returnsJson: "{\"type\":{\"primitive\":\"string\"}}")] public virtual string JustRead() { return InvokeInstanceMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "readStringAndNumber", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"ext\",\"type\":{\"fqn\":\"jsii-calc.IInterfaceWithPropertiesExtension\"}}]")] public virtual string ReadStringAndNumber(Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceWithPropertiesExtension ext) { return InvokeInstanceMethod(new object[]{ext}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "writeAndRead", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", parametersJson: "[{\"name\":\"value\",\"type\":{\"primitive\":\"string\"}}]")] - public virtual string WriteAndRead(string value) + public virtual string WriteAndRead(string @value) { - return InvokeInstanceMethod(new object[]{value}); + return InvokeInstanceMethod(new object[]{@value}); + } + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "obj", typeJson: "{\"fqn\":\"jsii-calc.IInterfaceWithProperties\"}")] + public virtual Amazon.JSII.Tests.CalculatorNamespace.IIInterfaceWithProperties Obj + { + 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 64fb828cdc..ef2a10b816 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 @@ -2,12 +2,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(VariadicMethod), fullyQualifiedName: "jsii-calc.VariadicMethod", parametersJson: "[{\"name\":\"prefix\",\"variadic\":true,\"type\":{\"primitive\":\"number\"}}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.VariadicMethod), fullyQualifiedName: "jsii-calc.VariadicMethod", parametersJson: "[{\"docs\":{\"summary\":\"a prefix that will be use for all values returned by `#asArray`.\"},\"name\":\"prefix\",\"type\":{\"primitive\":\"number\"},\"variadic\":true}]")] public class VariadicMethod : DeputyBase { /// a prefix that will be use for all values returned by `#asArray`. - /// stability: Experimental + /// + /// stability: Experimental + /// public VariadicMethod(double prefix): base(new DeputyProps(new object[]{prefix})) { } @@ -22,11 +26,13 @@ protected VariadicMethod(DeputyProps props): base(props) /// the first element of the array to be returned (after the `prefix` provided at construction time). /// other elements to be included in the array. - /// stability: Experimental - [JsiiMethod(name: "asArray", returnsJson: "{\"type\":{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"number\"}}}}", parametersJson: "[{\"name\":\"first\",\"type\":{\"primitive\":\"number\"}},{\"name\":\"others\",\"variadic\":true,\"type\":{\"primitive\":\"number\"}}]")] + /// + /// stability: Experimental + /// + [JsiiMethod(name: "asArray", returnsJson: "{\"type\":{\"collection\":{\"elementtype\":{\"primitive\":\"number\"},\"kind\":\"array\"}}}", parametersJson: "[{\"docs\":{\"summary\":\"the first element of the array to be returned (after the `prefix` provided at construction time).\"},\"name\":\"first\",\"type\":{\"primitive\":\"number\"}},{\"docs\":{\"summary\":\"other elements to be included in the array.\"},\"name\":\"others\",\"type\":{\"primitive\":\"number\"},\"variadic\":true}]")] public virtual double[] AsArray(double first, double others) { return InvokeInstanceMethod(new object[]{first, others}); } } -} \ 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/VirtualMethodPlayground.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/VirtualMethodPlayground.cs index 928522269f..5c7b817591 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/VirtualMethodPlayground.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/VirtualMethodPlayground.cs @@ -2,8 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - /// stability: Experimental - [JsiiClass(nativeType: typeof(VirtualMethodPlayground), fullyQualifiedName: "jsii-calc.VirtualMethodPlayground")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.VirtualMethodPlayground), fullyQualifiedName: "jsii-calc.VirtualMethodPlayground")] public class VirtualMethodPlayground : DeputyBase { public VirtualMethodPlayground(): base(new DeputyProps(new object[]{})) @@ -18,39 +20,49 @@ protected VirtualMethodPlayground(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "overrideMeAsync", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"index\",\"type\":{\"primitive\":\"number\"}}]", isAsync: true)] public virtual double OverrideMeAsync(double index) { return InvokeInstanceMethod(new object[]{index}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "overrideMeSync", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"index\",\"type\":{\"primitive\":\"number\"}}]")] public virtual double OverrideMeSync(double index) { return InvokeInstanceMethod(new object[]{index}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "parallelSumAsync", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"count\",\"type\":{\"primitive\":\"number\"}}]", isAsync: true)] public virtual double ParallelSumAsync(double count) { return InvokeInstanceMethod(new object[]{count}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "serialSumAsync", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"count\",\"type\":{\"primitive\":\"number\"}}]", isAsync: true)] public virtual double SerialSumAsync(double count) { return InvokeInstanceMethod(new object[]{count}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "sumSync", returnsJson: "{\"type\":{\"primitive\":\"number\"}}", parametersJson: "[{\"name\":\"count\",\"type\":{\"primitive\":\"number\"}}]")] public virtual double SumSync(double count) { return InvokeInstanceMethod(new object[]{count}); } } -} \ 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/VoidCallback.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/VoidCallback.cs index 35b6bca49b..3e162251d4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/VoidCallback.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/VoidCallback.cs @@ -9,7 +9,7 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// - Verify that `methodWasCalled` is `true`. /// stability: Experimental /// - [JsiiClass(nativeType: typeof(VoidCallback), fullyQualifiedName: "jsii-calc.VoidCallback")] + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.VoidCallback), fullyQualifiedName: "jsii-calc.VoidCallback")] public abstract class VoidCallback : DeputyBase { protected VoidCallback(): base(new DeputyProps(new object[]{})) @@ -24,22 +24,29 @@ protected VoidCallback(DeputyProps props): base(props) { } - /// stability: Experimental - [JsiiProperty(name: "methodWasCalled", typeJson: "{\"primitive\":\"boolean\"}")] - public virtual bool MethodWasCalled - { - get => GetInstanceProperty(); - } - - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "callMe")] public virtual void CallMe() { InvokeInstanceVoidMethod(new object[]{}); } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "overrideMe")] protected abstract void OverrideMe(); + + + /// + /// stability: Experimental + /// + [JsiiProperty(name: "methodWasCalled", typeJson: "{\"primitive\":\"boolean\"}")] + public virtual bool MethodWasCalled + { + 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/VoidCallbackProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/VoidCallbackProxy.cs index 0a42bb8bc9..b23d01ad8c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/VoidCallbackProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/VoidCallbackProxy.cs @@ -9,18 +9,20 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// - Verify that `methodWasCalled` is `true`. /// stability: Experimental /// - [JsiiTypeProxy(nativeType: typeof(VoidCallback), fullyQualifiedName: "jsii-calc.VoidCallback")] + [JsiiTypeProxy(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.VoidCallback), fullyQualifiedName: "jsii-calc.VoidCallback")] internal sealed class VoidCallbackProxy : Amazon.JSII.Tests.CalculatorNamespace.VoidCallback { private VoidCallbackProxy(ByRefValue reference): base(reference) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiMethod(name: "overrideMe")] protected override void OverrideMe() { 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/WithPrivatePropertyInConstructor.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/WithPrivatePropertyInConstructor.cs index df1311762a..84d38c1704 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/WithPrivatePropertyInConstructor.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/WithPrivatePropertyInConstructor.cs @@ -3,11 +3,15 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Verifies that private property declarations in constructor arguments are hidden. - /// stability: Experimental - [JsiiClass(nativeType: typeof(WithPrivatePropertyInConstructor), fullyQualifiedName: "jsii-calc.WithPrivatePropertyInConstructor", parametersJson: "[{\"name\":\"privateField\",\"type\":{\"primitive\":\"string\"},\"optional\":true}]")] + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.WithPrivatePropertyInConstructor), fullyQualifiedName: "jsii-calc.WithPrivatePropertyInConstructor", parametersJson: "[{\"name\":\"privateField\",\"optional\":true,\"type\":{\"primitive\":\"string\"}}]")] public class WithPrivatePropertyInConstructor : DeputyBase { - /// stability: Experimental + /// + /// stability: Experimental + /// public WithPrivatePropertyInConstructor(string privateField): base(new DeputyProps(new object[]{privateField})) { } @@ -20,11 +24,13 @@ protected WithPrivatePropertyInConstructor(DeputyProps props): base(props) { } - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "success", typeJson: "{\"primitive\":\"boolean\"}")] public virtual bool Success { 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/composition/CompositeOperation_.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/composition/CompositeOperation.cs similarity index 53% rename from packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/composition/CompositeOperation_.cs rename to packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/composition/CompositeOperation.cs index 8963345b49..66a6d45bcd 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/composition/CompositeOperation_.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/composition/CompositeOperation.cs @@ -3,24 +3,38 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.composition { /// Abstract operation composed from an expression of other operations. - /// stability: Experimental - [JsiiClass(nativeType: typeof(CompositeOperation_), fullyQualifiedName: "jsii-calc.composition.CompositeOperation")] - public abstract class CompositeOperation_ : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Operation + /// + /// stability: Experimental + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperation), fullyQualifiedName: "jsii-calc.composition.CompositeOperation")] + public abstract class CompositeOperation : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Operation { - protected CompositeOperation_(): base(new DeputyProps(new object[]{})) + protected CompositeOperation(): base(new DeputyProps(new object[]{})) { } - protected CompositeOperation_(ByRefValue reference): base(reference) + protected CompositeOperation(ByRefValue reference): base(reference) { } - protected CompositeOperation_(DeputyProps props): base(props) + protected CompositeOperation(DeputyProps props): base(props) { } + /// String representation of the value. + /// + /// stability: Experimental + /// + [JsiiMethod(name: "toString", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] + public override string ToString() + { + return InvokeInstanceMethod(new object[]{}); + } + /// The expression that this operation consists of. Must be implemented by derived classes. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "expression", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Expression { @@ -28,7 +42,9 @@ public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Express } /// The value. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "value", typeJson: "{\"primitive\":\"number\"}")] public override double Value { @@ -36,8 +52,10 @@ public override double Value } /// A set of postfixes to include in a decorated .toString(). - /// stability: Experimental - [JsiiProperty(name: "decorationPostfixes", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}")] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "decorationPostfixes", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"string\"},\"kind\":\"array\"}}")] public virtual string[] DecorationPostfixes { get => GetInstanceProperty(); @@ -45,8 +63,10 @@ public virtual string[] DecorationPostfixes } /// A set of prefixes to include in a decorated .toString(). - /// stability: Experimental - [JsiiProperty(name: "decorationPrefixes", typeJson: "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}")] + /// + /// stability: Experimental + /// + [JsiiProperty(name: "decorationPrefixes", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"string\"},\"kind\":\"array\"}}")] public virtual string[] DecorationPrefixes { get => GetInstanceProperty(); @@ -54,7 +74,9 @@ public virtual string[] DecorationPrefixes } /// The .toString() style. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "stringStyle", typeJson: "{\"fqn\":\"jsii-calc.composition.CompositeOperation.CompositionStringStyle\"}")] public virtual Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperation.CompositionStringStyle StringStyle { @@ -62,12 +84,25 @@ public virtual Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperat set => SetInstanceProperty(value); } - /// String representation of the value. - /// stability: Experimental - [JsiiMethod(name: "toString", returnsJson: "{\"type\":{\"primitive\":\"string\"}}", isOverride: true)] - public override string ToString() + /// Style of .toString() output for CompositeOperation. + /// + /// stability: Experimental + /// + [JsiiEnum(nativeType: typeof(CompositionStringStyle), fullyQualifiedName: "jsii-calc.composition.CompositeOperation.CompositionStringStyle")] + public enum CompositionStringStyle { - return InvokeInstanceMethod(new object[]{}); + /// Normal string expression. + /// + /// stability: Experimental + /// + [JsiiEnumMember(name: "NORMAL")] + NORMAL, + /// Decorated string expression. + /// + /// stability: Experimental + /// + [JsiiEnumMember(name: "DECORATED")] + DECORATED } } -} \ 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/composition/CompositeOperation/CompositionStringStyle.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/composition/CompositeOperation/CompositionStringStyle.cs deleted file mode 100644 index 19fbebaf6f..0000000000 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/composition/CompositeOperation/CompositionStringStyle.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Amazon.JSII.Runtime.Deputy; - -namespace Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperation -{ - /// Style of .toString() output for CompositeOperation. - /// stability: Experimental - [JsiiEnum(nativeType: typeof(CompositionStringStyle), fullyQualifiedName: "jsii-calc.composition.CompositeOperation.CompositionStringStyle")] - public enum CompositionStringStyle - { - /// Normal string expression. - /// stability: Experimental - [JsiiEnumMember(name: "NORMAL")] - NORMAL, - /// Decorated string expression. - /// stability: Experimental - [JsiiEnumMember(name: "DECORATED")] - DECORATED - } -} \ 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/composition/CompositeOperationProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/composition/CompositeOperationProxy.cs index 86b6ad3421..5d6fe5199d 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/composition/CompositeOperationProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/composition/CompositeOperationProxy.cs @@ -3,20 +3,24 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.composition { /// Abstract operation composed from an expression of other operations. - /// stability: Experimental - [JsiiTypeProxy(nativeType: typeof(CompositeOperation_), fullyQualifiedName: "jsii-calc.composition.CompositeOperation")] - internal sealed class CompositeOperationProxy : Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperation_ + /// + /// stability: Experimental + /// + [JsiiTypeProxy(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperation), fullyQualifiedName: "jsii-calc.composition.CompositeOperation")] + internal sealed class CompositeOperationProxy : Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperation { private CompositeOperationProxy(ByRefValue reference): base(reference) { } /// The expression that this operation consists of. Must be implemented by derived classes. - /// stability: Experimental + /// + /// stability: Experimental + /// [JsiiProperty(name: "expression", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] public override Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Value_ Expression { get => GetInstanceProperty(); } } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/AssemblyInfo.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/AssemblyInfo.cs index d731202dc0..d3ffb746c3 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/AssemblyInfo.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/AssemblyInfo.cs @@ -1,3 +1,3 @@ using Amazon.JSII.Runtime.Deputy; -[assembly: JsiiAssembly("jsii-calc", "0.14.2", "jsii-calc-0.14.2.tgz")] \ No newline at end of file +[assembly: JsiiAssembly("jsii-calc", "0.14.2", "jsii-calc-0.14.2.tgz")]