From 343529db33259cd1110112fb57159cbf0fdd59e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=91=A8=F0=9F=8F=BC=E2=80=8D=F0=9F=92=BB=20Romain=20M?= =?UTF-8?q?arcadier-Muller?= Date: Tue, 14 Aug 2018 09:06:13 +0200 Subject: [PATCH 1/4] Sort member arrays (properties and methods), to produce fully sorted assemblies --- packages/jsii/lib/compiler.ts | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/packages/jsii/lib/compiler.ts b/packages/jsii/lib/compiler.ts index 6b7c1e2008..e7798729db 100644 --- a/packages/jsii/lib/compiler.ts +++ b/packages/jsii/lib/compiler.ts @@ -12,6 +12,7 @@ import { getCompilerOptions, saveCompilerOptions, saveLinterOptions } from './co import { fileSystemLoader, includeAndRenderExamples, loadFromFile } from './literate'; import readPackageMetadata from './package-metadata'; import { filterEmpty } from './util'; +import { loadProjectInfo } from './project-info'; // tslint:disable-next-line:no-var-requires const sortJson = require('sort-json'); @@ -80,13 +81,35 @@ export async function compilePackage(packageDir: string, includeDirs = [ 'test', * Normalizes (aka sorts) and fingerprints the assembly. */ function normalizeAssembly() { - const sorted = sortJson(assm); + const sorted: spec.Assembly = sortJson(assm); + for (const type of Object.values(sorted.types || {})) { + if (spec.isClassOrInterfaceType(type)) { + type.methods = type.methods && _sortMembers(type.methods); + type.properties = type.properties && _sortMembers(type.properties); + } + } // Not accounting for the 'fingerprint' field when fingerprinting. delete sorted.fingerprint; const fingerprint = crypto.createHash('sha256') - .update(JSON.stringify(sortJson(sorted), filterEmpty)) + .update(JSON.stringify(sorted, filterEmpty)) .digest('base64'); - return { fingerprint, ...sorted } as spec.Assembly; + return { ...sorted, fingerprint } as spec.Assembly; + + /** + * Sort members (aka Methods or Properties) so static members are listed before non-static members, and members + * of each group are listed in alphanumerical order. + * + * @param arr the elements to sort + * + * @return a sorted copy of ``arr``. + */ + function _sortMembers(arr: T[]): T[] { + return arr.sort((lval: T, rval: T) => { + const lstr = `${lval.static ? '0' : '1'}|${lval.name}`; + const rstr = `${rval.static ? '0' : '1'}|${rval.name}`; + return lstr.localeCompare(rstr); + }); + } } } From 45a5cdfadde10c64559a5da90fa7bc4b5002bea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=91=A8=F0=9F=8F=BC=E2=80=8D=F0=9F=92=BB=20Romain=20M?= =?UTF-8?q?arcadier-Muller?= Date: Tue, 14 Aug 2018 10:13:57 +0200 Subject: [PATCH 2/4] Use project references between the `jsii` and `jsii-spec` modules, and isolate the `test` typescript configuration. --- packages/jsii-spec/package.json | 6 +- packages/jsii-spec/test/tsconfig.json | 63 ++++++++++++++++++++ packages/jsii-spec/tsconfig.json | 13 ++++- packages/jsii/lib/compiler.ts | 1 - packages/jsii/package.json | 8 +-- packages/jsii/test/jsii-test/package.json | 10 ++-- packages/jsii/test/test.package-metadata.ts | 6 +- packages/jsii/test/tsconfig.json | 64 +++++++++++++++++++++ packages/jsii/tsconfig.json | 13 ++++- 9 files changed, 166 insertions(+), 18 deletions(-) create mode 100644 packages/jsii-spec/test/tsconfig.json create mode 100644 packages/jsii/test/tsconfig.json diff --git a/packages/jsii-spec/package.json b/packages/jsii-spec/package.json index c4c3ee8069..474372aa5b 100644 --- a/packages/jsii-spec/package.json +++ b/packages/jsii-spec/package.json @@ -5,9 +5,9 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch": "tsc -w", - "build": "tsc && bash generate-json-schema.sh", - "test": "nodeunit test/test.*.js", + "watch": "tsc -b -w", + "build": "tsc -b && bash generate-json-schema.sh", + "test": "tsc -b test && nodeunit test/test.*.js", "package": "package-js" }, "devDependencies": { diff --git a/packages/jsii-spec/test/tsconfig.json b/packages/jsii-spec/test/tsconfig.json new file mode 100644 index 0000000000..b8b7a9e63c --- /dev/null +++ b/packages/jsii-spec/test/tsconfig.json @@ -0,0 +1,63 @@ +{ + "compilerOptions": { + /* Basic Options */ + "target": "ES2018", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + "lib": ["es2016", "es2017.object", "es2017.string"], /* Specify library files to be included in the compilation: */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + "strictNullChecks": true, /* Enable strict null checks. */ + "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + "strictPropertyInitialization": false, /* DO NOT Raise error on class attribute not initialized by constructor. */ + + /* Additional Checks */ + "noUnusedLocals": true, /* Report errors on unused locals. */ + "noUnusedParameters": true, /* Report errors on unused parameters. */ + "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + + /* Source Map Options */ + // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": false, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": false, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + }, + "include": [ + "**/*.ts" + ], + "exclude": [ + "**/*.d.ts" + ], + "references": [ + { "path": ".." } + ] +} diff --git a/packages/jsii-spec/tsconfig.json b/packages/jsii-spec/tsconfig.json index 6f8f29cf64..9b1b0b8fe7 100644 --- a/packages/jsii-spec/tsconfig.json +++ b/packages/jsii-spec/tsconfig.json @@ -48,7 +48,16 @@ // "inlineSources": false, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ /* Experimental Options */ - "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */ + "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - } + "composite": true /* Allow the project to be referenced by others */ + }, + "include": [ + "**/*.ts" + ], + "exclude": [ + "**/*.d.ts", + "node_modules", + "test" + ] } diff --git a/packages/jsii/lib/compiler.ts b/packages/jsii/lib/compiler.ts index e7798729db..077137b638 100644 --- a/packages/jsii/lib/compiler.ts +++ b/packages/jsii/lib/compiler.ts @@ -12,7 +12,6 @@ import { getCompilerOptions, saveCompilerOptions, saveLinterOptions } from './co import { fileSystemLoader, includeAndRenderExamples, loadFromFile } from './literate'; import readPackageMetadata from './package-metadata'; import { filterEmpty } from './util'; -import { loadProjectInfo } from './project-info'; // tslint:disable-next-line:no-var-requires const sortJson = require('sort-json'); diff --git a/packages/jsii/package.json b/packages/jsii/package.json index dbe8467c1b..b84342017f 100644 --- a/packages/jsii/package.json +++ b/packages/jsii/package.json @@ -8,9 +8,9 @@ "jsii": "bin/jsii" }, "scripts": { - "watch": "tsc -w", - "build": "/bin/bash generate.sh && tsc && chmod +x bin/jsii", - "test": "nodeunit test/test.*.js", + "watch": "tsc -b -w", + "build": "/bin/bash generate.sh && tsc -b && chmod +x bin/jsii", + "test": "tsc -b test && nodeunit test/test.*.js", "package": "package-js" }, "keywords": [ @@ -19,6 +19,7 @@ ], "devDependencies": { "@types/clone": "^0.1.30", + "@types/deep-equal": "^1.0.1", "@types/fs-extra": "^4.0.8", "@types/glob": "^5.0.32", "@types/node": "^9.6.18", @@ -28,7 +29,6 @@ "nodeunit": "^0.11.2" }, "dependencies": { - "@types/deep-equal": "^1.0.1", "case": "^1.5.5", "clone": "^2.1.1", "deep-equal": "^1.0.1", diff --git a/packages/jsii/test/jsii-test/package.json b/packages/jsii/test/jsii-test/package.json index b305a9887f..7d23807502 100644 --- a/packages/jsii/test/jsii-test/package.json +++ b/packages/jsii/test/jsii-test/package.json @@ -6,20 +6,22 @@ "types": "index.d.ts", "jsii": { "outdir": "dist/jsii", - "bundledDependencies": [ "my-bundled-dep" ], - "names": { - "java": "com.amazon.jsii.test" + "targets": { + "java": { + "package": "com.amazon.jsii.test" + } } }, "dependencies": { "my-dep": "^2.5.2", "my-bundled-dep": "1.2.3" }, + "bundleDependencies": [ "my-bundled-dep" ], "author": { "name": "Amazon Web Services", "url": "https://aws.amazon.com" }, - "license": "LicenseRef-LICENSE", + "license": "Apache-2.0", "repository": { "type": "git", "url": "git://github.com/awslabs/jsii" diff --git a/packages/jsii/test/test.package-metadata.ts b/packages/jsii/test/test.package-metadata.ts index 62651598b8..e49119d2f9 100644 --- a/packages/jsii/test/test.package-metadata.ts +++ b/packages/jsii/test/test.package-metadata.ts @@ -9,11 +9,13 @@ export = nodeunit.testCase({ async 'correctly loads valid file'(test: nodeunit.Test) { try { await withTempDir(async (tmpdir) => { - const packageInfo = require('../package.json'); + const packageInfo = require('./jsii-test/package.json'); await fs.writeJson(path.join(tmpdir, 'package.json'), packageInfo); const md = await readPackageMetadata(tmpdir); test.notEqual(md, null); }); + } catch (e) { + test.doesNotThrow(() => { throw e; }); } finally { test.done(); } @@ -22,7 +24,7 @@ export = nodeunit.testCase({ let error: Error; try { await withTempDir(async (tmpdir) => { - const packageInfo = require('../package.json'); + const packageInfo = require('./jsii-test/package.json'); delete packageInfo.version; await fs.writeJson(path.join(tmpdir, 'package.json'), packageInfo); await readPackageMetadata(tmpdir); diff --git a/packages/jsii/test/tsconfig.json b/packages/jsii/test/tsconfig.json new file mode 100644 index 0000000000..9a28d19195 --- /dev/null +++ b/packages/jsii/test/tsconfig.json @@ -0,0 +1,64 @@ +{ + "compilerOptions": { + /* Basic Options */ + "target": "ES2018", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + "lib": ["es2016", "es2017.object", "es2017.string"], /* Specify library files to be included in the compilation: */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + "strictNullChecks": true, /* Enable strict null checks. */ + "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + "strictPropertyInitialization": false, /* DO NOT Raise error on class attribute not initialized by constructor. */ + + /* Additional Checks */ + "noUnusedLocals": true, /* Report errors on unused locals. */ + "noUnusedParameters": true, /* Report errors on unused parameters. */ + "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + + /* Source Map Options */ + // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ + "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + }, + "include": [ + "*.ts" + ], + "exclude": [ + "**/*.d.ts", + "negatives/neg.*.ts" + ], + "references": [ + { "path": "../" } + ] + } diff --git a/packages/jsii/tsconfig.json b/packages/jsii/tsconfig.json index 9844a2a17e..4df49bea79 100644 --- a/packages/jsii/tsconfig.json +++ b/packages/jsii/tsconfig.json @@ -48,10 +48,19 @@ "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ /* Experimental Options */ - "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */ + "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + "composite": true /* Allow this project to be referenced by others. */ }, + "include": [ + "**/*.ts" + ], "exclude": [ - "test/**/neg.*.ts" + "**/*.d.ts", + "node_modules", + "test" + ], + "references": [ + { "path": "../jsii-spec" } ] } From 18ef48e660d8fd4b417386234f845fc4949f0257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=91=A8=F0=9F=8F=BC=E2=80=8D=F0=9F=92=BB=20Romain=20M?= =?UTF-8?q?arcadier-Muller?= Date: Tue, 14 Aug 2018 12:02:23 +0200 Subject: [PATCH 3/4] Stop emitting Java step builders for data types Use a simple builder class that has `whit`ers for all properties and perform required-validation at `build()` time. Fixes #60 --- packages/codemaker/package.json | 4 +- packages/codemaker/tsconfig.json | 3 +- .../jsii-calc-base-of-base/test/assembly.jsii | 4 +- packages/jsii-calc-base/test/assembly.jsii | 4 +- packages/jsii-calc-lib/test/assembly.jsii | 24 +- packages/jsii-calc/test/assembly.jsii | 660 +++++++++--------- ...mazon.JSII.Runtime.IntegrationTests.csproj | 2 +- .../amazon/jsii/testing/ComplianceTest.java | 28 +- packages/jsii-pacmak/lib/targets/java.ts | 262 +++---- packages/jsii-pacmak/package.json | 4 +- .../Amazon.JSII.Tests.Calculator.Base/.jsii | 4 +- .../test/expected.jsii-calc-base/java/pom.xml | 8 +- .../jsii/tests/calculator/base/Base.java | 2 + .../jsii/tests/calculator/base/BaseProps.java | 119 ++-- .../Amazon.JSII.Tests.Calculator.Lib/.jsii | 24 +- .../IMyFirstStruct.cs | 12 +- .../MyFirstStruct.cs | 12 +- .../MyFirstStructProxy.cs | 16 +- .../Number.cs | 12 +- .../test/expected.jsii-calc-lib/java/pom.xml | 8 +- .../calculator/lib/EnumFromScopedModule.java | 2 + .../jsii/tests/calculator/lib/IFriendly.java | 6 +- .../tests/calculator/lib/MyFirstStruct.java | 213 +++--- .../jsii/tests/calculator/lib/Number.java | 14 +- .../jsii/tests/calculator/lib/Operation.java | 2 + .../lib/StructWithOnlyOptionals.java | 126 ++-- .../jsii/tests/calculator/lib/Value.java | 2 + .../sphinx/_scope_jsii-calc-lib.rst | 20 +- .../dotnet/Amazon.JSII.Tests.Calculator/.jsii | 660 +++++++++--------- .../Amazon.JSII.Tests.Calculator/AllTypes.cs | 100 +-- .../AllowedMethodNames.cs | 18 +- .../AsyncVirtualMethods.cs | 24 +- .../Calculator_.cs | 44 +- .../DerivedStruct.cs | 30 +- .../DerivedStructProxy.cs | 36 +- .../DoubleTrouble.cs | 14 +- .../GiveMeStructs.cs | 16 +- .../IDerivedStruct.cs | 20 +- .../IFriendlierProxy.cs | 14 +- .../IIFriendlier.cs | 6 +- .../IUnionProperties.cs | 10 +- .../JavaReservedWords.cs | 8 +- .../Amazon.JSII.Tests.Calculator/Multiply.cs | 20 +- .../Amazon.JSII.Tests.Calculator/Negate.cs | 24 +- .../NodeStandardLibrary.cs | 16 +- .../NumberGenerator.cs | 12 +- .../Amazon.JSII.Tests.Calculator/Power.cs | 14 +- .../Amazon.JSII.Tests.Calculator/Statics.cs | 30 +- .../Amazon.JSII.Tests.Calculator/Sum.cs | 16 +- .../SyncVirtualMethods.cs | 70 +- .../UnionProperties.cs | 10 +- .../UnionPropertiesProxy.cs | 10 +- .../UsesInterfaceWithProperties.cs | 12 +- .../VirtualMethodPlayground.cs | 28 +- .../composition/CompositeOperation.cs | 42 +- .../test/expected.jsii-calc/java/pom.xml | 8 +- .../amazon/jsii/tests/calculator/Add.java | 2 + .../jsii/tests/calculator/AllTypes.java | 128 ++-- .../jsii/tests/calculator/AllTypesEnum.java | 2 + .../tests/calculator/AllowedMethodNames.java | 12 +- .../tests/calculator/AsyncVirtualMethods.java | 14 +- .../tests/calculator/BinaryOperation.java | 2 + .../jsii/tests/calculator/Calculator.java | 44 +- .../tests/calculator/CalculatorProps.java | 96 ++- .../DerivedClassHasNoProperties/Base.java | 2 + .../DerivedClassHasNoProperties/Derived.java | 2 + .../jsii/tests/calculator/DerivedStruct.java | 432 ++++++------ .../jsii/tests/calculator/DoubleTrouble.java | 14 +- .../jsii/tests/calculator/GiveMeStructs.java | 14 +- .../jsii/tests/calculator/IFriendlier.java | 30 +- .../calculator/IFriendlyRandomGenerator.java | 8 +- .../calculator/IInterfaceWithProperties.java | 112 ++- .../IInterfaceWithPropertiesExtension.java | 163 +++-- .../calculator/IRandomNumberGenerator.java | 6 +- .../tests/calculator/ImplictBaseOfBase.java | 172 +++-- .../JSObjectLiteralForInterface.java | 2 + .../calculator/JSObjectLiteralToNative.java | 2 + .../JSObjectLiteralToNativeClass.java | 2 + .../tests/calculator/JavaReservedWords.java | 8 +- .../jsii/tests/calculator/Multiply.java | 20 +- .../amazon/jsii/tests/calculator/Negate.java | 26 +- .../tests/calculator/NodeStandardLibrary.java | 16 +- .../tests/calculator/NumberGenerator.java | 8 +- .../calculator/ObjectRefsInCollections.java | 2 + .../calculator/OverrideReturnsObject.java | 2 + .../jsii/tests/calculator/Polymorphism.java | 2 + .../amazon/jsii/tests/calculator/Power.java | 14 +- .../ReferenceEnumFromScopedPackage.java | 2 + .../jsii/tests/calculator/ReturnsNumber.java | 8 +- .../tests/calculator/RuntimeTypeChecking.java | 2 + .../amazon/jsii/tests/calculator/Statics.java | 22 +- .../jsii/tests/calculator/StringEnum.java | 2 + .../amazon/jsii/tests/calculator/Sum.java | 16 +- .../tests/calculator/SyncVirtualMethods.java | 60 +- .../amazon/jsii/tests/calculator/Thrower.java | 2 + .../jsii/tests/calculator/UnaryOperation.java | 2 + .../tests/calculator/UnionProperties.java | 172 ++--- .../calculator/UseBundledDependency.java | 2 + .../jsii/tests/calculator/UseCalcBase.java | 2 + .../UsesInterfaceWithProperties.java | 8 +- .../jsii/tests/calculator/VariadicMethod.java | 2 + .../calculator/VirtualMethodPlayground.java | 18 +- .../composition/CompositeOperation.java | 52 +- .../composition/CompositionStringStyle.java | 2 + .../expected.jsii-calc/sphinx/jsii-calc.rst | 446 ++++++------ packages/jsii-pacmak/tsconfig.json | 16 +- packages/jsii/lib/compiler.ts | 29 +- 107 files changed, 2617 insertions(+), 2516 deletions(-) diff --git a/packages/codemaker/package.json b/packages/codemaker/package.json index a1b81d5223..43492a89c5 100644 --- a/packages/codemaker/package.json +++ b/packages/codemaker/package.json @@ -5,8 +5,8 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "build": "tsc", - "watch": "tsc -w", + "build": "tsc -b", + "watch": "tsc -b -w", "test": "nodeunit test/test.*.js", "package": "rm -fr dist/js && mkdir -p dist/js && mv $(npm pack) dist/js" }, diff --git a/packages/codemaker/tsconfig.json b/packages/codemaker/tsconfig.json index ad474280a6..501c3c7517 100644 --- a/packages/codemaker/tsconfig.json +++ b/packages/codemaker/tsconfig.json @@ -12,6 +12,7 @@ "noUnusedLocals": true, /* Report errors on unused locals. */ "noUnusedParameters": true, /* Report errors on unused parameters. */ "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */ + "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + "composite": true, /* Allow this project to be referenced by others. */ } } diff --git a/packages/jsii-calc-base-of-base/test/assembly.jsii b/packages/jsii-calc-base-of-base/test/assembly.jsii index 3bd1ae40e4..b641c4084e 100644 --- a/packages/jsii-calc-base-of-base/test/assembly.jsii +++ b/packages/jsii-calc-base-of-base/test/assembly.jsii @@ -1,5 +1,4 @@ { - "fingerprint": "I/HF4zJK5eV4ZLmNLDEzShkHVsxngX3K/y2SEYjXsxU=", "author": { "name": "Amazon Web Services", "organization": true, @@ -68,5 +67,6 @@ ] } }, - "version": "0.6.4" + "version": "0.6.4", + "fingerprint": "I/HF4zJK5eV4ZLmNLDEzShkHVsxngX3K/y2SEYjXsxU=" } diff --git a/packages/jsii-calc-base/test/assembly.jsii b/packages/jsii-calc-base/test/assembly.jsii index 62ac6482ca..10fc400e79 100644 --- a/packages/jsii-calc-base/test/assembly.jsii +++ b/packages/jsii-calc-base/test/assembly.jsii @@ -1,5 +1,4 @@ { - "fingerprint": "b+UZfT/No0vxqTQ1n3lIsyw7olqARDbeGj853lNFoE8=", "author": { "name": "Amazon Web Services", "organization": true, @@ -100,5 +99,6 @@ ] } }, - "version": "0.6.4" + "version": "0.6.4", + "fingerprint": "b+UZfT/No0vxqTQ1n3lIsyw7olqARDbeGj853lNFoE8=" } diff --git a/packages/jsii-calc-lib/test/assembly.jsii b/packages/jsii-calc-lib/test/assembly.jsii index 71a27dff10..1a5b1f9174 100644 --- a/packages/jsii-calc-lib/test/assembly.jsii +++ b/packages/jsii-calc-lib/test/assembly.jsii @@ -1,5 +1,4 @@ { - "fingerprint": "qwjIHOtTOSWOv5qzVdHj4SDgxmnWYsacVvR7BkAVlo8=", "author": { "name": "Amazon Web Services", "organization": true, @@ -125,20 +124,20 @@ "properties": [ { "docs": { - "comment": "A string value" + "comment": "An awesome number value" }, - "name": "astring", + "name": "anumber", "type": { - "primitive": "string" + "primitive": "number" } }, { "docs": { - "comment": "An awesome number value" + "comment": "A string value" }, - "name": "anumber", + "name": "astring", "type": { - "primitive": "number" + "primitive": "string" } }, { @@ -187,20 +186,20 @@ "properties": [ { "docs": { - "comment": "The number." + "comment": "The number multiplied by 2." }, "immutable": true, - "name": "value", + "name": "doubleValue", "type": { "primitive": "number" } }, { "docs": { - "comment": "The number multiplied by 2." + "comment": "The number." }, "immutable": true, - "name": "doubleValue", + "name": "value", "type": { "primitive": "number" } @@ -315,5 +314,6 @@ ] } }, - "version": "0.6.4" + "version": "0.6.4", + "fingerprint": "MHdlbqyf1RV6moIHslfpKnl7yjQoYVvvZLfxFXWihrU=" } diff --git a/packages/jsii-calc/test/assembly.jsii b/packages/jsii-calc/test/assembly.jsii index 355277ea09..b29c5a2bc2 100644 --- a/packages/jsii-calc/test/assembly.jsii +++ b/packages/jsii-calc/test/assembly.jsii @@ -1,5 +1,4 @@ { - "fingerprint": "nIH7ZdupMWqiPid9t2N934g0BDqSHVKuq6mrGdRpuYk=", "author": { "name": "Amazon Web Services", "organization": true, @@ -252,54 +251,31 @@ "namespace": "jsii-calc", "properties": [ { - "name": "booleanProperty", - "type": { - "primitive": "boolean" - } - }, - { - "name": "stringProperty", - "type": { - "primitive": "string" - } - }, - { - "name": "numberProperty", + "immutable": true, + "name": "enumPropertyValue", "type": { "primitive": "number" } }, { - "name": "dateProperty", - "type": { - "primitive": "date" - } - }, - { - "name": "jsonProperty", - "type": { - "primitive": "json" - } - }, - { - "name": "mapProperty", + "name": "anyArrayProperty", "type": { "collection": { "elementtype": { - "primitive": "number" + "primitive": "any" }, - "kind": "map" + "kind": "array" } } }, { - "name": "arrayProperty", + "name": "anyMapProperty", "type": { "collection": { "elementtype": { - "primitive": "string" + "primitive": "any" }, - "kind": "array" + "kind": "map" } } }, @@ -310,71 +286,61 @@ } }, { - "name": "anyArrayProperty", + "name": "arrayProperty", "type": { "collection": { "elementtype": { - "primitive": "any" + "primitive": "string" }, "kind": "array" } } }, { - "name": "anyMapProperty", + "name": "booleanProperty", "type": { - "collection": { - "elementtype": { - "primitive": "any" - }, - "kind": "map" - } + "primitive": "boolean" } }, { - "name": "unknownProperty", + "name": "dateProperty", "type": { - "primitive": "any" + "primitive": "date" } }, { - "name": "unknownArrayProperty", + "name": "enumProperty", "type": { - "collection": { - "elementtype": { - "primitive": "any" - }, - "kind": "array" - } + "fqn": "jsii-calc.AllTypesEnum" } }, { - "name": "unknownMapProperty", + "name": "jsonProperty", + "type": { + "primitive": "json" + } + }, + { + "name": "mapProperty", "type": { "collection": { "elementtype": { - "primitive": "any" + "primitive": "number" }, "kind": "map" } } }, { - "name": "unionProperty", + "name": "numberProperty", "type": { - "union": { - "types": [ - { - "primitive": "string" - }, - { - "primitive": "number" - }, - { - "fqn": "jsii-calc.Multiply" - } - ] - } + "primitive": "number" + } + }, + { + "name": "stringProperty", + "type": { + "primitive": "string" } }, { @@ -418,23 +384,56 @@ } }, { - "name": "optionalEnumValue", + "name": "unionProperty", "type": { - "fqn": "jsii-calc.StringEnum", - "optional": true + "union": { + "types": [ + { + "primitive": "string" + }, + { + "primitive": "number" + }, + { + "fqn": "jsii-calc.Multiply" + } + ] + } } }, { - "name": "enumProperty", + "name": "unknownArrayProperty", "type": { - "fqn": "jsii-calc.AllTypesEnum" + "collection": { + "elementtype": { + "primitive": "any" + }, + "kind": "array" + } } }, { - "immutable": true, - "name": "enumPropertyValue", + "name": "unknownMapProperty", "type": { - "primitive": "number" + "collection": { + "elementtype": { + "primitive": "any" + }, + "kind": "map" + } + } + }, + { + "name": "unknownProperty", + "type": { + "primitive": "any" + } + }, + { + "name": "optionalEnumValue", + "type": { + "fqn": "jsii-calc.StringEnum", + "optional": true } } ] @@ -465,23 +464,6 @@ }, "kind": "class", "methods": [ - { - "docs": { - "comment": "getXxx() is not allowed (see negatives), but getXxx(a, ...) is okay." - }, - "name": "getFoo", - "parameters": [ - { - "name": "withParam", - "type": { - "primitive": "string" - } - } - ], - "returns": { - "primitive": "string" - } - }, { "name": "getBar", "parameters": [ @@ -501,9 +483,23 @@ }, { "docs": { - "comment": "setFoo(x) is not allowed (see negatives), but setXxx(a, b, ...) is okay." + "comment": "getXxx() is not allowed (see negatives), but getXxx(a, ...) is okay." }, - "name": "setFoo", + "name": "getFoo", + "parameters": [ + { + "name": "withParam", + "type": { + "primitive": "string" + } + } + ], + "returns": { + "primitive": "string" + } + }, + { + "name": "setBar", "parameters": [ { "name": "_x", @@ -516,11 +512,20 @@ "type": { "primitive": "number" } + }, + { + "name": "_z", + "type": { + "primitive": "boolean" + } } ] }, { - "name": "setBar", + "docs": { + "comment": "setFoo(x) is not allowed (see negatives), but setXxx(a, b, ...) is okay." + }, + "name": "setFoo", "parameters": [ { "name": "_x", @@ -533,12 +538,6 @@ "type": { "primitive": "number" } - }, - { - "name": "_z", - "type": { - "primitive": "boolean" - } } ] } @@ -561,28 +560,6 @@ "promise": true } }, - { - "name": "overrideMe", - "parameters": [ - { - "name": "mult", - "type": { - "primitive": "number" - } - } - ], - "returns": { - "primitive": "number", - "promise": true - } - }, - { - "name": "overrideMeToo", - "returns": { - "primitive": "number", - "promise": true - } - }, { "docs": { "comment": "Just calls \"overrideMeToo\"" @@ -608,6 +585,28 @@ "returns": { "primitive": "number" } + }, + { + "name": "overrideMe", + "parameters": [ + { + "name": "mult", + "type": { + "primitive": "number" + } + } + ], + "returns": { + "primitive": "number", + "promise": true + } + }, + { + "name": "overrideMeToo", + "returns": { + "primitive": "number", + "promise": true + } } ], "name": "AsyncVirtualMethods", @@ -748,6 +747,12 @@ } ] }, + { + "docs": { + "comment": "Negates the current value." + }, + "name": "neg" + }, { "docs": { "comment": "Raises the current value by a power." @@ -762,12 +767,6 @@ } ] }, - { - "docs": { - "comment": "Negates the current value." - }, - "name": "neg" - }, { "docs": { "comment": "Returns teh value of the union property (if defined)." @@ -783,13 +782,29 @@ "properties": [ { "docs": { - "comment": "The current value." + "comment": "Returns the expression." }, - "name": "curr", + "immutable": true, + "name": "expression", "type": { "fqn": "@scope/jsii-calc-lib.Value" } }, + { + "docs": { + "comment": "A log of all operations." + }, + "immutable": true, + "name": "operationsLog", + "type": { + "collection": { + "elementtype": { + "fqn": "@scope/jsii-calc-lib.Value" + }, + "kind": "array" + } + } + }, { "docs": { "comment": "A map of per operation name of all operations performed." @@ -812,17 +827,11 @@ }, { "docs": { - "comment": "A log of all operations." + "comment": "The current value." }, - "immutable": true, - "name": "operationsLog", + "name": "curr", "type": { - "collection": { - "elementtype": { - "fqn": "@scope/jsii-calc-lib.Value" - }, - "kind": "array" - } + "fqn": "@scope/jsii-calc-lib.Value" } }, { @@ -835,16 +844,6 @@ "primitive": "number" } }, - { - "docs": { - "comment": "Returns the expression." - }, - "immutable": true, - "name": "expression", - "type": { - "fqn": "@scope/jsii-calc-lib.Value" - } - }, { "docs": { "comment": "Example of a property that accepts a union of types." @@ -944,12 +943,9 @@ "namespace": "jsii-calc", "properties": [ { - "docs": { - "comment": "An example of a non primitive property." - }, - "name": "nonPrimitive", + "name": "anotherRequired", "type": { - "fqn": "jsii-calc.DoubleTrouble" + "primitive": "date" } }, { @@ -959,34 +955,37 @@ } }, { - "name": "anotherRequired", + "docs": { + "comment": "An example of a non primitive property." + }, + "name": "nonPrimitive", "type": { - "primitive": "date" + "fqn": "jsii-calc.DoubleTrouble" } }, { - "name": "optionalArray", + "docs": { + "comment": "This is optional." + }, + "name": "anotherOptional", "type": { "collection": { "elementtype": { - "primitive": "string" + "fqn": "@scope/jsii-calc-lib.Value" }, - "kind": "array" + "kind": "map" }, "optional": true } }, { - "docs": { - "comment": "This is optional." - }, - "name": "anotherOptional", + "name": "optionalArray", "type": { "collection": { "elementtype": { - "fqn": "@scope/jsii-calc-lib.Value" + "primitive": "string" }, - "kind": "map" + "kind": "array" }, "optional": true } @@ -1008,20 +1007,20 @@ "methods": [ { "docs": { - "comment": "Returns another random number." + "comment": "Say hello!" }, - "name": "next", + "name": "hello", "returns": { - "primitive": "number" + "primitive": "string" } }, { "docs": { - "comment": "Say hello!" + "comment": "Returns another random number." }, - "name": "hello", + "name": "next", "returns": { - "primitive": "string" + "primitive": "number" } } ], @@ -1038,19 +1037,19 @@ "methods": [ { "docs": { - "comment": "Returns the \"anumber\" from a MyFirstStruct struct;" + "comment": "Accepts a struct of type DerivedStruct and returns a struct of type FirstStruct." }, - "name": "readFirstNumber", + "name": "derivedToFirst", "parameters": [ { - "name": "first", + "name": "derived", "type": { - "fqn": "@scope/jsii-calc-lib.MyFirstStruct" + "fqn": "jsii-calc.DerivedStruct" } } ], "returns": { - "primitive": "number" + "fqn": "@scope/jsii-calc-lib.MyFirstStruct" } }, { @@ -1072,19 +1071,19 @@ }, { "docs": { - "comment": "Accepts a struct of type DerivedStruct and returns a struct of type FirstStruct." + "comment": "Returns the \"anumber\" from a MyFirstStruct struct;" }, - "name": "derivedToFirst", + "name": "readFirstNumber", "parameters": [ { - "name": "derived", + "name": "first", "type": { - "fqn": "jsii-calc.DerivedStruct" + "fqn": "@scope/jsii-calc-lib.MyFirstStruct" } } ], "returns": { - "fqn": "@scope/jsii-calc-lib.MyFirstStruct" + "primitive": "number" } } ], @@ -1115,19 +1114,19 @@ "methods": [ { "docs": { - "comment": "Say goodbye.", - "return": "A goodbye blessing." + "comment": "Say farewell." }, - "name": "goodbye", + "name": "farewell", "returns": { "primitive": "string" } }, { "docs": { - "comment": "Say farewell." + "comment": "Say goodbye.", + "return": "A goodbye blessing." }, - "name": "farewell", + "name": "goodbye", "returns": { "primitive": "string" } @@ -1349,10 +1348,10 @@ "name": "default" }, { - "name": "double" + "name": "do" }, { - "name": "do" + "name": "double" }, { "name": "else" @@ -1527,9 +1526,9 @@ "methods": [ { "docs": { - "comment": "String representation of the value." + "comment": "Say farewell." }, - "name": "toString", + "name": "farewell", "returns": { "primitive": "string" } @@ -1545,20 +1544,20 @@ }, { "docs": { - "comment": "Say farewell." + "comment": "Returns another random number." }, - "name": "farewell", + "name": "next", "returns": { - "primitive": "string" + "primitive": "number" } }, { "docs": { - "comment": "Returns another random number." + "comment": "String representation of the value." }, - "name": "next", + "name": "toString", "returns": { - "primitive": "number" + "primitive": "string" } } ], @@ -1606,36 +1605,36 @@ "methods": [ { "docs": { - "comment": "String representation of the value." + "comment": "Say farewell." }, - "name": "toString", + "name": "farewell", "returns": { "primitive": "string" } }, { "docs": { - "comment": "Say hello!" + "comment": "Say goodbye." }, - "name": "hello", + "name": "goodbye", "returns": { "primitive": "string" } }, { "docs": { - "comment": "Say goodbye." + "comment": "Say hello!" }, - "name": "goodbye", + "name": "hello", "returns": { "primitive": "string" } }, { "docs": { - "comment": "Say farewell." + "comment": "String representation of the value." }, - "name": "farewell", + "name": "toString", "returns": { "primitive": "string" } @@ -1667,6 +1666,16 @@ }, "kind": "class", "methods": [ + { + "docs": { + "comment": "Uses node.js \"crypto\" module to calculate sha256 of a string.", + "return": "\"6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50\"" + }, + "name": "cryptoSha256", + "returns": { + "primitive": "string" + } + }, { "docs": { "comment": "Reads a local resource file (resource.txt) asynchronously.", @@ -1687,16 +1696,6 @@ "returns": { "primitive": "string" } - }, - { - "docs": { - "comment": "Uses node.js \"crypto\" module to calculate sha256 of a string.", - "return": "\"6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50\"" - }, - "name": "cryptoSha256", - "returns": { - "primitive": "string" - } } ], "name": "NodeStandardLibrary", @@ -1733,12 +1732,6 @@ }, "kind": "class", "methods": [ - { - "name": "nextTimes100", - "returns": { - "primitive": "number" - } - }, { "name": "isSameGenerator", "parameters": [ @@ -1752,6 +1745,12 @@ "returns": { "primitive": "boolean" } + }, + { + "name": "nextTimes100", + "returns": { + "primitive": "number" + } } ], "name": "NumberGenerator", @@ -1927,20 +1926,20 @@ }, { "docs": { - "comment": "The number of times to multiply" + "comment": "The expression that this operation consists of.\nMust be implemented by derived classes." }, "immutable": true, - "name": "pow", + "name": "expression", "type": { "fqn": "@scope/jsii-calc-lib.Value" } }, { "docs": { - "comment": "The expression that this operation consists of.\nMust be implemented by derived classes." + "comment": "The number of times to multiply" }, "immutable": true, - "name": "expression", + "name": "pow", "type": { "fqn": "@scope/jsii-calc-lib.Value" } @@ -2100,34 +2099,36 @@ "namespace": "jsii-calc", "properties": [ { + "const": true, + "docs": { + "comment": "Constants may also use all-caps." + }, "immutable": true, - "name": "value", + "name": "BAR", + "static": true, "type": { - "primitive": "string" + "primitive": "number" } }, { "const": true, - "docs": { - "comment": "Jsdocs for static property." - }, "immutable": true, - "name": "Foo", + "name": "ConstObj", "static": true, "type": { - "primitive": "string" + "fqn": "jsii-calc.DoubleTrouble" } }, { "const": true, "docs": { - "comment": "Constants may also use all-caps." + "comment": "Jsdocs for static property." }, "immutable": true, - "name": "BAR", + "name": "Foo", "static": true, "type": { - "primitive": "number" + "primitive": "string" } }, { @@ -2165,12 +2166,10 @@ } }, { - "const": true, "immutable": true, - "name": "ConstObj", - "static": true, + "name": "value", "type": { - "fqn": "jsii-calc.DoubleTrouble" + "primitive": "string" } } ] @@ -2209,6 +2208,16 @@ "name": "Sum", "namespace": "jsii-calc", "properties": [ + { + "docs": { + "comment": "The expression that this operation consists of.\nMust be implemented by derived classes." + }, + "immutable": true, + "name": "expression", + "type": { + "fqn": "@scope/jsii-calc-lib.Value" + } + }, { "docs": { "comment": "The parts to sum." @@ -2222,16 +2231,6 @@ "kind": "array" } } - }, - { - "docs": { - "comment": "The expression that this operation consists of.\nMust be implemented by derived classes." - }, - "immutable": true, - "name": "expression", - "type": { - "fqn": "@scope/jsii-calc-lib.Value" - } } ] }, @@ -2244,31 +2243,28 @@ "kind": "class", "methods": [ { - "name": "callerIsMethod", + "name": "callerIsAsync", "returns": { - "primitive": "number" + "primitive": "number", + "promise": true } }, { - "name": "callerIsAsync", + "name": "callerIsMethod", "returns": { - "primitive": "number", - "promise": true + "primitive": "number" } }, { - "name": "virtualMethod", + "name": "modifyOtherProperty", "parameters": [ { - "name": "n", + "name": "value", "type": { - "primitive": "number" + "primitive": "string" } } - ], - "returns": { - "primitive": "number" - } + ] }, { "name": "modifyValueOfTheProperty", @@ -2282,36 +2278,39 @@ ] }, { - "name": "retrieveValueOfTheProperty", + "name": "readA", "returns": { - "primitive": "string" + "primitive": "number" } }, { - "name": "retrieveReadOnlyProperty", + "name": "retrieveOtherProperty", "returns": { "primitive": "string" } }, { - "name": "modifyOtherProperty", - "parameters": [ - { - "name": "value", - "type": { - "primitive": "string" - } - } - ] + "name": "retrieveReadOnlyProperty", + "returns": { + "primitive": "string" + } }, { - "name": "retrieveOtherProperty", + "name": "retrieveValueOfTheProperty", "returns": { "primitive": "string" } }, { - "name": "readA", + "name": "virtualMethod", + "parameters": [ + { + "name": "n", + "type": { + "primitive": "number" + } + } + ], "returns": { "primitive": "number" } @@ -2332,22 +2331,22 @@ "namespace": "jsii-calc", "properties": [ { - "name": "callerIsProperty", + "immutable": true, + "name": "readonlyProperty", "type": { - "primitive": "number" + "primitive": "string" } }, { - "name": "theProperty", + "name": "a", "type": { - "primitive": "string" + "primitive": "number" } }, { - "immutable": true, - "name": "readonlyProperty", + "name": "callerIsProperty", "type": { - "primitive": "string" + "primitive": "number" } }, { @@ -2357,15 +2356,15 @@ } }, { - "name": "valueOfOtherProperty", + "name": "theProperty", "type": { "primitive": "string" } }, { - "name": "a", + "name": "valueOfOtherProperty", "type": { - "primitive": "number" + "primitive": "string" } } ] @@ -2428,9 +2427,9 @@ "namespace": "jsii-calc", "properties": [ { - "name": "foo", + "immutable": true, + "name": "bar", "type": { - "optional": true, "union": { "types": [ { @@ -2438,15 +2437,18 @@ }, { "primitive": "number" + }, + { + "fqn": "jsii-calc.AllTypes" } ] } } }, { - "immutable": true, - "name": "bar", + "name": "foo", "type": { + "optional": true, "union": { "types": [ { @@ -2454,9 +2456,6 @@ }, { "primitive": "number" - }, - { - "fqn": "jsii-calc.AllTypes" } ] } @@ -2526,12 +2525,12 @@ } }, { - "name": "writeAndRead", + "name": "readStringAndNumber", "parameters": [ { - "name": "value", + "name": "ext", "type": { - "primitive": "string" + "fqn": "jsii-calc.IInterfaceWithPropertiesExtension" } } ], @@ -2540,12 +2539,12 @@ } }, { - "name": "readStringAndNumber", + "name": "writeAndRead", "parameters": [ { - "name": "ext", + "name": "value", "type": { - "fqn": "jsii-calc.IInterfaceWithPropertiesExtension" + "primitive": "string" } } ], @@ -2633,10 +2632,10 @@ "kind": "class", "methods": [ { - "name": "serialSumAsync", + "name": "overrideMeAsync", "parameters": [ { - "name": "count", + "name": "index", "type": { "primitive": "number" } @@ -2648,22 +2647,21 @@ } }, { - "name": "parallelSumAsync", + "name": "overrideMeSync", "parameters": [ { - "name": "count", + "name": "index", "type": { "primitive": "number" } } ], "returns": { - "primitive": "number", - "promise": true + "primitive": "number" } }, { - "name": "sumSync", + "name": "parallelSumAsync", "parameters": [ { "name": "count", @@ -2673,14 +2671,15 @@ } ], "returns": { - "primitive": "number" + "primitive": "number", + "promise": true } }, { - "name": "overrideMeAsync", + "name": "serialSumAsync", "parameters": [ { - "name": "index", + "name": "count", "type": { "primitive": "number" } @@ -2692,10 +2691,10 @@ } }, { - "name": "overrideMeSync", + "name": "sumSync", "parameters": [ { - "name": "index", + "name": "count", "type": { "primitive": "number" } @@ -2738,26 +2737,24 @@ "namespace": "jsii-calc.composition", "properties": [ { + "abstract": true, "docs": { - "comment": "The .toString() style." + "comment": "The expression that this operation consists of.\nMust be implemented by derived classes." }, - "name": "stringStyle", + "immutable": true, + "name": "expression", "type": { - "fqn": "jsii-calc.composition.CompositionStringStyle" + "fqn": "@scope/jsii-calc-lib.Value" } }, { "docs": { - "comment": "A set of prefixes to include in a decorated .toString()." + "comment": "The value." }, - "name": "decorationPrefixes", + "immutable": true, + "name": "value", "type": { - "collection": { - "elementtype": { - "primitive": "string" - }, - "kind": "array" - } + "primitive": "number" } }, { @@ -2776,23 +2773,25 @@ }, { "docs": { - "comment": "The value." + "comment": "A set of prefixes to include in a decorated .toString()." }, - "immutable": true, - "name": "value", + "name": "decorationPrefixes", "type": { - "primitive": "number" + "collection": { + "elementtype": { + "primitive": "string" + }, + "kind": "array" + } } }, { - "abstract": true, "docs": { - "comment": "The expression that this operation consists of.\nMust be implemented by derived classes." + "comment": "The .toString() style." }, - "immutable": true, - "name": "expression", + "name": "stringStyle", "type": { - "fqn": "@scope/jsii-calc-lib.Value" + "fqn": "jsii-calc.composition.CompositionStringStyle" } } ] @@ -2816,5 +2815,6 @@ "namespace": "jsii-calc.composition" } }, - "version": "0.6.4" + "version": "0.6.4", + "fingerprint": "ukdkUVnf3jHKB7TV8FhG/tHnl04+DaTZSoIEZxym6Js=" } diff --git a/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/Amazon.JSII.Runtime.IntegrationTests.csproj b/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/Amazon.JSII.Runtime.IntegrationTests.csproj index 7e008ab9c3..65b3ec2c10 100644 --- a/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/Amazon.JSII.Runtime.IntegrationTests.csproj +++ b/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/Amazon.JSII.Runtime.IntegrationTests.csproj @@ -7,7 +7,7 @@ - + diff --git a/packages/jsii-java-runtime-test/project/src/test/java/software/amazon/jsii/testing/ComplianceTest.java b/packages/jsii-java-runtime-test/project/src/test/java/software/amazon/jsii/testing/ComplianceTest.java index bb224503c3..19aba65d91 100644 --- a/packages/jsii-java-runtime-test/project/src/test/java/software/amazon/jsii/testing/ComplianceTest.java +++ b/packages/jsii-java-runtime-test/project/src/test/java/software/amazon/jsii/testing/ComplianceTest.java @@ -131,22 +131,22 @@ public void dynamicTypes() throws IOException { // json (notice that when deserialized, it is deserialized as a map). types.setAnyProperty(new ObjectMapper().readTree("{ \"Goo\": [ \"Hello\", { \"World\": 123 } ] }")); - assertEquals(123, ((Map)((List)((Map)types.getAnyProperty()).get("Goo")).get(1)).get("World")); + assertEquals(123, ((Map)((List)((Map)types.getAnyProperty()).get("Goo")).get(1)).get("World")); // array types.setAnyProperty(Arrays.asList("Hello", "World")); - assertEquals("Hello", ((List)types.getAnyProperty()).get(0)); - assertEquals("World", ((List)types.getAnyProperty()).get(1)); + assertEquals("Hello", ((List)types.getAnyProperty()).get(0)); + assertEquals("World", ((List)types.getAnyProperty()).get(1)); // array of any types.setAnyArrayProperty(Arrays.asList("Hybrid", new Number(12), 123, false)); assertEquals(123, types.getAnyArrayProperty().get(2)); // map - Map map = new HashMap<>(); + Map map = new HashMap<>(); map.put("MapKey", "MapValue"); types.setAnyProperty(map); - assertEquals("MapValue", ((Map)types.getAnyProperty()).get("MapKey")); + assertEquals("MapValue", ((Map)types.getAnyProperty()).get("MapKey")); // map of any map.put("Goo", 19289812); @@ -184,7 +184,7 @@ public void unionTypes() { // array types.setUnionArrayProperty(Arrays.asList("Hello", 123, new Number(33))); - assertEquals(33, ((Number)((List)types.getUnionArrayProperty()).get(2)).getValue()); + assertEquals(33, ((Number)((List)types.getUnionArrayProperty()).get(2)).getValue()); } @@ -293,17 +293,15 @@ public void fluentApi() { } @Test - public void unionPropertiesWithFluentBuilder() throws Exception { + public void unionPropertiesWithBuilder() throws Exception { // verify we have a withXxx overload for each union type - UnionProperties.Builder firstBuilder = UnionProperties.builder(); - assertNotNull(firstBuilder.getClass().getMethod("withBar", java.lang.Number.class)); - assertNotNull(firstBuilder.getClass().getMethod("withBar", String.class)); - assertNotNull(firstBuilder.getClass().getMethod("withBar", AllTypes.class)); - - UnionProperties.Builder.Build lastBuilder = firstBuilder.withBar(1); - lastBuilder.getClass().getMethod("withFoo", String.class); - lastBuilder.getClass().getMethod("withFoo", java.lang.Number.class); + UnionProperties.Builder builder = UnionProperties.builder(); + assertNotNull(builder.getClass().getMethod("withBar", java.lang.Number.class)); + assertNotNull(builder.getClass().getMethod("withBar", String.class)); + assertNotNull(builder.getClass().getMethod("withBar", AllTypes.class)); + assertNotNull(builder.getClass().getMethod("withFoo", String.class)); + assertNotNull(builder.getClass().getMethod("withFoo", java.lang.Number.class)); UnionProperties obj1 = UnionProperties.builder() .withBar(12) diff --git a/packages/jsii-pacmak/lib/targets/java.ts b/packages/jsii-pacmak/lib/targets/java.ts index 77c613378d..29c1ae3b62 100644 --- a/packages/jsii-pacmak/lib/targets/java.ts +++ b/packages/jsii-pacmak/lib/targets/java.ts @@ -135,11 +135,12 @@ export default class Java extends Target { const MODULE_CLASS_NAME = '$Module'; const INTERFACE_PROXY_CLASS_NAME = 'Jsii$Proxy'; -const INTERFACE_POJO_CLASS_NAME = 'Jsii$Pojo'; const JSR305_NULLABLE = '@javax.annotation.Nullable'; class JavaGenerator extends Generator { + /** If false, @Generated will not include generator version nor timestamp */ + private emitFullGeneratorInfo?: boolean; private moduleClass: string; /** @@ -154,12 +155,14 @@ class JavaGenerator extends Generator { super({ generateOverloadsForMethodWithOptionals: true }); } - protected onBeginAssembly(assm: spec.Assembly, _fingerprint: boolean) { + protected onBeginAssembly(assm: spec.Assembly, fingerprint: boolean) { + this.emitFullGeneratorInfo = fingerprint; this.moduleClass = this.emitModuleFile(assm); } protected onEndAssembly(assm: spec.Assembly, fingerprint: boolean) { this.emitMavenPom(assm, fingerprint); + delete this.emitFullGeneratorInfo; } protected getAssemblyOutputDir(mod: spec.Assembly) { @@ -182,6 +185,7 @@ class JavaGenerator extends Generator { const inner = cls.parenttype ? ' static' : ''; const absPrefix = abstract ? ' abstract' : ''; + if (!cls.parenttype) { this.emitGeneratedAnnotation(); } this.code.line(`@software.amazon.jsii.Jsii(module = ${this.moduleClass}.class, fqn = "${cls.fqn}")`); this.code.openBlock(`public${inner}${absPrefix} class ${cls.name}${extendsExpression}${implementsExpr}`); @@ -251,6 +255,7 @@ class JavaGenerator extends Generator { protected onBeginEnum(enm: spec.EnumType) { this.openFileIfNeeded(enm); this.addJavaDocs(enm); + if (!enm.parenttype) { this.emitGeneratedAnnotation(); } this.code.line(`@software.amazon.jsii.Jsii(module = ${this.moduleClass}.class, fqn = "${enm.fqn}")`); this.code.openBlock(`public enum ${enm.name}`); } @@ -283,6 +288,7 @@ class JavaGenerator extends Generator { const bases = [ 'software.amazon.jsii.JsiiSerializable', ...interfaces.map(x => this.toNativeFqn(x.fqn!)) ].join(', '); const inner = ifc.parenttype ? ' static' : ''; + if (!ifc.parenttype) { this.emitGeneratedAnnotation(); } this.code.openBlock(`public${inner} interface ${ifc.name} extends ${bases}`); } @@ -449,12 +455,12 @@ class JavaGenerator extends Generator { version: VERSION }); - // Provides @javax.annotation.Nullable (among other stuff) + // Provides @javax.annotation.* dependencies.push({ - groupId: 'com.google.code.findbugs', - artifactId: 'jsr305', - version: '[3.0.2,)', - scope: 'compile' + groupId: 'javax.annotation', + artifactId: 'javax.annotation-api', + version: '[1.3.2,)', + scope: 'provided' }); return dependencies; } @@ -525,7 +531,7 @@ class JavaGenerator extends Generator { this.code.line(`${access} final static ${propType} ${propName};`); } - private emitProperty(cls: spec.Type, prop: spec.Property, includeGetter = true) { + private emitProperty(cls: spec.Type, prop: spec.Property, includeGetter = true, overrides = false) { const getterType = this.toJavaType(prop.type); const setterTypes = this.toJavaTypes(prop.type); const propClass = this.toJavaType(prop.type, true); @@ -537,6 +543,7 @@ class JavaGenerator extends Generator { // for unions we only generate overloads for setters, not getters. if (includeGetter) { this.addJavaDocs(prop); + if (overrides) { this.code.line('@Override'); } if (prop.type.optional) { this.code.line(JSR305_NULLABLE); } this.code.openBlock(`${access} ${statc}${getterType} get${propName}()`); @@ -556,6 +563,7 @@ class JavaGenerator extends Generator { if (!prop.immutable) { for (const type of setterTypes) { this.addJavaDocs(prop); + if (overrides) { this.code.line('@Override'); } const nullable = prop.type.optional ? `${JSR305_NULLABLE} ` : ''; this.code.openBlock(`${access} ${statc}void set${propName}(${nullable}final ${type} value)`); let statement = ''; @@ -573,7 +581,7 @@ class JavaGenerator extends Generator { } } - private emitMethod(cls: spec.Type, method: spec.Method) { + private emitMethod(cls: spec.Type, method: spec.Method, overrides = false) { const returnType = method.returns ? this.toJavaType(method.returns) : 'void'; const statc = method.static ? 'static ' : ''; const access = this.renderAccessLevel(method); @@ -581,6 +589,7 @@ class JavaGenerator extends Generator { const methodName = slugify(method.name); const signature = `${returnType} ${methodName}(${this.renderMethodParameters(method)})`; this.addJavaDocs(method); + if (overrides) { this.code.line('@Override'); } if (method.returns && method.returns.optional) { this.code.line(JSR305_NULLABLE); } if (method.abstract) { this.code.line(`${access} abstract ${signature};`); @@ -604,7 +613,7 @@ class JavaGenerator extends Generator { this.code.line('/**'); this.code.line(' * A proxy class which for javascript object literal which adhere to this interface.'); this.code.line(' */'); - this.code.openBlock(`class ${name} extends software.amazon.jsii.JsiiObject implements ${this.toNativeFqn(ifc.fqn)}`); + this.code.openBlock(`final class ${name} extends software.amazon.jsii.JsiiObject implements ${this.toNativeFqn(ifc.fqn)}`); this.emitJsiiInitializers(name); // compile a list of all unique methods from the current interface and all @@ -631,13 +640,15 @@ class JavaGenerator extends Generator { // emit all properties for (const propName of Object.keys(properties)) { const prop = properties[propName]; - this.emitProperty(ifc, prop); + this.code.line(); + this.emitProperty(ifc, prop, /* includeGetter: */ undefined, /* overrides: */ true); } // emit all the methods for (const methodName of Object.keys(methods)) { const method = methods[methodName]; - this.emitMethod(ifc, method); + this.code.line(); + this.emitMethod(ifc, method, /* overrides: */ true); } this.code.closeBlock(); @@ -646,14 +657,11 @@ class JavaGenerator extends Generator { private emitInterfaceBuilder(ifc: spec.InterfaceType) { const interfaceName = ifc.name; const builderName = 'Builder'; - const pojoName = INTERFACE_POJO_CLASS_NAME; this.code.line(); - this.code.line('// =================================================================='); - this.code.line('// Builder'); - this.code.line('// =================================================================='); - this.code.line(); - + this.code.line('/**'); + this.code.line(` * @return a {@link Builder} of {@link ${interfaceName}}`); + this.code.line(' */'); this.code.openBlock(`static ${builderName} builder()`); this.code.line(`return new ${builderName}();`); this.code.closeBlock(); @@ -666,15 +674,11 @@ class JavaGenerator extends Generator { fieldJavaType: string javaTypes: string[] optional?: boolean - stepInterfaceName: string - nextStepInterfaceName?: string inherited: boolean immutable: boolean } const props = new Array(); - const requiredProps = new Array(); - const optionalProps = new Array(); // collect all properties from all base structs const self = this; @@ -688,22 +692,14 @@ class JavaGenerator extends Generator { docs: property.docs, spec: property, propName, optional, - fieldName: '_' + self.code.toCamelCase(property.name), + fieldName: self.code.toCamelCase(property.name), fieldJavaType: self.toJavaType(property.type), javaTypes: self.toJavaTypes(property.type), immutable: property.immutable || false, - stepInterfaceName: optional ? 'Build' : `${propName}Step`, - nextStepInterfaceName: optional ? 'Build' : undefined, /* will be determined later */ inherited: isBaseClass, }; props.push(prop); - - if (prop.optional) { - optionalProps.push(prop); - } else { - requiredProps.push(prop); - } } // add props of base struct @@ -714,158 +710,76 @@ class JavaGenerator extends Generator { collectProps(ifc); - // determine `nextStepInterfaceName` for each property. - requiredProps.forEach((p, i) => { - const nextRequired = requiredProps[i + 1]; - const nextStep = nextRequired ? nextRequired.stepInterfaceName : 'Build'; - p.nextStepInterfaceName = nextStep; - }); + this.code.line(); + this.code.line('/**'); + this.code.line(` * A builder for {@link ${interfaceName}}`); + this.code.line(' */'); + this.code.openBlock(`final class ${builderName}`); - // if there are non required props at all, we just use the builder - if (requiredProps.length === 0) { - props.forEach(p => p.nextStepInterfaceName = builderName); + for (const prop of props) { + if (prop.optional) { + this.code.line(JSR305_NULLABLE); + } + this.code.line(`private ${prop.fieldJavaType} _${prop.fieldName};`); } - - const emitWithImplementation = (prop: Prop, isFirstProp = false) => { + this.code.line(); + for (const prop of props) { for (const type of prop.javaTypes) { - this.addJavaDocs(prop); - this.code.openBlock(`public ${prop.nextStepInterfaceName} with${prop.propName}(final ${type} value)`); - - if (isFirstProp) { - this.code.line(`return new FullBuilder().with${prop.propName}(value);`); + this.code.line('/**'); + this.code.line(` * Sets the value of ${prop.propName}`); + if (prop.docs && prop.docs.comment) { + this.code.line(` * @param value ${prop.docs.comment}`); } else { - if (!prop.optional) { - const propPath = `${interfaceName}#${this.code.toCamelCase(prop.propName)}`; - this.code.line(`java.util.Objects.requireNonNull(value, "${propPath} is required");`); - } - this.code.line(`this.instance.${prop.fieldName} = value;`); - this.code.line('return this;'); - } - - this.code.closeBlock(); - } - }; - - // If there are no required props, Builder /is/ the FullBuilder. Otherwise, Builder will - // reflect the first required prop and proxy to FullBuilder. - if (requiredProps.length > 0) { - this.code.line('/**'); - this.code.line(` * A fluent step builder class for {@link ${interfaceName}}.`); - this.code.line(' * The {@link Build#build()} method will be available once all required properties are fulfilled.'); - this.code.line(' */'); - this.code.openBlock(`final class ${builderName}`); - - const firstProp = requiredProps.shift()!; - emitWithImplementation(firstProp, true); - - const emitWithInterfaceMethod = (prop: Prop) => { - for (const type of prop.javaTypes) { - this.addJavaDocs(prop.spec, `Sets the value for {@link ${interfaceName}#get${prop.propName}}.`); - this.code.line(`${prop.nextStepInterfaceName} with${prop.propName}(final ${type} value);`); + this.code.line(` * @param value the value to be set`); } - }; - - // generate step interfaces - for (const rp of requiredProps) { - this.code.line(); - this.code.openBlock(`public interface ${rp.stepInterfaceName}`); - emitWithInterfaceMethod(rp); + this.code.line(` * @return {@code this}`); + this.code.line(' */'); + this.code.openBlock(`public ${builderName} with${prop.propName}(${prop.optional ? `${JSR305_NULLABLE} ` : ''}final ${type} value)`); + this.code.line(`this._${prop.fieldName} = ${_validateIfNonOptional('value', prop)};`); + this.code.line('return this;'); this.code.closeBlock(); } - - // generate 'Build' interface - this.code.line(); - this.code.openBlock(`public interface Build`); - this.code.line(`/**`); - this.code.line(` * @return a new {@link ${interfaceName}} object, initialized with the values set on this builder.`); - this.code.line(` */`); - this.code.line(`${interfaceName} build();`); - for (const opt of optionalProps) { - emitWithInterfaceMethod(opt); - } - this.code.closeBlock(); - - // generate the FullBuilder - this.code.line(); - const stepInterfaces = requiredProps.map(p => p.stepInterfaceName).concat([ 'Build' ]); - this.code.openBlock(`final class FullBuilder implements ${stepInterfaces.join(', ')}`); - - this.code.line(); - this.code.line(`private ${pojoName} instance = new ${pojoName}();`); - this.code.line(); - - for (const prop of props) { - emitWithImplementation(prop); - } - - this.code.openBlock(`public ${interfaceName} build()`); - this.code.line(`${interfaceName} result = this.instance;`); - this.code.line(`this.instance = new ${pojoName}();`); - this.code.line(`return result;`); - this.code.closeBlock(); - - this.code.closeBlock(); // FullBuilder - - this.code.closeBlock(); // Builder - } else { - this.code.line(); - this.code.line('/**'); - this.code.line(` * A fluent builder class for {@link ${interfaceName}}.`); - this.code.line(' */'); - this.code.openBlock(`public static final class ${builderName}`); - - this.code.line(`private ${pojoName} instance = new ${pojoName}();`); - this.code.line(); - - for (const prop of props) { - emitWithImplementation(prop); - } - - this.code.openBlock(`public ${interfaceName} build()`); - this.code.line(`${interfaceName} result = this.instance;`); - this.code.line(`this.instance = new ${pojoName}();`); - this.code.line(`return result;`); - this.code.closeBlock(); - - this.code.closeBlock(); // FullBuilder - - if (requiredProps.length > 0) { - this.code.closeBlock(); // Builder - } } - - this.code.line(); - this.code.line('/**'); - this.code.line(` * A PoJo (plain-old-java-object) class that implements {@link ${interfaceName}}.`); - this.code.line(' */'); - this.code.openBlock(`final class ${pojoName} implements ${interfaceName}`); - this.code.line(); this.code.line('/**'); - this.code.line(' * Constructor used by builders.'); + this.code.line(' * Builds the configured instance.'); + this.code.line(` * @return a new instance of {@link ${interfaceName}}`); + this.code.line(' * @throws NullPointerException if any required attribute was not provided'); this.code.line(' */'); - this.code.line(`protected ${pojoName}() { }`); - this.code.line(); - - props.forEach(p => { - this.code.line(); - this.code.line(`protected ${p.fieldJavaType} ${p.fieldName};`); + this.code.openBlock(`public ${interfaceName} build()`); + this.code.openBlock(`return new ${interfaceName}()`); + for (const prop of props) { + if (prop.optional) { this.code.line(JSR305_NULLABLE); } + // tslint:disable-next-line:max-line-length + this.code.line(`private${prop.immutable ? ' final' : ''} ${prop.fieldJavaType} ${prop.fieldName} = ${_validateIfNonOptional(`_${prop.fieldName}`, prop)};`); + } + for (const prop of props) { this.code.line(); - - this.code.openBlock(`public ${p.fieldJavaType} get${p.propName}()`); - this.code.line(`return this.${p.fieldName};`); + this.code.line('@Override'); + this.code.openBlock(`public ${prop.fieldJavaType} get${prop.propName}()`); + this.code.line(`return this.${prop.fieldName};`); this.code.closeBlock(); - - if (!p.immutable) { - for (const type of p.javaTypes) { - this.code.openBlock(`public void set${p.propName}(final ${type} value)`); - this.code.line(`this.${p.fieldName} = value;`); + if (!prop.immutable) { + for (const type of prop.javaTypes) { + this.code.line(); + this.code.line('@Override'); + this.code.openBlock(`public void set${prop.propName}(${prop.optional ? `${JSR305_NULLABLE} ` : ''}final ${type} value)`); + this.code.line(`this.${prop.fieldName} = ${_validateIfNonOptional('value', prop)};`); this.code.closeBlock(); } } - }); + } + this.code.unindent(); + this.code.line(`};`); /* return new Foo() */ - this.code.closeBlock(); + this.code.closeBlock(/* public Foo build() */); + + this.code.closeBlock(/* final class Builder */); + + function _validateIfNonOptional(variable: string, prop: Prop): string { + if (prop.optional) { return variable; } + return `java.util.Objects.requireNonNull(${variable}, "${prop.fieldName} is required")`; + } } private openFileIfNeeded(type: spec.Type) { @@ -876,6 +790,7 @@ class JavaGenerator extends Generator { this.code.openFile(this.toJavaFilePath(type.fqn)); if (type.namespace) { this.code.line(`package ${this.toNativeFqn(type.namespace)};`); + this.code.line(); } } @@ -1136,6 +1051,19 @@ class JavaGenerator extends Generator { return [javaPackage, ...name].join('.'); } + + /** + * Emits an ``@Generated`` annotation honoring the ``this.emitFullGeneratorInfo`` setting. + */ + private emitGeneratedAnnotation() { + const date = this.emitFullGeneratorInfo + ? `, date = "${new Date().toISOString()}"` + : ''; + const generator = this.emitFullGeneratorInfo + ? `jsii-pacmak/${VERSION_DESC}` + : 'jsii-pacmak'; + this.code.line(`@javax.annotation.Generated(value = "${generator}"${date})`); + } } function slugify(name?: string) { @@ -1186,4 +1114,4 @@ async function findJavaRuntimeLocalRepository() { } catch (e) { return undefined; } -} \ No newline at end of file +} diff --git a/packages/jsii-pacmak/package.json b/packages/jsii-pacmak/package.json index 5cebbdb95c..46cf880d3e 100644 --- a/packages/jsii-pacmak/package.json +++ b/packages/jsii-pacmak/package.json @@ -9,8 +9,8 @@ "types": "lib/index.d.ts", "scripts": { "gen": "/bin/bash generate.sh", - "build": "npm run gen && tsc && chmod +x bin/jsii-pacmak && tslint -p .", - "watch": "tsc -w", + "build": "npm run gen && tsc -b && chmod +x bin/jsii-pacmak && tslint -p .", + "watch": "tsc -b -w", "lint": "tslint -p . --force", "test": "/bin/bash test/diff-test.sh && /bin/bash test/build-test.sh", "package": "package-js" diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.Calculator.Base/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.Calculator.Base/.jsii index 62ac6482ca..10fc400e79 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.Calculator.Base/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.Calculator.Base/.jsii @@ -1,5 +1,4 @@ { - "fingerprint": "b+UZfT/No0vxqTQ1n3lIsyw7olqARDbeGj853lNFoE8=", "author": { "name": "Amazon Web Services", "organization": true, @@ -100,5 +99,6 @@ ] } }, - "version": "0.6.4" + "version": "0.6.4", + "fingerprint": "b+UZfT/No0vxqTQ1n3lIsyw7olqARDbeGj853lNFoE8=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/java/pom.xml b/packages/jsii-pacmak/test/expected.jsii-calc-base/java/pom.xml index 3bffc5e408..991615030c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/java/pom.xml +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/java/pom.xml @@ -44,10 +44,10 @@ 0.6.4 - com.google.code.findbugs - jsr305 - [3.0.2,) - compile + javax.annotation + javax.annotation-api + [1.3.2,) + provided diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/java/src/main/java/software/amazon/jsii/tests/calculator/base/Base.java b/packages/jsii-pacmak/test/expected.jsii-calc-base/java/src/main/java/software/amazon/jsii/tests/calculator/base/Base.java index 918cf602d2..2f1847c819 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/java/src/main/java/software/amazon/jsii/tests/calculator/base/Base.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/java/src/main/java/software/amazon/jsii/tests/calculator/base/Base.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator.base; + /** * A base class. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.base.$Module.class, fqn = "@scope/jsii-calc-base.Base") public abstract class Base extends software.amazon.jsii.JsiiObject { protected Base(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/java/src/main/java/software/amazon/jsii/tests/calculator/base/BaseProps.java b/packages/jsii-pacmak/test/expected.jsii-calc-base/java/src/main/java/software/amazon/jsii/tests/calculator/base/BaseProps.java index 8dc16a3eab..febe055a90 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/java/src/main/java/software/amazon/jsii/tests/calculator/base/BaseProps.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/java/src/main/java/software/amazon/jsii/tests/calculator/base/BaseProps.java @@ -1,106 +1,99 @@ package software.amazon.jsii.tests.calculator.base; + +@javax.annotation.Generated(value = "jsii-pacmak") public interface BaseProps extends software.amazon.jsii.JsiiSerializable, software.amazon.jsii.tests.calculator.baseofbase.VeryBaseProps { java.lang.String getBar(); void setBar(final java.lang.String value); - // ================================================================== - // Builder - // ================================================================== - + /** + * @return a {@link Builder} of {@link BaseProps} + */ static Builder builder() { return new Builder(); } + /** - * A fluent step builder class for {@link BaseProps}. - * The {@link Build#build()} method will be available once all required properties are fulfilled. + * A builder for {@link BaseProps} */ final class Builder { - public FooStep withBar(final java.lang.String value) { - return new FullBuilder().withBar(value); - } - - public interface FooStep { - /** - * Sets the value for {@link BaseProps#getFoo}. - */ - Build withFoo(final software.amazon.jsii.tests.calculator.baseofbase.Very value); - } + private java.lang.String _bar; + private software.amazon.jsii.tests.calculator.baseofbase.Very _foo; - public interface Build { - /** - * @return a new {@link BaseProps} object, initialized with the values set on this builder. - */ - BaseProps build(); + /** + * Sets the value of Bar + * @param value the value to be set + * @return {@code this} + */ + public Builder withBar(final java.lang.String value) { + this._bar = java.util.Objects.requireNonNull(value, "bar is required"); + return this; } - - final class FullBuilder implements FooStep, Build { - - private Jsii$Pojo instance = new Jsii$Pojo(); - - public FooStep withBar(final java.lang.String value) { - java.util.Objects.requireNonNull(value, "BaseProps#bar is required"); - this.instance._bar = value; - return this; - } - public Build withFoo(final software.amazon.jsii.tests.calculator.baseofbase.Very value) { - java.util.Objects.requireNonNull(value, "BaseProps#foo is required"); - this.instance._foo = value; - return this; - } - public BaseProps build() { - BaseProps result = this.instance; - this.instance = new Jsii$Pojo(); - return result; - } + /** + * Sets the value of Foo + * @param value the value to be set + * @return {@code this} + */ + public Builder withFoo(final software.amazon.jsii.tests.calculator.baseofbase.Very value) { + this._foo = java.util.Objects.requireNonNull(value, "foo is required"); + return this; } - } - - /** - * A PoJo (plain-old-java-object) class that implements {@link BaseProps}. - */ - final class Jsii$Pojo implements BaseProps { /** - * Constructor used by builders. + * Builds the configured instance. + * @return a new instance of {@link BaseProps} + * @throws NullPointerException if any required attribute was not provided */ - protected Jsii$Pojo() { } + public BaseProps build() { + return new BaseProps() { + private java.lang.String bar = java.util.Objects.requireNonNull(_bar, "bar is required"); + private software.amazon.jsii.tests.calculator.baseofbase.Very foo = java.util.Objects.requireNonNull(_foo, "foo is required"); + @Override + public java.lang.String getBar() { + return this.bar; + } - protected java.lang.String _bar; + @Override + public void setBar(final java.lang.String value) { + this.bar = java.util.Objects.requireNonNull(value, "bar is required"); + } - public java.lang.String getBar() { - return this._bar; - } - public void setBar(final java.lang.String value) { - this._bar = value; - } + @Override + public software.amazon.jsii.tests.calculator.baseofbase.Very getFoo() { + return this.foo; + } - protected software.amazon.jsii.tests.calculator.baseofbase.Very _foo; + @Override + public void setFoo(final software.amazon.jsii.tests.calculator.baseofbase.Very value) { + this.foo = java.util.Objects.requireNonNull(value, "foo is required"); + } - public software.amazon.jsii.tests.calculator.baseofbase.Very getFoo() { - return this._foo; - } - public void setFoo(final software.amazon.jsii.tests.calculator.baseofbase.Very value) { - this._foo = value; + }; } } /** * A proxy class which for javascript object literal which adhere to this interface. */ - class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.base.BaseProps { + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.base.BaseProps { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } + + @Override public java.lang.String getBar() { return this.jsiiGet("bar", java.lang.String.class); } + @Override public void setBar(final java.lang.String value) { this.jsiiSet("bar", java.util.Objects.requireNonNull(value, "bar is required")); } + + @Override public software.amazon.jsii.tests.calculator.baseofbase.Very getFoo() { return this.jsiiGet("foo", software.amazon.jsii.tests.calculator.baseofbase.Very.class); } + @Override public void setFoo(final software.amazon.jsii.tests.calculator.baseofbase.Very value) { this.jsiiSet("foo", java.util.Objects.requireNonNull(value, "foo is required")); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/.jsii index 71a27dff10..1a5b1f9174 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/.jsii @@ -1,5 +1,4 @@ { - "fingerprint": "qwjIHOtTOSWOv5qzVdHj4SDgxmnWYsacVvR7BkAVlo8=", "author": { "name": "Amazon Web Services", "organization": true, @@ -125,20 +124,20 @@ "properties": [ { "docs": { - "comment": "A string value" + "comment": "An awesome number value" }, - "name": "astring", + "name": "anumber", "type": { - "primitive": "string" + "primitive": "number" } }, { "docs": { - "comment": "An awesome number value" + "comment": "A string value" }, - "name": "anumber", + "name": "astring", "type": { - "primitive": "number" + "primitive": "string" } }, { @@ -187,20 +186,20 @@ "properties": [ { "docs": { - "comment": "The number." + "comment": "The number multiplied by 2." }, "immutable": true, - "name": "value", + "name": "doubleValue", "type": { "primitive": "number" } }, { "docs": { - "comment": "The number multiplied by 2." + "comment": "The number." }, "immutable": true, - "name": "doubleValue", + "name": "value", "type": { "primitive": "number" } @@ -315,5 +314,6 @@ ] } }, - "version": "0.6.4" + "version": "0.6.4", + "fingerprint": "MHdlbqyf1RV6moIHslfpKnl7yjQoYVvvZLfxFXWihrU=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/IMyFirstStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/IMyFirstStruct.cs index a79d406730..e63e79c604 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/IMyFirstStruct.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/IMyFirstStruct.cs @@ -6,17 +6,17 @@ namespace Amazon.JSII.Tests.Calculator.Lib [JsiiInterface(typeof(IMyFirstStruct), "@scope/jsii-calc-lib.MyFirstStruct")] public interface IMyFirstStruct { - /// A string value - [JsiiProperty("astring", "{\"primitive\":\"string\"}")] - string Astring + /// An awesome number value + [JsiiProperty("anumber", "{\"primitive\":\"number\"}")] + double Anumber { get; set; } - /// An awesome number value - [JsiiProperty("anumber", "{\"primitive\":\"number\"}")] - double Anumber + /// A string value + [JsiiProperty("astring", "{\"primitive\":\"string\"}")] + string Astring { get; set; diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/MyFirstStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/MyFirstStruct.cs index 05acb58cca..1e9ed2f82c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/MyFirstStruct.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/MyFirstStruct.cs @@ -5,17 +5,17 @@ namespace Amazon.JSII.Tests.Calculator.Lib /// This is the first struct we have created in jsii public class MyFirstStruct : DeputyBase, IMyFirstStruct { - /// A string value - [JsiiProperty("astring", "{\"primitive\":\"string\"}", true)] - public string Astring + /// An awesome number value + [JsiiProperty("anumber", "{\"primitive\":\"number\"}", true)] + public double Anumber { get; set; } - /// An awesome number value - [JsiiProperty("anumber", "{\"primitive\":\"number\"}", true)] - public double Anumber + /// A string value + [JsiiProperty("astring", "{\"primitive\":\"string\"}", true)] + public string Astring { get; set; diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/MyFirstStructProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/MyFirstStructProxy.cs index d77accff92..6f7647a9b1 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/MyFirstStructProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/MyFirstStructProxy.cs @@ -10,14 +10,6 @@ private MyFirstStructProxy(ByRefValue reference): base(reference) { } - /// A string value - [JsiiProperty("astring", "{\"primitive\":\"string\"}")] - public virtual string Astring - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - /// An awesome number value [JsiiProperty("anumber", "{\"primitive\":\"number\"}")] public virtual double Anumber @@ -26,6 +18,14 @@ public virtual double Anumber set => SetInstanceProperty(value); } + /// A string value + [JsiiProperty("astring", "{\"primitive\":\"string\"}")] + public virtual string Astring + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + [JsiiProperty("firstOptional", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}},\"optional\":true}")] public virtual string[] FirstOptional { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/Number.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/Number.cs index 984aa288f7..9da338c951 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/Number.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.Calculator.Lib/Number.cs @@ -18,16 +18,16 @@ protected Number(DeputyProps props): base(props) { } - /// The number. - [JsiiProperty("value", "{\"primitive\":\"number\"}")] - public override double Value + /// The number multiplied by 2. + [JsiiProperty("doubleValue", "{\"primitive\":\"number\"}")] + public virtual double DoubleValue { get => GetInstanceProperty(); } - /// The number multiplied by 2. - [JsiiProperty("doubleValue", "{\"primitive\":\"number\"}")] - public virtual double DoubleValue + /// The number. + [JsiiProperty("value", "{\"primitive\":\"number\"}")] + public override double Value { get => GetInstanceProperty(); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/pom.xml b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/pom.xml index a87797154e..84e9c92e2d 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/pom.xml +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/pom.xml @@ -44,10 +44,10 @@ 0.6.4 - com.google.code.findbugs - jsr305 - [3.0.2,) - compile + javax.annotation + javax.annotation-api + [1.3.2,) + provided diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/EnumFromScopedModule.java b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/EnumFromScopedModule.java index 91010a9c64..e4b0d2ce1e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/EnumFromScopedModule.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/EnumFromScopedModule.java @@ -1,8 +1,10 @@ package software.amazon.jsii.tests.calculator.lib; + /** * Check that enums from @scoped packages can be references. * See awslabs/jsii#138 */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.lib.$Module.class, fqn = "@scope/jsii-calc-lib.EnumFromScopedModule") public enum EnumFromScopedModule { Value1, diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/IFriendly.java b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/IFriendly.java index e355b7890c..d11c05bea4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/IFriendly.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/IFriendly.java @@ -1,8 +1,10 @@ package software.amazon.jsii.tests.calculator.lib; + /** * Applies to classes that are considered friendly. These classes can be greeted with * a "hello" or "goodbye" blessing and they will respond back in a fun and friendly manner. */ +@javax.annotation.Generated(value = "jsii-pacmak") public interface IFriendly extends software.amazon.jsii.JsiiSerializable { /** * Say hello! @@ -12,13 +14,15 @@ public interface IFriendly extends software.amazon.jsii.JsiiSerializable { /** * A proxy class which for javascript object literal which adhere to this interface. */ - class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.lib.IFriendly { + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.lib.IFriendly { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } + /** * Say hello! */ + @Override public java.lang.String hello() { return this.jsiiCall("hello", java.lang.String.class); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/MyFirstStruct.java b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/MyFirstStruct.java index e9d83a4a8b..b9e1b7ad1f 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/MyFirstStruct.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/MyFirstStruct.java @@ -1,16 +1,10 @@ package software.amazon.jsii.tests.calculator.lib; + /** * This is the first struct we have created in jsii */ +@javax.annotation.Generated(value = "jsii-pacmak") public interface MyFirstStruct extends software.amazon.jsii.JsiiSerializable { - /** - * A string value - */ - java.lang.String getAstring(); - /** - * A string value - */ - void setAstring(final java.lang.String value); /** * An awesome number value */ @@ -19,152 +13,151 @@ public interface MyFirstStruct extends software.amazon.jsii.JsiiSerializable { * An awesome number value */ void setAnumber(final java.lang.Number value); + /** + * A string value + */ + java.lang.String getAstring(); + /** + * A string value + */ + void setAstring(final java.lang.String value); java.util.List getFirstOptional(); void setFirstOptional(final java.util.List value); - // ================================================================== - // Builder - // ================================================================== - + /** + * @return a {@link Builder} of {@link MyFirstStruct} + */ static Builder builder() { return new Builder(); } + /** - * A fluent step builder class for {@link MyFirstStruct}. - * The {@link Build#build()} method will be available once all required properties are fulfilled. + * A builder for {@link MyFirstStruct} */ final class Builder { + private java.lang.Number _anumber; + private java.lang.String _astring; + @javax.annotation.Nullable + private java.util.List _firstOptional; + /** - * A string value + * Sets the value of Anumber + * @param value An awesome number value + * @return {@code this} */ - public AnumberStep withAstring(final java.lang.String value) { - return new FullBuilder().withAstring(value); + public Builder withAnumber(final java.lang.Number value) { + this._anumber = java.util.Objects.requireNonNull(value, "anumber is required"); + return this; } - - public interface AnumberStep { - /** - * An awesome number value - */ - Build withAnumber(final java.lang.Number value); + /** + * Sets the value of Astring + * @param value A string value + * @return {@code this} + */ + public Builder withAstring(final java.lang.String value) { + this._astring = java.util.Objects.requireNonNull(value, "astring is required"); + return this; } - - public interface Build { - /** - * @return a new {@link MyFirstStruct} object, initialized with the values set on this builder. - */ - MyFirstStruct build(); - /** - * Sets the value for {@link MyFirstStruct#getFirstOptional}. - */ - Build withFirstOptional(final java.util.List value); + /** + * Sets the value of FirstOptional + * @param value the value to be set + * @return {@code this} + */ + public Builder withFirstOptional(@javax.annotation.Nullable final java.util.List value) { + this._firstOptional = value; + return this; } - final class FullBuilder implements AnumberStep, Build { - - private Jsii$Pojo instance = new Jsii$Pojo(); - - /** - * A string value - */ - public AnumberStep withAstring(final java.lang.String value) { - java.util.Objects.requireNonNull(value, "MyFirstStruct#astring is required"); - this.instance._astring = value; - return this; - } - /** - * An awesome number value - */ - public Build withAnumber(final java.lang.Number value) { - java.util.Objects.requireNonNull(value, "MyFirstStruct#anumber is required"); - this.instance._anumber = value; - return this; - } - public Build withFirstOptional(final java.util.List value) { - this.instance._firstOptional = value; - return this; - } - public MyFirstStruct build() { - MyFirstStruct result = this.instance; - this.instance = new Jsii$Pojo(); - return result; - } + /** + * Builds the configured instance. + * @return a new instance of {@link MyFirstStruct} + * @throws NullPointerException if any required attribute was not provided + */ + public MyFirstStruct build() { + return new MyFirstStruct() { + private java.lang.Number anumber = java.util.Objects.requireNonNull(_anumber, "anumber is required"); + private java.lang.String astring = java.util.Objects.requireNonNull(_astring, "astring is required"); + @javax.annotation.Nullable + private java.util.List firstOptional = _firstOptional; + + @Override + public java.lang.Number getAnumber() { + return this.anumber; + } + + @Override + public void setAnumber(final java.lang.Number value) { + this.anumber = java.util.Objects.requireNonNull(value, "anumber is required"); + } + + @Override + public java.lang.String getAstring() { + return this.astring; + } + + @Override + public void setAstring(final java.lang.String value) { + this.astring = java.util.Objects.requireNonNull(value, "astring is required"); + } + + @Override + public java.util.List getFirstOptional() { + return this.firstOptional; + } + + @Override + public void setFirstOptional(@javax.annotation.Nullable final java.util.List value) { + this.firstOptional = value; + } + + }; } } /** - * A PoJo (plain-old-java-object) class that implements {@link MyFirstStruct}. + * A proxy class which for javascript object literal which adhere to this interface. */ - final class Jsii$Pojo implements MyFirstStruct { + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.lib.MyFirstStruct { + protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { + super(mode); + } /** - * Constructor used by builders. + * An awesome number value */ - protected Jsii$Pojo() { } - - - protected java.lang.String _astring; - - public java.lang.String getAstring() { - return this._astring; - } - public void setAstring(final java.lang.String value) { - this._astring = value; - } - - protected java.lang.Number _anumber; - + @Override public java.lang.Number getAnumber() { - return this._anumber; + return this.jsiiGet("anumber", java.lang.Number.class); } + /** + * An awesome number value + */ + @Override public void setAnumber(final java.lang.Number value) { - this._anumber = value; - } - - protected java.util.List _firstOptional; - - public java.util.List getFirstOptional() { - return this._firstOptional; - } - public void setFirstOptional(final java.util.List value) { - this._firstOptional = value; + this.jsiiSet("anumber", java.util.Objects.requireNonNull(value, "anumber is required")); } - } - /** - * A proxy class which for javascript object literal which adhere to this interface. - */ - class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.lib.MyFirstStruct { - protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { - super(mode); - } /** * A string value */ + @Override public java.lang.String getAstring() { return this.jsiiGet("astring", java.lang.String.class); } /** * A string value */ + @Override public void setAstring(final java.lang.String value) { this.jsiiSet("astring", java.util.Objects.requireNonNull(value, "astring is required")); } - /** - * An awesome number value - */ - public java.lang.Number getAnumber() { - return this.jsiiGet("anumber", java.lang.Number.class); - } - /** - * An awesome number value - */ - public void setAnumber(final java.lang.Number value) { - this.jsiiSet("anumber", java.util.Objects.requireNonNull(value, "anumber is required")); - } + + @Override @javax.annotation.Nullable public java.util.List getFirstOptional() { return this.jsiiGet("firstOptional", java.util.List.class); } + @Override public void setFirstOptional(@javax.annotation.Nullable final java.util.List value) { this.jsiiSet("firstOptional", value); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/Number.java b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/Number.java index daf727ae31..f3a7a98c80 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/Number.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/Number.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator.lib; + /** * Represents a concrete number. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.lib.$Module.class, fqn = "@scope/jsii-calc-lib.Number") public class Number extends software.amazon.jsii.tests.calculator.lib.Value { protected Number(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -15,16 +17,16 @@ public Number(final java.lang.Number value) { super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, java.util.stream.Stream.of(java.util.Objects.requireNonNull(value, "value is required")).toArray()); } - /** - * The number. - */ - public java.lang.Number getValue() { - return this.jsiiGet("value", java.lang.Number.class); - } /** * The number multiplied by 2. */ public java.lang.Number getDoubleValue() { return this.jsiiGet("doubleValue", java.lang.Number.class); } + /** + * The number. + */ + public java.lang.Number getValue() { + return this.jsiiGet("value", java.lang.Number.class); + } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/Operation.java b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/Operation.java index 3c9c8fae76..851f8ed649 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/Operation.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/Operation.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator.lib; + /** * Represents an operation on values. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.lib.$Module.class, fqn = "@scope/jsii-calc-lib.Operation") public abstract class Operation extends software.amazon.jsii.tests.calculator.lib.Value { protected Operation(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/StructWithOnlyOptionals.java b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/StructWithOnlyOptionals.java index bc284144a7..46f5b754d0 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/StructWithOnlyOptionals.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/StructWithOnlyOptionals.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator.lib; + /** * This is a struct with only optional properties. */ +@javax.annotation.Generated(value = "jsii-pacmak") public interface StructWithOnlyOptionals extends software.amazon.jsii.JsiiSerializable { /** * The first optional! @@ -16,91 +18,112 @@ public interface StructWithOnlyOptionals extends software.amazon.jsii.JsiiSerial java.lang.Boolean getOptional3(); void setOptional3(final java.lang.Boolean value); - // ================================================================== - // Builder - // ================================================================== - + /** + * @return a {@link Builder} of {@link StructWithOnlyOptionals} + */ static Builder builder() { return new Builder(); } /** - * A fluent builder class for {@link StructWithOnlyOptionals}. + * A builder for {@link StructWithOnlyOptionals} */ - public static final class Builder { - private Jsii$Pojo instance = new Jsii$Pojo(); + final class Builder { + @javax.annotation.Nullable + private java.lang.String _optional1; + @javax.annotation.Nullable + private java.lang.Number _optional2; + @javax.annotation.Nullable + private java.lang.Boolean _optional3; /** - * The first optional! + * Sets the value of Optional1 + * @param value The first optional! + * @return {@code this} */ - public Builder withOptional1(final java.lang.String value) { - this.instance._optional1 = value; + public Builder withOptional1(@javax.annotation.Nullable final java.lang.String value) { + this._optional1 = value; return this; } - public Builder withOptional2(final java.lang.Number value) { - this.instance._optional2 = value; + /** + * Sets the value of Optional2 + * @param value the value to be set + * @return {@code this} + */ + public Builder withOptional2(@javax.annotation.Nullable final java.lang.Number value) { + this._optional2 = value; return this; } - public Builder withOptional3(final java.lang.Boolean value) { - this.instance._optional3 = value; + /** + * Sets the value of Optional3 + * @param value the value to be set + * @return {@code this} + */ + public Builder withOptional3(@javax.annotation.Nullable final java.lang.Boolean value) { + this._optional3 = value; return this; } - public StructWithOnlyOptionals build() { - StructWithOnlyOptionals result = this.instance; - this.instance = new Jsii$Pojo(); - return result; - } - } - - /** - * A PoJo (plain-old-java-object) class that implements {@link StructWithOnlyOptionals}. - */ - final class Jsii$Pojo implements StructWithOnlyOptionals { /** - * Constructor used by builders. + * Builds the configured instance. + * @return a new instance of {@link StructWithOnlyOptionals} + * @throws NullPointerException if any required attribute was not provided */ - protected Jsii$Pojo() { } + public StructWithOnlyOptionals build() { + return new StructWithOnlyOptionals() { + @javax.annotation.Nullable + private java.lang.String optional1 = _optional1; + @javax.annotation.Nullable + private java.lang.Number optional2 = _optional2; + @javax.annotation.Nullable + private java.lang.Boolean optional3 = _optional3; + @Override + public java.lang.String getOptional1() { + return this.optional1; + } - protected java.lang.String _optional1; + @Override + public void setOptional1(@javax.annotation.Nullable final java.lang.String value) { + this.optional1 = value; + } - public java.lang.String getOptional1() { - return this._optional1; - } - public void setOptional1(final java.lang.String value) { - this._optional1 = value; - } + @Override + public java.lang.Number getOptional2() { + return this.optional2; + } - protected java.lang.Number _optional2; + @Override + public void setOptional2(@javax.annotation.Nullable final java.lang.Number value) { + this.optional2 = value; + } - public java.lang.Number getOptional2() { - return this._optional2; - } - public void setOptional2(final java.lang.Number value) { - this._optional2 = value; - } + @Override + public java.lang.Boolean getOptional3() { + return this.optional3; + } - protected java.lang.Boolean _optional3; + @Override + public void setOptional3(@javax.annotation.Nullable final java.lang.Boolean value) { + this.optional3 = value; + } - public java.lang.Boolean getOptional3() { - return this._optional3; - } - public void setOptional3(final java.lang.Boolean value) { - this._optional3 = value; + }; } } /** * A proxy class which for javascript object literal which adhere to this interface. */ - class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.lib.StructWithOnlyOptionals { + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.lib.StructWithOnlyOptionals { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } + /** * The first optional! */ + @Override @javax.annotation.Nullable public java.lang.String getOptional1() { return this.jsiiGet("optional1", java.lang.String.class); @@ -108,20 +131,27 @@ public java.lang.String getOptional1() { /** * The first optional! */ + @Override public void setOptional1(@javax.annotation.Nullable final java.lang.String value) { this.jsiiSet("optional1", value); } + + @Override @javax.annotation.Nullable public java.lang.Number getOptional2() { return this.jsiiGet("optional2", java.lang.Number.class); } + @Override public void setOptional2(@javax.annotation.Nullable final java.lang.Number value) { this.jsiiSet("optional2", value); } + + @Override @javax.annotation.Nullable public java.lang.Boolean getOptional3() { return this.jsiiGet("optional3", java.lang.Boolean.class); } + @Override public void setOptional3(@javax.annotation.Nullable final java.lang.Boolean value) { this.jsiiSet("optional3", value); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/Value.java b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/Value.java index 6a29d7a96a..7c4f94443b 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/Value.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/Value.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator.lib; + /** * Abstract class which represents a numeric value. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.lib.$Module.class, fqn = "@scope/jsii-calc-lib.Value") public abstract class Value extends software.amazon.jsii.tests.calculator.base.Base { protected Value(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/sphinx/_scope_jsii-calc-lib.rst b/packages/jsii-pacmak/test/expected.jsii-calc-lib/sphinx/_scope_jsii-calc-lib.rst index 313d99883e..cc1e8e5e7d 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/sphinx/_scope_jsii-calc-lib.rst +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/sphinx/_scope_jsii-calc-lib.rst @@ -195,20 +195,20 @@ MyFirstStruct (interface) - .. py:attribute:: astring + .. py:attribute:: anumber - A string value + An awesome number value - :type: string + :type: number - .. py:attribute:: anumber + .. py:attribute:: astring - An awesome number value + A string value - :type: number + :type: string .. py:attribute:: firstOptional @@ -246,17 +246,17 @@ Number :param value: The number. :type value: number - .. py:attribute:: value + .. py:attribute:: doubleValue - The number. + The number multiplied by 2. :type: number *(readonly)* - .. py:attribute:: doubleValue + .. py:attribute:: value - The number multiplied by 2. + The number. :type: number *(readonly)* diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/.jsii index 355277ea09..b29c5a2bc2 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/.jsii @@ -1,5 +1,4 @@ { - "fingerprint": "nIH7ZdupMWqiPid9t2N934g0BDqSHVKuq6mrGdRpuYk=", "author": { "name": "Amazon Web Services", "organization": true, @@ -252,54 +251,31 @@ "namespace": "jsii-calc", "properties": [ { - "name": "booleanProperty", - "type": { - "primitive": "boolean" - } - }, - { - "name": "stringProperty", - "type": { - "primitive": "string" - } - }, - { - "name": "numberProperty", + "immutable": true, + "name": "enumPropertyValue", "type": { "primitive": "number" } }, { - "name": "dateProperty", - "type": { - "primitive": "date" - } - }, - { - "name": "jsonProperty", - "type": { - "primitive": "json" - } - }, - { - "name": "mapProperty", + "name": "anyArrayProperty", "type": { "collection": { "elementtype": { - "primitive": "number" + "primitive": "any" }, - "kind": "map" + "kind": "array" } } }, { - "name": "arrayProperty", + "name": "anyMapProperty", "type": { "collection": { "elementtype": { - "primitive": "string" + "primitive": "any" }, - "kind": "array" + "kind": "map" } } }, @@ -310,71 +286,61 @@ } }, { - "name": "anyArrayProperty", + "name": "arrayProperty", "type": { "collection": { "elementtype": { - "primitive": "any" + "primitive": "string" }, "kind": "array" } } }, { - "name": "anyMapProperty", + "name": "booleanProperty", "type": { - "collection": { - "elementtype": { - "primitive": "any" - }, - "kind": "map" - } + "primitive": "boolean" } }, { - "name": "unknownProperty", + "name": "dateProperty", "type": { - "primitive": "any" + "primitive": "date" } }, { - "name": "unknownArrayProperty", + "name": "enumProperty", "type": { - "collection": { - "elementtype": { - "primitive": "any" - }, - "kind": "array" - } + "fqn": "jsii-calc.AllTypesEnum" } }, { - "name": "unknownMapProperty", + "name": "jsonProperty", + "type": { + "primitive": "json" + } + }, + { + "name": "mapProperty", "type": { "collection": { "elementtype": { - "primitive": "any" + "primitive": "number" }, "kind": "map" } } }, { - "name": "unionProperty", + "name": "numberProperty", "type": { - "union": { - "types": [ - { - "primitive": "string" - }, - { - "primitive": "number" - }, - { - "fqn": "jsii-calc.Multiply" - } - ] - } + "primitive": "number" + } + }, + { + "name": "stringProperty", + "type": { + "primitive": "string" } }, { @@ -418,23 +384,56 @@ } }, { - "name": "optionalEnumValue", + "name": "unionProperty", "type": { - "fqn": "jsii-calc.StringEnum", - "optional": true + "union": { + "types": [ + { + "primitive": "string" + }, + { + "primitive": "number" + }, + { + "fqn": "jsii-calc.Multiply" + } + ] + } } }, { - "name": "enumProperty", + "name": "unknownArrayProperty", "type": { - "fqn": "jsii-calc.AllTypesEnum" + "collection": { + "elementtype": { + "primitive": "any" + }, + "kind": "array" + } } }, { - "immutable": true, - "name": "enumPropertyValue", + "name": "unknownMapProperty", "type": { - "primitive": "number" + "collection": { + "elementtype": { + "primitive": "any" + }, + "kind": "map" + } + } + }, + { + "name": "unknownProperty", + "type": { + "primitive": "any" + } + }, + { + "name": "optionalEnumValue", + "type": { + "fqn": "jsii-calc.StringEnum", + "optional": true } } ] @@ -465,23 +464,6 @@ }, "kind": "class", "methods": [ - { - "docs": { - "comment": "getXxx() is not allowed (see negatives), but getXxx(a, ...) is okay." - }, - "name": "getFoo", - "parameters": [ - { - "name": "withParam", - "type": { - "primitive": "string" - } - } - ], - "returns": { - "primitive": "string" - } - }, { "name": "getBar", "parameters": [ @@ -501,9 +483,23 @@ }, { "docs": { - "comment": "setFoo(x) is not allowed (see negatives), but setXxx(a, b, ...) is okay." + "comment": "getXxx() is not allowed (see negatives), but getXxx(a, ...) is okay." }, - "name": "setFoo", + "name": "getFoo", + "parameters": [ + { + "name": "withParam", + "type": { + "primitive": "string" + } + } + ], + "returns": { + "primitive": "string" + } + }, + { + "name": "setBar", "parameters": [ { "name": "_x", @@ -516,11 +512,20 @@ "type": { "primitive": "number" } + }, + { + "name": "_z", + "type": { + "primitive": "boolean" + } } ] }, { - "name": "setBar", + "docs": { + "comment": "setFoo(x) is not allowed (see negatives), but setXxx(a, b, ...) is okay." + }, + "name": "setFoo", "parameters": [ { "name": "_x", @@ -533,12 +538,6 @@ "type": { "primitive": "number" } - }, - { - "name": "_z", - "type": { - "primitive": "boolean" - } } ] } @@ -561,28 +560,6 @@ "promise": true } }, - { - "name": "overrideMe", - "parameters": [ - { - "name": "mult", - "type": { - "primitive": "number" - } - } - ], - "returns": { - "primitive": "number", - "promise": true - } - }, - { - "name": "overrideMeToo", - "returns": { - "primitive": "number", - "promise": true - } - }, { "docs": { "comment": "Just calls \"overrideMeToo\"" @@ -608,6 +585,28 @@ "returns": { "primitive": "number" } + }, + { + "name": "overrideMe", + "parameters": [ + { + "name": "mult", + "type": { + "primitive": "number" + } + } + ], + "returns": { + "primitive": "number", + "promise": true + } + }, + { + "name": "overrideMeToo", + "returns": { + "primitive": "number", + "promise": true + } } ], "name": "AsyncVirtualMethods", @@ -748,6 +747,12 @@ } ] }, + { + "docs": { + "comment": "Negates the current value." + }, + "name": "neg" + }, { "docs": { "comment": "Raises the current value by a power." @@ -762,12 +767,6 @@ } ] }, - { - "docs": { - "comment": "Negates the current value." - }, - "name": "neg" - }, { "docs": { "comment": "Returns teh value of the union property (if defined)." @@ -783,13 +782,29 @@ "properties": [ { "docs": { - "comment": "The current value." + "comment": "Returns the expression." }, - "name": "curr", + "immutable": true, + "name": "expression", "type": { "fqn": "@scope/jsii-calc-lib.Value" } }, + { + "docs": { + "comment": "A log of all operations." + }, + "immutable": true, + "name": "operationsLog", + "type": { + "collection": { + "elementtype": { + "fqn": "@scope/jsii-calc-lib.Value" + }, + "kind": "array" + } + } + }, { "docs": { "comment": "A map of per operation name of all operations performed." @@ -812,17 +827,11 @@ }, { "docs": { - "comment": "A log of all operations." + "comment": "The current value." }, - "immutable": true, - "name": "operationsLog", + "name": "curr", "type": { - "collection": { - "elementtype": { - "fqn": "@scope/jsii-calc-lib.Value" - }, - "kind": "array" - } + "fqn": "@scope/jsii-calc-lib.Value" } }, { @@ -835,16 +844,6 @@ "primitive": "number" } }, - { - "docs": { - "comment": "Returns the expression." - }, - "immutable": true, - "name": "expression", - "type": { - "fqn": "@scope/jsii-calc-lib.Value" - } - }, { "docs": { "comment": "Example of a property that accepts a union of types." @@ -944,12 +943,9 @@ "namespace": "jsii-calc", "properties": [ { - "docs": { - "comment": "An example of a non primitive property." - }, - "name": "nonPrimitive", + "name": "anotherRequired", "type": { - "fqn": "jsii-calc.DoubleTrouble" + "primitive": "date" } }, { @@ -959,34 +955,37 @@ } }, { - "name": "anotherRequired", + "docs": { + "comment": "An example of a non primitive property." + }, + "name": "nonPrimitive", "type": { - "primitive": "date" + "fqn": "jsii-calc.DoubleTrouble" } }, { - "name": "optionalArray", + "docs": { + "comment": "This is optional." + }, + "name": "anotherOptional", "type": { "collection": { "elementtype": { - "primitive": "string" + "fqn": "@scope/jsii-calc-lib.Value" }, - "kind": "array" + "kind": "map" }, "optional": true } }, { - "docs": { - "comment": "This is optional." - }, - "name": "anotherOptional", + "name": "optionalArray", "type": { "collection": { "elementtype": { - "fqn": "@scope/jsii-calc-lib.Value" + "primitive": "string" }, - "kind": "map" + "kind": "array" }, "optional": true } @@ -1008,20 +1007,20 @@ "methods": [ { "docs": { - "comment": "Returns another random number." + "comment": "Say hello!" }, - "name": "next", + "name": "hello", "returns": { - "primitive": "number" + "primitive": "string" } }, { "docs": { - "comment": "Say hello!" + "comment": "Returns another random number." }, - "name": "hello", + "name": "next", "returns": { - "primitive": "string" + "primitive": "number" } } ], @@ -1038,19 +1037,19 @@ "methods": [ { "docs": { - "comment": "Returns the \"anumber\" from a MyFirstStruct struct;" + "comment": "Accepts a struct of type DerivedStruct and returns a struct of type FirstStruct." }, - "name": "readFirstNumber", + "name": "derivedToFirst", "parameters": [ { - "name": "first", + "name": "derived", "type": { - "fqn": "@scope/jsii-calc-lib.MyFirstStruct" + "fqn": "jsii-calc.DerivedStruct" } } ], "returns": { - "primitive": "number" + "fqn": "@scope/jsii-calc-lib.MyFirstStruct" } }, { @@ -1072,19 +1071,19 @@ }, { "docs": { - "comment": "Accepts a struct of type DerivedStruct and returns a struct of type FirstStruct." + "comment": "Returns the \"anumber\" from a MyFirstStruct struct;" }, - "name": "derivedToFirst", + "name": "readFirstNumber", "parameters": [ { - "name": "derived", + "name": "first", "type": { - "fqn": "jsii-calc.DerivedStruct" + "fqn": "@scope/jsii-calc-lib.MyFirstStruct" } } ], "returns": { - "fqn": "@scope/jsii-calc-lib.MyFirstStruct" + "primitive": "number" } } ], @@ -1115,19 +1114,19 @@ "methods": [ { "docs": { - "comment": "Say goodbye.", - "return": "A goodbye blessing." + "comment": "Say farewell." }, - "name": "goodbye", + "name": "farewell", "returns": { "primitive": "string" } }, { "docs": { - "comment": "Say farewell." + "comment": "Say goodbye.", + "return": "A goodbye blessing." }, - "name": "farewell", + "name": "goodbye", "returns": { "primitive": "string" } @@ -1349,10 +1348,10 @@ "name": "default" }, { - "name": "double" + "name": "do" }, { - "name": "do" + "name": "double" }, { "name": "else" @@ -1527,9 +1526,9 @@ "methods": [ { "docs": { - "comment": "String representation of the value." + "comment": "Say farewell." }, - "name": "toString", + "name": "farewell", "returns": { "primitive": "string" } @@ -1545,20 +1544,20 @@ }, { "docs": { - "comment": "Say farewell." + "comment": "Returns another random number." }, - "name": "farewell", + "name": "next", "returns": { - "primitive": "string" + "primitive": "number" } }, { "docs": { - "comment": "Returns another random number." + "comment": "String representation of the value." }, - "name": "next", + "name": "toString", "returns": { - "primitive": "number" + "primitive": "string" } } ], @@ -1606,36 +1605,36 @@ "methods": [ { "docs": { - "comment": "String representation of the value." + "comment": "Say farewell." }, - "name": "toString", + "name": "farewell", "returns": { "primitive": "string" } }, { "docs": { - "comment": "Say hello!" + "comment": "Say goodbye." }, - "name": "hello", + "name": "goodbye", "returns": { "primitive": "string" } }, { "docs": { - "comment": "Say goodbye." + "comment": "Say hello!" }, - "name": "goodbye", + "name": "hello", "returns": { "primitive": "string" } }, { "docs": { - "comment": "Say farewell." + "comment": "String representation of the value." }, - "name": "farewell", + "name": "toString", "returns": { "primitive": "string" } @@ -1667,6 +1666,16 @@ }, "kind": "class", "methods": [ + { + "docs": { + "comment": "Uses node.js \"crypto\" module to calculate sha256 of a string.", + "return": "\"6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50\"" + }, + "name": "cryptoSha256", + "returns": { + "primitive": "string" + } + }, { "docs": { "comment": "Reads a local resource file (resource.txt) asynchronously.", @@ -1687,16 +1696,6 @@ "returns": { "primitive": "string" } - }, - { - "docs": { - "comment": "Uses node.js \"crypto\" module to calculate sha256 of a string.", - "return": "\"6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50\"" - }, - "name": "cryptoSha256", - "returns": { - "primitive": "string" - } } ], "name": "NodeStandardLibrary", @@ -1733,12 +1732,6 @@ }, "kind": "class", "methods": [ - { - "name": "nextTimes100", - "returns": { - "primitive": "number" - } - }, { "name": "isSameGenerator", "parameters": [ @@ -1752,6 +1745,12 @@ "returns": { "primitive": "boolean" } + }, + { + "name": "nextTimes100", + "returns": { + "primitive": "number" + } } ], "name": "NumberGenerator", @@ -1927,20 +1926,20 @@ }, { "docs": { - "comment": "The number of times to multiply" + "comment": "The expression that this operation consists of.\nMust be implemented by derived classes." }, "immutable": true, - "name": "pow", + "name": "expression", "type": { "fqn": "@scope/jsii-calc-lib.Value" } }, { "docs": { - "comment": "The expression that this operation consists of.\nMust be implemented by derived classes." + "comment": "The number of times to multiply" }, "immutable": true, - "name": "expression", + "name": "pow", "type": { "fqn": "@scope/jsii-calc-lib.Value" } @@ -2100,34 +2099,36 @@ "namespace": "jsii-calc", "properties": [ { + "const": true, + "docs": { + "comment": "Constants may also use all-caps." + }, "immutable": true, - "name": "value", + "name": "BAR", + "static": true, "type": { - "primitive": "string" + "primitive": "number" } }, { "const": true, - "docs": { - "comment": "Jsdocs for static property." - }, "immutable": true, - "name": "Foo", + "name": "ConstObj", "static": true, "type": { - "primitive": "string" + "fqn": "jsii-calc.DoubleTrouble" } }, { "const": true, "docs": { - "comment": "Constants may also use all-caps." + "comment": "Jsdocs for static property." }, "immutable": true, - "name": "BAR", + "name": "Foo", "static": true, "type": { - "primitive": "number" + "primitive": "string" } }, { @@ -2165,12 +2166,10 @@ } }, { - "const": true, "immutable": true, - "name": "ConstObj", - "static": true, + "name": "value", "type": { - "fqn": "jsii-calc.DoubleTrouble" + "primitive": "string" } } ] @@ -2209,6 +2208,16 @@ "name": "Sum", "namespace": "jsii-calc", "properties": [ + { + "docs": { + "comment": "The expression that this operation consists of.\nMust be implemented by derived classes." + }, + "immutable": true, + "name": "expression", + "type": { + "fqn": "@scope/jsii-calc-lib.Value" + } + }, { "docs": { "comment": "The parts to sum." @@ -2222,16 +2231,6 @@ "kind": "array" } } - }, - { - "docs": { - "comment": "The expression that this operation consists of.\nMust be implemented by derived classes." - }, - "immutable": true, - "name": "expression", - "type": { - "fqn": "@scope/jsii-calc-lib.Value" - } } ] }, @@ -2244,31 +2243,28 @@ "kind": "class", "methods": [ { - "name": "callerIsMethod", + "name": "callerIsAsync", "returns": { - "primitive": "number" + "primitive": "number", + "promise": true } }, { - "name": "callerIsAsync", + "name": "callerIsMethod", "returns": { - "primitive": "number", - "promise": true + "primitive": "number" } }, { - "name": "virtualMethod", + "name": "modifyOtherProperty", "parameters": [ { - "name": "n", + "name": "value", "type": { - "primitive": "number" + "primitive": "string" } } - ], - "returns": { - "primitive": "number" - } + ] }, { "name": "modifyValueOfTheProperty", @@ -2282,36 +2278,39 @@ ] }, { - "name": "retrieveValueOfTheProperty", + "name": "readA", "returns": { - "primitive": "string" + "primitive": "number" } }, { - "name": "retrieveReadOnlyProperty", + "name": "retrieveOtherProperty", "returns": { "primitive": "string" } }, { - "name": "modifyOtherProperty", - "parameters": [ - { - "name": "value", - "type": { - "primitive": "string" - } - } - ] + "name": "retrieveReadOnlyProperty", + "returns": { + "primitive": "string" + } }, { - "name": "retrieveOtherProperty", + "name": "retrieveValueOfTheProperty", "returns": { "primitive": "string" } }, { - "name": "readA", + "name": "virtualMethod", + "parameters": [ + { + "name": "n", + "type": { + "primitive": "number" + } + } + ], "returns": { "primitive": "number" } @@ -2332,22 +2331,22 @@ "namespace": "jsii-calc", "properties": [ { - "name": "callerIsProperty", + "immutable": true, + "name": "readonlyProperty", "type": { - "primitive": "number" + "primitive": "string" } }, { - "name": "theProperty", + "name": "a", "type": { - "primitive": "string" + "primitive": "number" } }, { - "immutable": true, - "name": "readonlyProperty", + "name": "callerIsProperty", "type": { - "primitive": "string" + "primitive": "number" } }, { @@ -2357,15 +2356,15 @@ } }, { - "name": "valueOfOtherProperty", + "name": "theProperty", "type": { "primitive": "string" } }, { - "name": "a", + "name": "valueOfOtherProperty", "type": { - "primitive": "number" + "primitive": "string" } } ] @@ -2428,9 +2427,9 @@ "namespace": "jsii-calc", "properties": [ { - "name": "foo", + "immutable": true, + "name": "bar", "type": { - "optional": true, "union": { "types": [ { @@ -2438,15 +2437,18 @@ }, { "primitive": "number" + }, + { + "fqn": "jsii-calc.AllTypes" } ] } } }, { - "immutable": true, - "name": "bar", + "name": "foo", "type": { + "optional": true, "union": { "types": [ { @@ -2454,9 +2456,6 @@ }, { "primitive": "number" - }, - { - "fqn": "jsii-calc.AllTypes" } ] } @@ -2526,12 +2525,12 @@ } }, { - "name": "writeAndRead", + "name": "readStringAndNumber", "parameters": [ { - "name": "value", + "name": "ext", "type": { - "primitive": "string" + "fqn": "jsii-calc.IInterfaceWithPropertiesExtension" } } ], @@ -2540,12 +2539,12 @@ } }, { - "name": "readStringAndNumber", + "name": "writeAndRead", "parameters": [ { - "name": "ext", + "name": "value", "type": { - "fqn": "jsii-calc.IInterfaceWithPropertiesExtension" + "primitive": "string" } } ], @@ -2633,10 +2632,10 @@ "kind": "class", "methods": [ { - "name": "serialSumAsync", + "name": "overrideMeAsync", "parameters": [ { - "name": "count", + "name": "index", "type": { "primitive": "number" } @@ -2648,22 +2647,21 @@ } }, { - "name": "parallelSumAsync", + "name": "overrideMeSync", "parameters": [ { - "name": "count", + "name": "index", "type": { "primitive": "number" } } ], "returns": { - "primitive": "number", - "promise": true + "primitive": "number" } }, { - "name": "sumSync", + "name": "parallelSumAsync", "parameters": [ { "name": "count", @@ -2673,14 +2671,15 @@ } ], "returns": { - "primitive": "number" + "primitive": "number", + "promise": true } }, { - "name": "overrideMeAsync", + "name": "serialSumAsync", "parameters": [ { - "name": "index", + "name": "count", "type": { "primitive": "number" } @@ -2692,10 +2691,10 @@ } }, { - "name": "overrideMeSync", + "name": "sumSync", "parameters": [ { - "name": "index", + "name": "count", "type": { "primitive": "number" } @@ -2738,26 +2737,24 @@ "namespace": "jsii-calc.composition", "properties": [ { + "abstract": true, "docs": { - "comment": "The .toString() style." + "comment": "The expression that this operation consists of.\nMust be implemented by derived classes." }, - "name": "stringStyle", + "immutable": true, + "name": "expression", "type": { - "fqn": "jsii-calc.composition.CompositionStringStyle" + "fqn": "@scope/jsii-calc-lib.Value" } }, { "docs": { - "comment": "A set of prefixes to include in a decorated .toString()." + "comment": "The value." }, - "name": "decorationPrefixes", + "immutable": true, + "name": "value", "type": { - "collection": { - "elementtype": { - "primitive": "string" - }, - "kind": "array" - } + "primitive": "number" } }, { @@ -2776,23 +2773,25 @@ }, { "docs": { - "comment": "The value." + "comment": "A set of prefixes to include in a decorated .toString()." }, - "immutable": true, - "name": "value", + "name": "decorationPrefixes", "type": { - "primitive": "number" + "collection": { + "elementtype": { + "primitive": "string" + }, + "kind": "array" + } } }, { - "abstract": true, "docs": { - "comment": "The expression that this operation consists of.\nMust be implemented by derived classes." + "comment": "The .toString() style." }, - "immutable": true, - "name": "expression", + "name": "stringStyle", "type": { - "fqn": "@scope/jsii-calc-lib.Value" + "fqn": "jsii-calc.composition.CompositionStringStyle" } } ] @@ -2816,5 +2815,6 @@ "namespace": "jsii-calc.composition" } }, - "version": "0.6.4" + "version": "0.6.4", + "fingerprint": "ukdkUVnf3jHKB7TV8FhG/tHnl04+DaTZSoIEZxym6Js=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/AllTypes.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/AllTypes.cs index 5d943437fc..583753409e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/AllTypes.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/AllTypes.cs @@ -25,24 +25,44 @@ protected AllTypes(DeputyProps props): base(props) { } - [JsiiProperty("booleanProperty", "{\"primitive\":\"boolean\"}")] - public virtual bool BooleanProperty + [JsiiProperty("enumPropertyValue", "{\"primitive\":\"number\"}")] + public virtual double EnumPropertyValue { - get => GetInstanceProperty(); + get => GetInstanceProperty(); + } + + [JsiiProperty("anyArrayProperty", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"any\"}}}")] + public virtual object[] AnyArrayProperty + { + get => GetInstanceProperty(); set => SetInstanceProperty(value); } - [JsiiProperty("stringProperty", "{\"primitive\":\"string\"}")] - public virtual string StringProperty + [JsiiProperty("anyMapProperty", "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"primitive\":\"any\"}}}")] + public virtual IDictionary AnyMapProperty { - get => GetInstanceProperty(); + get => GetInstanceProperty>(); set => SetInstanceProperty(value); } - [JsiiProperty("numberProperty", "{\"primitive\":\"number\"}")] - public virtual double NumberProperty + [JsiiProperty("anyProperty", "{\"primitive\":\"any\"}")] + public virtual object AnyProperty { - get => GetInstanceProperty(); + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + + [JsiiProperty("arrayProperty", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}")] + public virtual string[] ArrayProperty + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + + [JsiiProperty("booleanProperty", "{\"primitive\":\"boolean\"}")] + public virtual bool BooleanProperty + { + get => GetInstanceProperty(); set => SetInstanceProperty(value); } @@ -53,6 +73,13 @@ public virtual DateTime DateProperty set => SetInstanceProperty(value); } + [JsiiProperty("enumProperty", "{\"fqn\":\"jsii-calc.AllTypesEnum\"}")] + public virtual AllTypesEnum EnumProperty + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + [JsiiProperty("jsonProperty", "{\"primitive\":\"json\"}")] public virtual JObject JsonProperty { @@ -67,36 +94,36 @@ public virtual IDictionary MapProperty set => SetInstanceProperty(value); } - [JsiiProperty("arrayProperty", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}")] - public virtual string[] ArrayProperty + [JsiiProperty("numberProperty", "{\"primitive\":\"number\"}")] + public virtual double NumberProperty { - get => GetInstanceProperty(); + get => GetInstanceProperty(); set => SetInstanceProperty(value); } - [JsiiProperty("anyProperty", "{\"primitive\":\"any\"}")] - public virtual object AnyProperty + [JsiiProperty("stringProperty", "{\"primitive\":\"string\"}")] + public virtual string StringProperty { - get => GetInstanceProperty(); + get => GetInstanceProperty(); set => SetInstanceProperty(value); } - [JsiiProperty("anyArrayProperty", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"any\"}}}")] - public virtual object[] AnyArrayProperty + [JsiiProperty("unionArrayProperty", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"union\":{\"types\":[{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.composition.CompositeOperation\"}]}}}}")] + public virtual object[] UnionArrayProperty { get => GetInstanceProperty(); set => SetInstanceProperty(value); } - [JsiiProperty("anyMapProperty", "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"primitive\":\"any\"}}}")] - public virtual IDictionary AnyMapProperty + [JsiiProperty("unionMapProperty", "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"}]}}}}")] + public virtual IDictionary UnionMapProperty { get => GetInstanceProperty>(); set => SetInstanceProperty(value); } - [JsiiProperty("unknownProperty", "{\"primitive\":\"any\"}")] - public virtual object UnknownProperty + [JsiiProperty("unionProperty", "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.Multiply\"}]}}")] + public virtual object UnionProperty { get => GetInstanceProperty(); set => SetInstanceProperty(value); @@ -116,27 +143,13 @@ public virtual IDictionary UnknownMapProperty set => SetInstanceProperty(value); } - [JsiiProperty("unionProperty", "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.Multiply\"}]}}")] - public virtual object UnionProperty + [JsiiProperty("unknownProperty", "{\"primitive\":\"any\"}")] + public virtual object UnknownProperty { get => GetInstanceProperty(); set => SetInstanceProperty(value); } - [JsiiProperty("unionArrayProperty", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"union\":{\"types\":[{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.composition.CompositeOperation\"}]}}}}")] - public virtual object[] UnionArrayProperty - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - - [JsiiProperty("unionMapProperty", "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"}]}}}}")] - public virtual IDictionary UnionMapProperty - { - get => GetInstanceProperty>(); - set => SetInstanceProperty(value); - } - [JsiiProperty("optionalEnumValue", "{\"fqn\":\"jsii-calc.StringEnum\",\"optional\":true}")] public virtual StringEnum OptionalEnumValue { @@ -144,19 +157,6 @@ public virtual StringEnum OptionalEnumValue set => SetInstanceProperty(value); } - [JsiiProperty("enumProperty", "{\"fqn\":\"jsii-calc.AllTypesEnum\"}")] - public virtual AllTypesEnum EnumProperty - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - - [JsiiProperty("enumPropertyValue", "{\"primitive\":\"number\"}")] - public virtual double EnumPropertyValue - { - get => GetInstanceProperty(); - } - [JsiiMethod("enumMethod", "{\"fqn\":\"jsii-calc.StringEnum\"}", "[{\"name\":\"value\",\"type\":{\"fqn\":\"jsii-calc.StringEnum\"}}]")] public virtual StringEnum EnumMethod(StringEnum value) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/AllowedMethodNames.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/AllowedMethodNames.cs index a7b2cdadfa..b2c1465f59 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/AllowedMethodNames.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/AllowedMethodNames.cs @@ -17,6 +17,12 @@ protected AllowedMethodNames(DeputyProps props): base(props) { } + [JsiiMethod("getBar", null, "[{\"name\":\"_p1\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"_p2\",\"type\":{\"primitive\":\"number\"}}]")] + public virtual void GetBar(string _p1, double _p2) + { + InvokeInstanceVoidMethod(new object[]{_p1, _p2}); + } + /// getXxx() is not allowed (see negatives), but getXxx(a, ...) is okay. [JsiiMethod("getFoo", "{\"primitive\":\"string\"}", "[{\"name\":\"withParam\",\"type\":{\"primitive\":\"string\"}}]")] public virtual string GetFoo(string withParam) @@ -24,10 +30,10 @@ public virtual string GetFoo(string withParam) return InvokeInstanceMethod(new object[]{withParam}); } - [JsiiMethod("getBar", null, "[{\"name\":\"_p1\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"_p2\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual void GetBar(string _p1, double _p2) + [JsiiMethod("setBar", null, "[{\"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) { - InvokeInstanceVoidMethod(new object[]{_p1, _p2}); + InvokeInstanceVoidMethod(new object[]{_x, _y, _z}); } /// setFoo(x) is not allowed (see negatives), but setXxx(a, b, ...) is okay. @@ -36,11 +42,5 @@ public virtual void SetFoo(string _x, double _y) { InvokeInstanceVoidMethod(new object[]{_x, _y}); } - - [JsiiMethod("setBar", null, "[{\"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) - { - InvokeInstanceVoidMethod(new object[]{_x, _y, _z}); - } } } \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/AsyncVirtualMethods.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/AsyncVirtualMethods.cs index 76a35a912e..5e4c21d05e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/AsyncVirtualMethods.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/AsyncVirtualMethods.cs @@ -23,18 +23,6 @@ public virtual double CallMe() return InvokeInstanceMethod(new object[]{}); } - [JsiiMethod("overrideMe", "{\"primitive\":\"number\",\"promise\":true}", "[{\"name\":\"mult\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual double OverrideMe(double mult) - { - return InvokeInstanceMethod(new object[]{mult}); - } - - [JsiiMethod("overrideMeToo", "{\"primitive\":\"number\",\"promise\":true}", "[]")] - public virtual double OverrideMeToo() - { - return InvokeInstanceMethod(new object[]{}); - } - /// Just calls "overrideMeToo" [JsiiMethod("callMe2", "{\"primitive\":\"number\",\"promise\":true}", "[]")] public virtual double CallMe2() @@ -59,5 +47,17 @@ public virtual double DontOverrideMe() { return InvokeInstanceMethod(new object[]{}); } + + [JsiiMethod("overrideMe", "{\"primitive\":\"number\",\"promise\":true}", "[{\"name\":\"mult\",\"type\":{\"primitive\":\"number\"}}]")] + public virtual double OverrideMe(double mult) + { + return InvokeInstanceMethod(new object[]{mult}); + } + + [JsiiMethod("overrideMeToo", "{\"primitive\":\"number\",\"promise\":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.Calculator/Calculator_.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Calculator_.cs index e257335db2..f70ce23c46 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Calculator_.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Calculator_.cs @@ -21,12 +21,18 @@ protected Calculator_(DeputyProps props): base(props) { } - /// The current value. - [JsiiProperty("curr", "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] - public virtual Value_ Curr + /// Returns the expression. + [JsiiProperty("expression", "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] + public override Value_ Expression { get => GetInstanceProperty(); - set => SetInstanceProperty(value); + } + + /// A log of all operations. + [JsiiProperty("operationsLog", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}}")] + public virtual Value_[] OperationsLog + { + get => GetInstanceProperty(); } /// A map of per operation name of all operations performed. @@ -36,11 +42,12 @@ public virtual IDictionary OperationsMap get => GetInstanceProperty>(); } - /// A log of all operations. - [JsiiProperty("operationsLog", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}}")] - public virtual Value_[] OperationsLog + /// The current value. + [JsiiProperty("curr", "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] + public virtual Value_ Curr { - get => GetInstanceProperty(); + get => GetInstanceProperty(); + set => SetInstanceProperty(value); } /// The maximum value allows in this calculator. @@ -51,13 +58,6 @@ public virtual double? MaxValue set => SetInstanceProperty(value); } - /// Returns the expression. - [JsiiProperty("expression", "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] - public override Value_ Expression - { - get => GetInstanceProperty(); - } - /// Example of a property that accepts a union of types. [JsiiProperty("unionProperty", "{\"union\":{\"types\":[{\"fqn\":\"jsii-calc.Add\"},{\"fqn\":\"jsii-calc.Multiply\"},{\"fqn\":\"jsii-calc.Power\"}]},\"optional\":true}")] public virtual object UnionProperty @@ -80,13 +80,6 @@ public virtual void Mul(double value) InvokeInstanceVoidMethod(new object[]{value}); } - /// Raises the current value by a power. - [JsiiMethod("pow", null, "[{\"name\":\"value\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual void Pow(double value) - { - InvokeInstanceVoidMethod(new object[]{value}); - } - /// Negates the current value. [JsiiMethod("neg", null, "[]")] public virtual void Neg() @@ -94,6 +87,13 @@ public virtual void Neg() InvokeInstanceVoidMethod(new object[]{}); } + /// Raises the current value by a power. + [JsiiMethod("pow", null, "[{\"name\":\"value\",\"type\":{\"primitive\":\"number\"}}]")] + public virtual void Pow(double value) + { + InvokeInstanceVoidMethod(new object[]{value}); + } + /// Returns teh value of the union property (if defined). [JsiiMethod("readUnionValue", "{\"primitive\":\"number\"}", "[]")] public virtual double ReadUnionValue() diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/DerivedStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/DerivedStruct.cs index 2ddf0decab..bc2b0ce71c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/DerivedStruct.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/DerivedStruct.cs @@ -8,9 +8,8 @@ namespace Amazon.JSII.Tests.Calculator /// A struct which derives from another struct. public class DerivedStruct : DeputyBase, IDerivedStruct { - /// An example of a non primitive property. - [JsiiProperty("nonPrimitive", "{\"fqn\":\"jsii-calc.DoubleTrouble\"}", true)] - public DoubleTrouble NonPrimitive + [JsiiProperty("anotherRequired", "{\"primitive\":\"date\"}", true)] + public DateTime AnotherRequired { get; set; @@ -23,15 +22,9 @@ public bool Bool set; } - [JsiiProperty("anotherRequired", "{\"primitive\":\"date\"}", true)] - public DateTime AnotherRequired - { - get; - set; - } - - [JsiiProperty("optionalArray", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}},\"optional\":true}", true)] - public string[] OptionalArray + /// An example of a non primitive property. + [JsiiProperty("nonPrimitive", "{\"fqn\":\"jsii-calc.DoubleTrouble\"}", true)] + public DoubleTrouble NonPrimitive { get; set; @@ -45,9 +38,8 @@ public IDictionary AnotherOptional set; } - /// A string value - [JsiiProperty("astring", "{\"primitive\":\"string\"}", true)] - public string Astring + [JsiiProperty("optionalArray", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}},\"optional\":true}", true)] + public string[] OptionalArray { get; set; @@ -61,6 +53,14 @@ public double Anumber set; } + /// A string value + [JsiiProperty("astring", "{\"primitive\":\"string\"}", true)] + public string Astring + { + get; + set; + } + [JsiiProperty("firstOptional", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}},\"optional\":true}", true)] public string[] FirstOptional { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/DerivedStructProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/DerivedStructProxy.cs index 545446b56d..e83156e2d4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/DerivedStructProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/DerivedStructProxy.cs @@ -13,11 +13,10 @@ private DerivedStructProxy(ByRefValue reference): base(reference) { } - /// An example of a non primitive property. - [JsiiProperty("nonPrimitive", "{\"fqn\":\"jsii-calc.DoubleTrouble\"}")] - public virtual DoubleTrouble NonPrimitive + [JsiiProperty("anotherRequired", "{\"primitive\":\"date\"}")] + public virtual DateTime AnotherRequired { - get => GetInstanceProperty(); + get => GetInstanceProperty(); set => SetInstanceProperty(value); } @@ -28,17 +27,11 @@ public virtual bool Bool set => SetInstanceProperty(value); } - [JsiiProperty("anotherRequired", "{\"primitive\":\"date\"}")] - public virtual DateTime AnotherRequired - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - - [JsiiProperty("optionalArray", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}},\"optional\":true}")] - public virtual string[] OptionalArray + /// An example of a non primitive property. + [JsiiProperty("nonPrimitive", "{\"fqn\":\"jsii-calc.DoubleTrouble\"}")] + public virtual DoubleTrouble NonPrimitive { - get => GetInstanceProperty(); + get => GetInstanceProperty(); set => SetInstanceProperty(value); } @@ -50,11 +43,10 @@ public virtual IDictionary AnotherOptional set => SetInstanceProperty(value); } - /// A string value - [JsiiProperty("astring", "{\"primitive\":\"string\"}")] - public virtual string Astring + [JsiiProperty("optionalArray", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}},\"optional\":true}")] + public virtual string[] OptionalArray { - get => GetInstanceProperty(); + get => GetInstanceProperty(); set => SetInstanceProperty(value); } @@ -66,6 +58,14 @@ public virtual double Anumber set => SetInstanceProperty(value); } + /// A string value + [JsiiProperty("astring", "{\"primitive\":\"string\"}")] + public virtual string Astring + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + [JsiiProperty("firstOptional", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}},\"optional\":true}")] public virtual string[] FirstOptional { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/DoubleTrouble.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/DoubleTrouble.cs index f8b34dc192..907eb98c56 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/DoubleTrouble.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/DoubleTrouble.cs @@ -17,18 +17,18 @@ protected DoubleTrouble(DeputyProps props): base(props) { } - /// Returns another random number. - [JsiiMethod("next", "{\"primitive\":\"number\"}", "[]")] - public virtual double Next() - { - return InvokeInstanceMethod(new object[]{}); - } - /// Say hello! [JsiiMethod("hello", "{\"primitive\":\"string\"}", "[]")] public virtual string Hello() { return InvokeInstanceMethod(new object[]{}); } + + /// Returns another random number. + [JsiiMethod("next", "{\"primitive\":\"number\"}", "[]")] + 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.Calculator/GiveMeStructs.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/GiveMeStructs.cs index 49f91417ed..95fb4ec0f6 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/GiveMeStructs.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/GiveMeStructs.cs @@ -24,11 +24,11 @@ public virtual IStructWithOnlyOptionals StructLiteral get => GetInstanceProperty(); } - /// Returns the "anumber" from a MyFirstStruct struct; - [JsiiMethod("readFirstNumber", "{\"primitive\":\"number\"}", "[{\"name\":\"first\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.MyFirstStruct\"}}]")] - public virtual double ReadFirstNumber(IMyFirstStruct first) + /// Accepts a struct of type DerivedStruct and returns a struct of type FirstStruct. + [JsiiMethod("derivedToFirst", "{\"fqn\":\"@scope/jsii-calc-lib.MyFirstStruct\"}", "[{\"name\":\"derived\",\"type\":{\"fqn\":\"jsii-calc.DerivedStruct\"}}]")] + public virtual IMyFirstStruct DerivedToFirst(IDerivedStruct derived) { - return InvokeInstanceMethod(new object[]{first}); + return InvokeInstanceMethod(new object[]{derived}); } /// Returns the boolean from a DerivedStruct struct. @@ -38,11 +38,11 @@ public virtual DoubleTrouble ReadDerivedNonPrimitive(IDerivedStruct derived) return InvokeInstanceMethod(new object[]{derived}); } - /// Accepts a struct of type DerivedStruct and returns a struct of type FirstStruct. - [JsiiMethod("derivedToFirst", "{\"fqn\":\"@scope/jsii-calc-lib.MyFirstStruct\"}", "[{\"name\":\"derived\",\"type\":{\"fqn\":\"jsii-calc.DerivedStruct\"}}]")] - public virtual IMyFirstStruct DerivedToFirst(IDerivedStruct derived) + /// Returns the "anumber" from a MyFirstStruct struct; + [JsiiMethod("readFirstNumber", "{\"primitive\":\"number\"}", "[{\"name\":\"first\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.MyFirstStruct\"}}]")] + public virtual double ReadFirstNumber(IMyFirstStruct first) { - return InvokeInstanceMethod(new object[]{derived}); + return InvokeInstanceMethod(new object[]{first}); } } } \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IDerivedStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IDerivedStruct.cs index 40d732879e..aafefb83e2 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IDerivedStruct.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IDerivedStruct.cs @@ -9,9 +9,8 @@ namespace Amazon.JSII.Tests.Calculator [JsiiInterface(typeof(IDerivedStruct), "jsii-calc.DerivedStruct")] public interface IDerivedStruct : IMyFirstStruct { - /// An example of a non primitive property. - [JsiiProperty("nonPrimitive", "{\"fqn\":\"jsii-calc.DoubleTrouble\"}")] - DoubleTrouble NonPrimitive + [JsiiProperty("anotherRequired", "{\"primitive\":\"date\"}")] + DateTime AnotherRequired { get; set; @@ -24,23 +23,24 @@ bool Bool set; } - [JsiiProperty("anotherRequired", "{\"primitive\":\"date\"}")] - DateTime AnotherRequired + /// An example of a non primitive property. + [JsiiProperty("nonPrimitive", "{\"fqn\":\"jsii-calc.DoubleTrouble\"}")] + DoubleTrouble NonPrimitive { get; set; } - [JsiiProperty("optionalArray", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}},\"optional\":true}")] - string[] OptionalArray + /// This is optional. + [JsiiProperty("anotherOptional", "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}},\"optional\":true}")] + IDictionary AnotherOptional { get; set; } - /// This is optional. - [JsiiProperty("anotherOptional", "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}},\"optional\":true}")] - IDictionary AnotherOptional + [JsiiProperty("optionalArray", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}},\"optional\":true}")] + string[] OptionalArray { get; set; diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IFriendlierProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IFriendlierProxy.cs index 47ca4b427b..f2db322fd3 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IFriendlierProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IFriendlierProxy.cs @@ -10,17 +10,17 @@ private IFriendlierProxy(ByRefValue reference): base(reference) { } - /// Say goodbye. - /// A goodbye blessing. - [JsiiMethod("goodbye", "{\"primitive\":\"string\"}", "[]")] - public virtual string Goodbye() + /// Say farewell. + [JsiiMethod("farewell", "{\"primitive\":\"string\"}", "[]")] + public virtual string Farewell() { return InvokeInstanceMethod(new object[]{}); } - /// Say farewell. - [JsiiMethod("farewell", "{\"primitive\":\"string\"}", "[]")] - public virtual string Farewell() + /// Say goodbye. + /// A goodbye blessing. + [JsiiMethod("goodbye", "{\"primitive\":\"string\"}", "[]")] + public virtual string Goodbye() { return InvokeInstanceMethod(new object[]{}); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IIFriendlier.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IIFriendlier.cs index 800314eb9d..1cc30ca176 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IIFriendlier.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IIFriendlier.cs @@ -7,12 +7,12 @@ namespace Amazon.JSII.Tests.Calculator [JsiiInterface(typeof(IIFriendlier), "jsii-calc.IFriendlier")] public interface IIFriendlier : IIFriendly { + /// Say farewell. + [JsiiMethod("farewell", "{\"primitive\":\"string\"}", "[]")] + string Farewell(); /// Say goodbye. /// A goodbye blessing. [JsiiMethod("goodbye", "{\"primitive\":\"string\"}", "[]")] string Goodbye(); - /// Say farewell. - [JsiiMethod("farewell", "{\"primitive\":\"string\"}", "[]")] - string Farewell(); } } \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IUnionProperties.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IUnionProperties.cs index 1cb5373618..2431727a42 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IUnionProperties.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/IUnionProperties.cs @@ -5,17 +5,17 @@ namespace Amazon.JSII.Tests.Calculator [JsiiInterface(typeof(IUnionProperties), "jsii-calc.UnionProperties")] public interface IUnionProperties { - [JsiiProperty("foo", "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"}]},\"optional\":true}")] - object Foo + [JsiiProperty("bar", "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.AllTypes\"}]}}")] + object Bar { get; - set; } - [JsiiProperty("bar", "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.AllTypes\"}]}}")] - object Bar + [JsiiProperty("foo", "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"}]},\"optional\":true}")] + object Foo { get; + set; } } } \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/JavaReservedWords.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/JavaReservedWords.cs index 7c7fc82cdb..f56bb61c7a 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/JavaReservedWords.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/JavaReservedWords.cs @@ -96,14 +96,14 @@ public virtual void Default() InvokeInstanceVoidMethod(new object[]{}); } - [JsiiMethod("double", null, "[]")] - public virtual void Double() + [JsiiMethod("do", null, "[]")] + public virtual void Do() { InvokeInstanceVoidMethod(new object[]{}); } - [JsiiMethod("do", null, "[]")] - public virtual void Do() + [JsiiMethod("double", null, "[]")] + public virtual void Double() { InvokeInstanceVoidMethod(new object[]{}); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Multiply.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Multiply.cs index ece67dbacb..d41e361e3c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Multiply.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Multiply.cs @@ -26,9 +26,9 @@ public override double Value get => GetInstanceProperty(); } - /// String representation of the value. - [JsiiMethod("toString", "{\"primitive\":\"string\"}", "[]")] - public override string ToString() + /// Say farewell. + [JsiiMethod("farewell", "{\"primitive\":\"string\"}", "[]")] + public virtual string Farewell() { return InvokeInstanceMethod(new object[]{}); } @@ -40,18 +40,18 @@ public virtual string Goodbye() return InvokeInstanceMethod(new object[]{}); } - /// Say farewell. - [JsiiMethod("farewell", "{\"primitive\":\"string\"}", "[]")] - public virtual string Farewell() - { - return InvokeInstanceMethod(new object[]{}); - } - /// Returns another random number. [JsiiMethod("next", "{\"primitive\":\"number\"}", "[]")] public virtual double Next() { return InvokeInstanceMethod(new object[]{}); } + + /// String representation of the value. + [JsiiMethod("toString", "{\"primitive\":\"string\"}", "[]")] + 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.Calculator/Negate.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Negate.cs index 144d71e255..5faae88ec8 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Negate.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Negate.cs @@ -26,30 +26,30 @@ public override double Value get => GetInstanceProperty(); } - /// String representation of the value. - [JsiiMethod("toString", "{\"primitive\":\"string\"}", "[]")] - public override string ToString() + /// Say farewell. + [JsiiMethod("farewell", "{\"primitive\":\"string\"}", "[]")] + public virtual string Farewell() { return InvokeInstanceMethod(new object[]{}); } - /// Say hello! - [JsiiMethod("hello", "{\"primitive\":\"string\"}", "[]")] - public virtual string Hello() + /// Say goodbye. + [JsiiMethod("goodbye", "{\"primitive\":\"string\"}", "[]")] + public virtual string Goodbye() { return InvokeInstanceMethod(new object[]{}); } - /// Say goodbye. - [JsiiMethod("goodbye", "{\"primitive\":\"string\"}", "[]")] - public virtual string Goodbye() + /// Say hello! + [JsiiMethod("hello", "{\"primitive\":\"string\"}", "[]")] + public virtual string Hello() { return InvokeInstanceMethod(new object[]{}); } - /// Say farewell. - [JsiiMethod("farewell", "{\"primitive\":\"string\"}", "[]")] - public virtual string Farewell() + /// String representation of the value. + [JsiiMethod("toString", "{\"primitive\":\"string\"}", "[]")] + public override string ToString() { return InvokeInstanceMethod(new object[]{}); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/NodeStandardLibrary.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/NodeStandardLibrary.cs index af1c39e5f7..496c572bf2 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/NodeStandardLibrary.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/NodeStandardLibrary.cs @@ -25,6 +25,14 @@ public virtual string OsPlatform get => GetInstanceProperty(); } + /// Uses node.js "crypto" module to calculate sha256 of a string. + /// "6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50" + [JsiiMethod("cryptoSha256", "{\"primitive\":\"string\"}", "[]")] + public virtual string CryptoSha256() + { + return InvokeInstanceMethod(new object[]{}); + } + /// Reads a local resource file (resource.txt) asynchronously. /// "Hello, resource!" [JsiiMethod("fsReadFile", "{\"primitive\":\"string\",\"promise\":true}", "[]")] @@ -40,13 +48,5 @@ public virtual string FsReadFileSync() { return InvokeInstanceMethod(new object[]{}); } - - /// Uses node.js "crypto" module to calculate sha256 of a string. - /// "6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50" - [JsiiMethod("cryptoSha256", "{\"primitive\":\"string\"}", "[]")] - public virtual string CryptoSha256() - { - return InvokeInstanceMethod(new object[]{}); - } } } \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/NumberGenerator.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/NumberGenerator.cs index 3d8f96c25d..f470a7c714 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/NumberGenerator.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/NumberGenerator.cs @@ -28,16 +28,16 @@ public virtual IIRandomNumberGenerator Generator set => SetInstanceProperty(value); } - [JsiiMethod("nextTimes100", "{\"primitive\":\"number\"}", "[]")] - public virtual double NextTimes100() - { - return InvokeInstanceMethod(new object[]{}); - } - [JsiiMethod("isSameGenerator", "{\"primitive\":\"boolean\"}", "[{\"name\":\"gen\",\"type\":{\"fqn\":\"jsii-calc.IRandomNumberGenerator\"}}]")] public virtual bool IsSameGenerator(IIRandomNumberGenerator gen) { return InvokeInstanceMethod(new object[]{gen}); } + + [JsiiMethod("nextTimes100", "{\"primitive\":\"number\"}", "[]")] + public virtual double NextTimes100() + { + return InvokeInstanceMethod(new object[]{}); + } } } \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Power.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Power.cs index 394f909b10..cef90a215b 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Power.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Power.cs @@ -27,13 +27,6 @@ public virtual Value_ Base get => GetInstanceProperty(); } - /// The number of times to multiply - [JsiiProperty("pow", "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] - public virtual Value_ Pow - { - get => GetInstanceProperty(); - } - /// /// The expression that this operation consists of. /// Must be implemented by derived classes. @@ -43,5 +36,12 @@ public override Value_ Expression { get => GetInstanceProperty(); } + + /// The number of times to multiply + [JsiiProperty("pow", "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] + public virtual Value_ Pow + { + get => GetInstanceProperty(); + } } } \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Statics.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Statics.cs index 1ba665fd35..27fd24e90d 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Statics.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Statics.cs @@ -18,28 +18,29 @@ protected Statics(DeputyProps props): base(props) { } - [JsiiProperty("value", "{\"primitive\":\"string\"}")] - public virtual string Value + /// Constants may also use all-caps. + [JsiiProperty("BAR", "{\"primitive\":\"number\"}")] + public static double BAR { - get => GetInstanceProperty(); + get; } - /// Jsdocs for static property. - [JsiiProperty("Foo", "{\"primitive\":\"string\"}")] - public static string Foo + = GetStaticProperty(typeof(Statics)); + [JsiiProperty("ConstObj", "{\"fqn\":\"jsii-calc.DoubleTrouble\"}")] + public static DoubleTrouble ConstObj { get; } - = GetStaticProperty(typeof(Statics)); - /// Constants may also use all-caps. - [JsiiProperty("BAR", "{\"primitive\":\"number\"}")] - public static double BAR + = GetStaticProperty(typeof(Statics)); + /// Jsdocs for static property. + [JsiiProperty("Foo", "{\"primitive\":\"string\"}")] + public static string Foo { get; } - = GetStaticProperty(typeof(Statics)); + = GetStaticProperty(typeof(Statics)); /// Constants can also use camelCase. [JsiiProperty("zooBar", "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"primitive\":\"string\"}}}")] public static IDictionary ZooBar @@ -66,13 +67,12 @@ public static double NonConstStatic set => SetStaticProperty(typeof(Statics), value); } - [JsiiProperty("ConstObj", "{\"fqn\":\"jsii-calc.DoubleTrouble\"}")] - public static DoubleTrouble ConstObj + [JsiiProperty("value", "{\"primitive\":\"string\"}")] + public virtual string Value { - get; + get => GetInstanceProperty(); } - = GetStaticProperty(typeof(Statics)); /// Jsdocs for static method /// The name of the person to say hello to [JsiiMethod("staticMethod", "{\"primitive\":\"string\"}", "[{\"name\":\"name\",\"type\":{\"primitive\":\"string\"}}]")] diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Sum.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Sum.cs index 4fd9da8f99..499b21df85 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Sum.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/Sum.cs @@ -20,14 +20,6 @@ protected Sum(DeputyProps props): base(props) { } - /// The parts to sum. - [JsiiProperty("parts", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}}")] - public virtual Value_[] Parts - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - /// /// The expression that this operation consists of. /// Must be implemented by derived classes. @@ -37,5 +29,13 @@ public override Value_ Expression { get => GetInstanceProperty(); } + + /// The parts to sum. + [JsiiProperty("parts", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.Value\"}}}")] + public virtual 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.Calculator/SyncVirtualMethods.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/SyncVirtualMethods.cs index f20bee8430..111aa5c491 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/SyncVirtualMethods.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/SyncVirtualMethods.cs @@ -17,24 +17,24 @@ protected SyncVirtualMethods(DeputyProps props): base(props) { } - [JsiiProperty("callerIsProperty", "{\"primitive\":\"number\"}")] - public virtual double CallerIsProperty + [JsiiProperty("readonlyProperty", "{\"primitive\":\"string\"}")] + public virtual string ReadonlyProperty { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); + get => GetInstanceProperty(); } - [JsiiProperty("theProperty", "{\"primitive\":\"string\"}")] - public virtual string TheProperty + [JsiiProperty("a", "{\"primitive\":\"number\"}")] + public virtual double A { - get => GetInstanceProperty(); + get => GetInstanceProperty(); set => SetInstanceProperty(value); } - [JsiiProperty("readonlyProperty", "{\"primitive\":\"string\"}")] - public virtual string ReadonlyProperty + [JsiiProperty("callerIsProperty", "{\"primitive\":\"number\"}")] + public virtual double CallerIsProperty { - get => GetInstanceProperty(); + get => GetInstanceProperty(); + set => SetInstanceProperty(value); } [JsiiProperty("otherProperty", "{\"primitive\":\"string\"}")] @@ -44,36 +44,36 @@ public virtual string OtherProperty set => SetInstanceProperty(value); } - [JsiiProperty("valueOfOtherProperty", "{\"primitive\":\"string\"}")] - public virtual string ValueOfOtherProperty + [JsiiProperty("theProperty", "{\"primitive\":\"string\"}")] + public virtual string TheProperty { get => GetInstanceProperty(); set => SetInstanceProperty(value); } - [JsiiProperty("a", "{\"primitive\":\"number\"}")] - public virtual double A + [JsiiProperty("valueOfOtherProperty", "{\"primitive\":\"string\"}")] + public virtual string ValueOfOtherProperty { - get => GetInstanceProperty(); + get => GetInstanceProperty(); set => SetInstanceProperty(value); } - [JsiiMethod("callerIsMethod", "{\"primitive\":\"number\"}", "[]")] - public virtual double CallerIsMethod() + [JsiiMethod("callerIsAsync", "{\"primitive\":\"number\",\"promise\":true}", "[]")] + public virtual double CallerIsAsync() { return InvokeInstanceMethod(new object[]{}); } - [JsiiMethod("callerIsAsync", "{\"primitive\":\"number\",\"promise\":true}", "[]")] - public virtual double CallerIsAsync() + [JsiiMethod("callerIsMethod", "{\"primitive\":\"number\"}", "[]")] + public virtual double CallerIsMethod() { return InvokeInstanceMethod(new object[]{}); } - [JsiiMethod("virtualMethod", "{\"primitive\":\"number\"}", "[{\"name\":\"n\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual double VirtualMethod(double n) + [JsiiMethod("modifyOtherProperty", null, "[{\"name\":\"value\",\"type\":{\"primitive\":\"string\"}}]")] + public virtual void ModifyOtherProperty(string value) { - return InvokeInstanceMethod(new object[]{n}); + InvokeInstanceVoidMethod(new object[]{value}); } [JsiiMethod("modifyValueOfTheProperty", null, "[{\"name\":\"value\",\"type\":{\"primitive\":\"string\"}}]")] @@ -82,34 +82,34 @@ public virtual void ModifyValueOfTheProperty(string value) InvokeInstanceVoidMethod(new object[]{value}); } - [JsiiMethod("retrieveValueOfTheProperty", "{\"primitive\":\"string\"}", "[]")] - public virtual string RetrieveValueOfTheProperty() + [JsiiMethod("readA", "{\"primitive\":\"number\"}", "[]")] + public virtual double ReadA() { - return InvokeInstanceMethod(new object[]{}); + return InvokeInstanceMethod(new object[]{}); } - [JsiiMethod("retrieveReadOnlyProperty", "{\"primitive\":\"string\"}", "[]")] - public virtual string RetrieveReadOnlyProperty() + [JsiiMethod("retrieveOtherProperty", "{\"primitive\":\"string\"}", "[]")] + public virtual string RetrieveOtherProperty() { return InvokeInstanceMethod(new object[]{}); } - [JsiiMethod("modifyOtherProperty", null, "[{\"name\":\"value\",\"type\":{\"primitive\":\"string\"}}]")] - public virtual void ModifyOtherProperty(string value) + [JsiiMethod("retrieveReadOnlyProperty", "{\"primitive\":\"string\"}", "[]")] + public virtual string RetrieveReadOnlyProperty() { - InvokeInstanceVoidMethod(new object[]{value}); + return InvokeInstanceMethod(new object[]{}); } - [JsiiMethod("retrieveOtherProperty", "{\"primitive\":\"string\"}", "[]")] - public virtual string RetrieveOtherProperty() + [JsiiMethod("retrieveValueOfTheProperty", "{\"primitive\":\"string\"}", "[]")] + public virtual string RetrieveValueOfTheProperty() { return InvokeInstanceMethod(new object[]{}); } - [JsiiMethod("readA", "{\"primitive\":\"number\"}", "[]")] - public virtual double ReadA() + [JsiiMethod("virtualMethod", "{\"primitive\":\"number\"}", "[{\"name\":\"n\",\"type\":{\"primitive\":\"number\"}}]")] + public virtual double VirtualMethod(double n) { - return InvokeInstanceMethod(new object[]{}); + return InvokeInstanceMethod(new object[]{n}); } [JsiiMethod("writeA", null, "[{\"name\":\"value\",\"type\":{\"primitive\":\"number\"}}]")] diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/UnionProperties.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/UnionProperties.cs index b94576af4b..8c7edb5fe2 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/UnionProperties.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/UnionProperties.cs @@ -4,17 +4,17 @@ namespace Amazon.JSII.Tests.Calculator { public class UnionProperties : DeputyBase, IUnionProperties { - [JsiiProperty("foo", "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"}]},\"optional\":true}", true)] - public object Foo + [JsiiProperty("bar", "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.AllTypes\"}]}}", true)] + public object Bar { get; - set; } - [JsiiProperty("bar", "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.AllTypes\"}]}}", true)] - public object Bar + [JsiiProperty("foo", "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"}]},\"optional\":true}", true)] + public object Foo { get; + set; } } } \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/UnionPropertiesProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/UnionPropertiesProxy.cs index 6aecc5d06b..de1f593533 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/UnionPropertiesProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/UnionPropertiesProxy.cs @@ -9,17 +9,17 @@ private UnionPropertiesProxy(ByRefValue reference): base(reference) { } - [JsiiProperty("foo", "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"}]},\"optional\":true}")] - public virtual object Foo + [JsiiProperty("bar", "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.AllTypes\"}]}}")] + public virtual object Bar { get => GetInstanceProperty(); - set => SetInstanceProperty(value); } - [JsiiProperty("bar", "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"},{\"fqn\":\"jsii-calc.AllTypes\"}]}}")] - public virtual object Bar + [JsiiProperty("foo", "{\"union\":{\"types\":[{\"primitive\":\"string\"},{\"primitive\":\"number\"}]},\"optional\":true}")] + public virtual object Foo { 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.Calculator/UsesInterfaceWithProperties.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/UsesInterfaceWithProperties.cs index 32ed9916e0..6da3cb2dc7 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/UsesInterfaceWithProperties.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/UsesInterfaceWithProperties.cs @@ -29,16 +29,16 @@ public virtual string JustRead() return InvokeInstanceMethod(new object[]{}); } - [JsiiMethod("writeAndRead", "{\"primitive\":\"string\"}", "[{\"name\":\"value\",\"type\":{\"primitive\":\"string\"}}]")] - public virtual string WriteAndRead(string value) - { - return InvokeInstanceMethod(new object[]{value}); - } - [JsiiMethod("readStringAndNumber", "{\"primitive\":\"string\"}", "[{\"name\":\"ext\",\"type\":{\"fqn\":\"jsii-calc.IInterfaceWithPropertiesExtension\"}}]")] public virtual string ReadStringAndNumber(IIInterfaceWithPropertiesExtension ext) { return InvokeInstanceMethod(new object[]{ext}); } + + [JsiiMethod("writeAndRead", "{\"primitive\":\"string\"}", "[{\"name\":\"value\",\"type\":{\"primitive\":\"string\"}}]")] + public virtual string WriteAndRead(string 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.Calculator/VirtualMethodPlayground.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/VirtualMethodPlayground.cs index 10b32f5296..1c5d62f404 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/VirtualMethodPlayground.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/VirtualMethodPlayground.cs @@ -17,34 +17,34 @@ protected VirtualMethodPlayground(DeputyProps props): base(props) { } - [JsiiMethod("serialSumAsync", "{\"primitive\":\"number\",\"promise\":true}", "[{\"name\":\"count\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual double SerialSumAsync(double count) + [JsiiMethod("overrideMeAsync", "{\"primitive\":\"number\",\"promise\":true}", "[{\"name\":\"index\",\"type\":{\"primitive\":\"number\"}}]")] + public virtual double OverrideMeAsync(double index) { - return InvokeInstanceMethod(new object[]{count}); + return InvokeInstanceMethod(new object[]{index}); } - [JsiiMethod("parallelSumAsync", "{\"primitive\":\"number\",\"promise\":true}", "[{\"name\":\"count\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual double ParallelSumAsync(double count) + [JsiiMethod("overrideMeSync", "{\"primitive\":\"number\"}", "[{\"name\":\"index\",\"type\":{\"primitive\":\"number\"}}]")] + public virtual double OverrideMeSync(double index) { - return InvokeInstanceMethod(new object[]{count}); + return InvokeInstanceMethod(new object[]{index}); } - [JsiiMethod("sumSync", "{\"primitive\":\"number\"}", "[{\"name\":\"count\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual double SumSync(double count) + [JsiiMethod("parallelSumAsync", "{\"primitive\":\"number\",\"promise\":true}", "[{\"name\":\"count\",\"type\":{\"primitive\":\"number\"}}]")] + public virtual double ParallelSumAsync(double count) { return InvokeInstanceMethod(new object[]{count}); } - [JsiiMethod("overrideMeAsync", "{\"primitive\":\"number\",\"promise\":true}", "[{\"name\":\"index\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual double OverrideMeAsync(double index) + [JsiiMethod("serialSumAsync", "{\"primitive\":\"number\",\"promise\":true}", "[{\"name\":\"count\",\"type\":{\"primitive\":\"number\"}}]")] + public virtual double SerialSumAsync(double count) { - return InvokeInstanceMethod(new object[]{index}); + return InvokeInstanceMethod(new object[]{count}); } - [JsiiMethod("overrideMeSync", "{\"primitive\":\"number\"}", "[{\"name\":\"index\",\"type\":{\"primitive\":\"number\"}}]")] - public virtual double OverrideMeSync(double index) + [JsiiMethod("sumSync", "{\"primitive\":\"number\"}", "[{\"name\":\"count\",\"type\":{\"primitive\":\"number\"}}]")] + public virtual double SumSync(double count) { - return InvokeInstanceMethod(new object[]{index}); + 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.Calculator/composition/CompositeOperation.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/composition/CompositeOperation.cs index 07b3070acd..cb2547b1ce 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/composition/CompositeOperation.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.Calculator/composition/CompositeOperation.cs @@ -19,20 +19,21 @@ protected CompositeOperation(DeputyProps props): base(props) { } - /// The .toString() style. - [JsiiProperty("stringStyle", "{\"fqn\":\"jsii-calc.composition.CompositionStringStyle\"}")] - public virtual CompositionStringStyle StringStyle + /// + /// The expression that this operation consists of. + /// Must be implemented by derived classes. + /// + [JsiiProperty("expression", "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] + public virtual Value_ Expression { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); + get => GetInstanceProperty(); } - /// A set of prefixes to include in a decorated .toString(). - [JsiiProperty("decorationPrefixes", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}")] - public virtual string[] DecorationPrefixes + /// The value. + [JsiiProperty("value", "{\"primitive\":\"number\"}")] + public override double Value { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); + get => GetInstanceProperty(); } /// A set of postfixes to include in a decorated .toString(). @@ -43,21 +44,20 @@ public virtual string[] DecorationPostfixes set => SetInstanceProperty(value); } - /// The value. - [JsiiProperty("value", "{\"primitive\":\"number\"}")] - public override double Value + /// A set of prefixes to include in a decorated .toString(). + [JsiiProperty("decorationPrefixes", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}")] + public virtual string[] DecorationPrefixes { - get => GetInstanceProperty(); + get => GetInstanceProperty(); + set => SetInstanceProperty(value); } - /// - /// The expression that this operation consists of. - /// Must be implemented by derived classes. - /// - [JsiiProperty("expression", "{\"fqn\":\"@scope/jsii-calc-lib.Value\"}")] - public virtual Value_ Expression + /// The .toString() style. + [JsiiProperty("stringStyle", "{\"fqn\":\"jsii-calc.composition.CompositionStringStyle\"}")] + public virtual CompositionStringStyle StringStyle { - get => GetInstanceProperty(); + get => GetInstanceProperty(); + set => SetInstanceProperty(value); } /// String representation of the value. diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/pom.xml b/packages/jsii-pacmak/test/expected.jsii-calc/java/pom.xml index 9cc6ac1db8..063180f484 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/pom.xml +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/pom.xml @@ -75,10 +75,10 @@ 0.6.4 - com.google.code.findbugs - jsr305 - [3.0.2,) - compile + javax.annotation + javax.annotation-api + [1.3.2,) + provided diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Add.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Add.java index e294f5592b..22a9021338 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Add.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Add.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator; + /** * The "+" binary operation. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.Add") public class Add extends software.amazon.jsii.tests.calculator.BinaryOperation { protected Add(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AllTypes.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AllTypes.java index 3fde3513a8..f525b37a8b 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AllTypes.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AllTypes.java @@ -1,8 +1,10 @@ package software.amazon.jsii.tests.calculator; + /** * This class includes property for all types supported by jsii. The setters will validate * that the value set is of the expected type and throw otherwise. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.AllTypes") public class AllTypes extends software.amazon.jsii.JsiiObject { protected AllTypes(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -15,23 +17,38 @@ public AllTypes() { public software.amazon.jsii.tests.calculator.StringEnum enumMethod(final software.amazon.jsii.tests.calculator.StringEnum value) { return this.jsiiCall("enumMethod", software.amazon.jsii.tests.calculator.StringEnum.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(value, "value is required")).toArray()); } - public java.lang.Boolean getBooleanProperty() { - return this.jsiiGet("booleanProperty", java.lang.Boolean.class); + public java.lang.Number getEnumPropertyValue() { + return this.jsiiGet("enumPropertyValue", java.lang.Number.class); } - public void setBooleanProperty(final java.lang.Boolean value) { - this.jsiiSet("booleanProperty", java.util.Objects.requireNonNull(value, "booleanProperty is required")); + public java.util.List getAnyArrayProperty() { + return this.jsiiGet("anyArrayProperty", java.util.List.class); } - public java.lang.String getStringProperty() { - return this.jsiiGet("stringProperty", java.lang.String.class); + public void setAnyArrayProperty(final java.util.List value) { + this.jsiiSet("anyArrayProperty", java.util.Objects.requireNonNull(value, "anyArrayProperty is required")); } - public void setStringProperty(final java.lang.String value) { - this.jsiiSet("stringProperty", java.util.Objects.requireNonNull(value, "stringProperty is required")); + public java.util.Map getAnyMapProperty() { + return this.jsiiGet("anyMapProperty", java.util.Map.class); } - public java.lang.Number getNumberProperty() { - return this.jsiiGet("numberProperty", java.lang.Number.class); + public void setAnyMapProperty(final java.util.Map value) { + this.jsiiSet("anyMapProperty", java.util.Objects.requireNonNull(value, "anyMapProperty is required")); } - public void setNumberProperty(final java.lang.Number value) { - this.jsiiSet("numberProperty", java.util.Objects.requireNonNull(value, "numberProperty is required")); + public java.lang.Object getAnyProperty() { + return this.jsiiGet("anyProperty", java.lang.Object.class); + } + public void setAnyProperty(final java.lang.Object value) { + this.jsiiSet("anyProperty", java.util.Objects.requireNonNull(value, "anyProperty is required")); + } + public java.util.List getArrayProperty() { + return this.jsiiGet("arrayProperty", java.util.List.class); + } + public void setArrayProperty(final java.util.List value) { + this.jsiiSet("arrayProperty", java.util.Objects.requireNonNull(value, "arrayProperty is required")); + } + public java.lang.Boolean getBooleanProperty() { + return this.jsiiGet("booleanProperty", java.lang.Boolean.class); + } + public void setBooleanProperty(final java.lang.Boolean value) { + this.jsiiSet("booleanProperty", java.util.Objects.requireNonNull(value, "booleanProperty is required")); } public java.time.Instant getDateProperty() { return this.jsiiGet("dateProperty", java.time.Instant.class); @@ -39,6 +56,12 @@ public java.time.Instant getDateProperty() { public void setDateProperty(final java.time.Instant value) { this.jsiiSet("dateProperty", java.util.Objects.requireNonNull(value, "dateProperty is required")); } + public software.amazon.jsii.tests.calculator.AllTypesEnum getEnumProperty() { + return this.jsiiGet("enumProperty", software.amazon.jsii.tests.calculator.AllTypesEnum.class); + } + public void setEnumProperty(final software.amazon.jsii.tests.calculator.AllTypesEnum value) { + this.jsiiSet("enumProperty", java.util.Objects.requireNonNull(value, "enumProperty is required")); + } public com.fasterxml.jackson.databind.node.ObjectNode getJsonProperty() { return this.jsiiGet("jsonProperty", com.fasterxml.jackson.databind.node.ObjectNode.class); } @@ -51,47 +74,29 @@ public java.util.Map getMapProperty() { public void setMapProperty(final java.util.Map value) { this.jsiiSet("mapProperty", java.util.Objects.requireNonNull(value, "mapProperty is required")); } - public java.util.List getArrayProperty() { - return this.jsiiGet("arrayProperty", java.util.List.class); - } - public void setArrayProperty(final java.util.List value) { - this.jsiiSet("arrayProperty", java.util.Objects.requireNonNull(value, "arrayProperty is required")); - } - public java.lang.Object getAnyProperty() { - return this.jsiiGet("anyProperty", java.lang.Object.class); - } - public void setAnyProperty(final java.lang.Object value) { - this.jsiiSet("anyProperty", java.util.Objects.requireNonNull(value, "anyProperty is required")); - } - public java.util.List getAnyArrayProperty() { - return this.jsiiGet("anyArrayProperty", java.util.List.class); - } - public void setAnyArrayProperty(final java.util.List value) { - this.jsiiSet("anyArrayProperty", java.util.Objects.requireNonNull(value, "anyArrayProperty is required")); - } - public java.util.Map getAnyMapProperty() { - return this.jsiiGet("anyMapProperty", java.util.Map.class); + public java.lang.Number getNumberProperty() { + return this.jsiiGet("numberProperty", java.lang.Number.class); } - public void setAnyMapProperty(final java.util.Map value) { - this.jsiiSet("anyMapProperty", java.util.Objects.requireNonNull(value, "anyMapProperty is required")); + public void setNumberProperty(final java.lang.Number value) { + this.jsiiSet("numberProperty", java.util.Objects.requireNonNull(value, "numberProperty is required")); } - public java.lang.Object getUnknownProperty() { - return this.jsiiGet("unknownProperty", java.lang.Object.class); + public java.lang.String getStringProperty() { + return this.jsiiGet("stringProperty", java.lang.String.class); } - public void setUnknownProperty(final java.lang.Object value) { - this.jsiiSet("unknownProperty", java.util.Objects.requireNonNull(value, "unknownProperty is required")); + public void setStringProperty(final java.lang.String value) { + this.jsiiSet("stringProperty", java.util.Objects.requireNonNull(value, "stringProperty is required")); } - public java.util.List getUnknownArrayProperty() { - return this.jsiiGet("unknownArrayProperty", java.util.List.class); + public java.util.List getUnionArrayProperty() { + return this.jsiiGet("unionArrayProperty", java.util.List.class); } - public void setUnknownArrayProperty(final java.util.List value) { - this.jsiiSet("unknownArrayProperty", java.util.Objects.requireNonNull(value, "unknownArrayProperty is required")); + public void setUnionArrayProperty(final java.util.List value) { + this.jsiiSet("unionArrayProperty", java.util.Objects.requireNonNull(value, "unionArrayProperty is required")); } - public java.util.Map getUnknownMapProperty() { - return this.jsiiGet("unknownMapProperty", java.util.Map.class); + public java.util.Map getUnionMapProperty() { + return this.jsiiGet("unionMapProperty", java.util.Map.class); } - public void setUnknownMapProperty(final java.util.Map value) { - this.jsiiSet("unknownMapProperty", java.util.Objects.requireNonNull(value, "unknownMapProperty is required")); + public void setUnionMapProperty(final java.util.Map value) { + this.jsiiSet("unionMapProperty", java.util.Objects.requireNonNull(value, "unionMapProperty is required")); } public java.lang.Object getUnionProperty() { return this.jsiiGet("unionProperty", java.lang.Object.class); @@ -105,17 +110,23 @@ public void setUnionProperty(final java.lang.Number value) { public void setUnionProperty(final software.amazon.jsii.tests.calculator.Multiply value) { this.jsiiSet("unionProperty", java.util.Objects.requireNonNull(value, "unionProperty is required")); } - public java.util.List getUnionArrayProperty() { - return this.jsiiGet("unionArrayProperty", java.util.List.class); + public java.util.List getUnknownArrayProperty() { + return this.jsiiGet("unknownArrayProperty", java.util.List.class); } - public void setUnionArrayProperty(final java.util.List value) { - this.jsiiSet("unionArrayProperty", java.util.Objects.requireNonNull(value, "unionArrayProperty is required")); + public void setUnknownArrayProperty(final java.util.List value) { + this.jsiiSet("unknownArrayProperty", java.util.Objects.requireNonNull(value, "unknownArrayProperty is required")); } - public java.util.Map getUnionMapProperty() { - return this.jsiiGet("unionMapProperty", java.util.Map.class); + public java.util.Map getUnknownMapProperty() { + return this.jsiiGet("unknownMapProperty", java.util.Map.class); } - public void setUnionMapProperty(final java.util.Map value) { - this.jsiiSet("unionMapProperty", java.util.Objects.requireNonNull(value, "unionMapProperty is required")); + public void setUnknownMapProperty(final java.util.Map value) { + this.jsiiSet("unknownMapProperty", java.util.Objects.requireNonNull(value, "unknownMapProperty is required")); + } + public java.lang.Object getUnknownProperty() { + return this.jsiiGet("unknownProperty", java.lang.Object.class); + } + public void setUnknownProperty(final java.lang.Object value) { + this.jsiiSet("unknownProperty", java.util.Objects.requireNonNull(value, "unknownProperty is required")); } @javax.annotation.Nullable public software.amazon.jsii.tests.calculator.StringEnum getOptionalEnumValue() { @@ -124,13 +135,4 @@ public software.amazon.jsii.tests.calculator.StringEnum getOptionalEnumValue() { public void setOptionalEnumValue(@javax.annotation.Nullable final software.amazon.jsii.tests.calculator.StringEnum value) { this.jsiiSet("optionalEnumValue", value); } - public software.amazon.jsii.tests.calculator.AllTypesEnum getEnumProperty() { - return this.jsiiGet("enumProperty", software.amazon.jsii.tests.calculator.AllTypesEnum.class); - } - public void setEnumProperty(final software.amazon.jsii.tests.calculator.AllTypesEnum value) { - this.jsiiSet("enumProperty", java.util.Objects.requireNonNull(value, "enumProperty is required")); - } - public java.lang.Number getEnumPropertyValue() { - return this.jsiiGet("enumPropertyValue", java.lang.Number.class); - } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AllTypesEnum.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AllTypesEnum.java index 86c4b93c2c..1cf04837f6 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AllTypesEnum.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AllTypesEnum.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.AllTypesEnum") public enum AllTypesEnum { MyEnumValue, diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AllowedMethodNames.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AllowedMethodNames.java index de3592b86b..4d5b4dff9d 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AllowedMethodNames.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AllowedMethodNames.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.AllowedMethodNames") public class AllowedMethodNames extends software.amazon.jsii.JsiiObject { protected AllowedMethodNames(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -8,14 +10,17 @@ public AllowedMethodNames() { super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); } + public void getBar(final java.lang.String _p1, final java.lang.Number _p2) { + this.jsiiCall("getBar", Void.class, java.util.stream.Stream.concat(java.util.stream.Stream.of(java.util.Objects.requireNonNull(_p1, "_p1 is required")), java.util.stream.Stream.of(java.util.Objects.requireNonNull(_p2, "_p2 is required"))).toArray()); + } /** * getXxx() is not allowed (see negatives), but getXxx(a, ...) is okay. */ public java.lang.String getFoo(final java.lang.String withParam) { return this.jsiiCall("getFoo", java.lang.String.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(withParam, "withParam is required")).toArray()); } - public void getBar(final java.lang.String _p1, final java.lang.Number _p2) { - this.jsiiCall("getBar", Void.class, java.util.stream.Stream.concat(java.util.stream.Stream.of(java.util.Objects.requireNonNull(_p1, "_p1 is required")), java.util.stream.Stream.of(java.util.Objects.requireNonNull(_p2, "_p2 is required"))).toArray()); + public void setBar(final java.lang.String _x, final java.lang.Number _y, final java.lang.Boolean _z) { + this.jsiiCall("setBar", Void.class, java.util.stream.Stream.concat(java.util.stream.Stream.concat(java.util.stream.Stream.of(java.util.Objects.requireNonNull(_x, "_x is required")), java.util.stream.Stream.of(java.util.Objects.requireNonNull(_y, "_y is required"))), java.util.stream.Stream.of(java.util.Objects.requireNonNull(_z, "_z is required"))).toArray()); } /** * setFoo(x) is not allowed (see negatives), but setXxx(a, b, ...) is okay. @@ -23,7 +28,4 @@ public void getBar(final java.lang.String _p1, final java.lang.Number _p2) { public void setFoo(final java.lang.String _x, final java.lang.Number _y) { this.jsiiCall("setFoo", Void.class, java.util.stream.Stream.concat(java.util.stream.Stream.of(java.util.Objects.requireNonNull(_x, "_x is required")), java.util.stream.Stream.of(java.util.Objects.requireNonNull(_y, "_y is required"))).toArray()); } - public void setBar(final java.lang.String _x, final java.lang.Number _y, final java.lang.Boolean _z) { - this.jsiiCall("setBar", Void.class, java.util.stream.Stream.concat(java.util.stream.Stream.concat(java.util.stream.Stream.of(java.util.Objects.requireNonNull(_x, "_x is required")), java.util.stream.Stream.of(java.util.Objects.requireNonNull(_y, "_y is required"))), java.util.stream.Stream.of(java.util.Objects.requireNonNull(_z, "_z is required"))).toArray()); - } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AsyncVirtualMethods.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AsyncVirtualMethods.java index 6143eaae3a..51a3a4f87b 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AsyncVirtualMethods.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/AsyncVirtualMethods.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.AsyncVirtualMethods") public class AsyncVirtualMethods extends software.amazon.jsii.JsiiObject { protected AsyncVirtualMethods(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -11,12 +13,6 @@ public AsyncVirtualMethods() { public java.lang.Number callMe() { return this.jsiiAsyncCall("callMe", java.lang.Number.class); } - public java.lang.Number overrideMe(final java.lang.Number mult) { - return this.jsiiAsyncCall("overrideMe", java.lang.Number.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(mult, "mult is required")).toArray()); - } - public java.lang.Number overrideMeToo() { - return this.jsiiAsyncCall("overrideMeToo", java.lang.Number.class); - } /** * Just calls "overrideMeToo" */ @@ -35,4 +31,10 @@ public java.lang.Number callMeDoublePromise() { public java.lang.Number dontOverrideMe() { return this.jsiiCall("dontOverrideMe", java.lang.Number.class); } + public java.lang.Number overrideMe(final java.lang.Number mult) { + return this.jsiiAsyncCall("overrideMe", java.lang.Number.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(mult, "mult is required")).toArray()); + } + public java.lang.Number overrideMeToo() { + return this.jsiiAsyncCall("overrideMeToo", java.lang.Number.class); + } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/BinaryOperation.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/BinaryOperation.java index 9c1c528cc1..5626f2bf3c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/BinaryOperation.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/BinaryOperation.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator; + /** * Represents an operation with two operands. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.BinaryOperation") public abstract class BinaryOperation extends software.amazon.jsii.tests.calculator.lib.Operation implements software.amazon.jsii.tests.calculator.lib.IFriendly { protected BinaryOperation(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Calculator.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Calculator.java index a3f455056b..b9050bee6e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Calculator.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Calculator.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator; + /** * A calculator which maintains a current value and allows adding operations. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.Calculator") public class Calculator extends software.amazon.jsii.tests.calculator.composition.CompositeOperation { protected Calculator(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -34,18 +36,18 @@ public void add(final java.lang.Number value) { public void mul(final java.lang.Number value) { this.jsiiCall("mul", Void.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(value, "value is required")).toArray()); } - /** - * Raises the current value by a power. - */ - public void pow(final java.lang.Number value) { - this.jsiiCall("pow", Void.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(value, "value is required")).toArray()); - } /** * Negates the current value. */ public void neg() { this.jsiiCall("neg", Void.class); } + /** + * Raises the current value by a power. + */ + public void pow(final java.lang.Number value) { + this.jsiiCall("pow", Void.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(value, "value is required")).toArray()); + } /** * Returns teh value of the union property (if defined). */ @@ -53,16 +55,16 @@ public java.lang.Number readUnionValue() { return this.jsiiCall("readUnionValue", java.lang.Number.class); } /** - * The current value. + * Returns the expression. */ - public software.amazon.jsii.tests.calculator.lib.Value getCurr() { - return this.jsiiGet("curr", software.amazon.jsii.tests.calculator.lib.Value.class); + public software.amazon.jsii.tests.calculator.lib.Value getExpression() { + return this.jsiiGet("expression", software.amazon.jsii.tests.calculator.lib.Value.class); } /** - * The current value. + * A log of all operations. */ - public void setCurr(final software.amazon.jsii.tests.calculator.lib.Value value) { - this.jsiiSet("curr", java.util.Objects.requireNonNull(value, "curr is required")); + public java.util.List getOperationsLog() { + return this.jsiiGet("operationsLog", java.util.List.class); } /** * A map of per operation name of all operations performed. @@ -71,10 +73,16 @@ public java.util.Map getOperationsLog() { - return this.jsiiGet("operationsLog", java.util.List.class); + public software.amazon.jsii.tests.calculator.lib.Value getCurr() { + return this.jsiiGet("curr", software.amazon.jsii.tests.calculator.lib.Value.class); + } + /** + * The current value. + */ + public void setCurr(final software.amazon.jsii.tests.calculator.lib.Value value) { + this.jsiiSet("curr", java.util.Objects.requireNonNull(value, "curr is required")); } /** * The maximum value allows in this calculator. @@ -89,12 +97,6 @@ public java.lang.Number getMaxValue() { public void setMaxValue(@javax.annotation.Nullable final java.lang.Number value) { this.jsiiSet("maxValue", value); } - /** - * Returns the expression. - */ - public software.amazon.jsii.tests.calculator.lib.Value getExpression() { - return this.jsiiGet("expression", software.amazon.jsii.tests.calculator.lib.Value.class); - } /** * Example of a property that accepts a union of types. */ diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/CalculatorProps.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/CalculatorProps.java index 90a1b7b063..e3d60f845a 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/CalculatorProps.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/CalculatorProps.java @@ -1,90 +1,110 @@ package software.amazon.jsii.tests.calculator; + /** * Properties for Calculator. */ +@javax.annotation.Generated(value = "jsii-pacmak") public interface CalculatorProps extends software.amazon.jsii.JsiiSerializable { java.lang.Number getInitialValue(); void setInitialValue(final java.lang.Number value); java.lang.Number getMaximumValue(); void setMaximumValue(final java.lang.Number value); - // ================================================================== - // Builder - // ================================================================== - + /** + * @return a {@link Builder} of {@link CalculatorProps} + */ static Builder builder() { return new Builder(); } /** - * A fluent builder class for {@link CalculatorProps}. + * A builder for {@link CalculatorProps} */ - public static final class Builder { - private Jsii$Pojo instance = new Jsii$Pojo(); + final class Builder { + @javax.annotation.Nullable + private java.lang.Number _initialValue; + @javax.annotation.Nullable + private java.lang.Number _maximumValue; - public Builder withInitialValue(final java.lang.Number value) { - this.instance._initialValue = value; + /** + * Sets the value of InitialValue + * @param value the value to be set + * @return {@code this} + */ + public Builder withInitialValue(@javax.annotation.Nullable final java.lang.Number value) { + this._initialValue = value; return this; } - public Builder withMaximumValue(final java.lang.Number value) { - this.instance._maximumValue = value; + /** + * Sets the value of MaximumValue + * @param value the value to be set + * @return {@code this} + */ + public Builder withMaximumValue(@javax.annotation.Nullable final java.lang.Number value) { + this._maximumValue = value; return this; } - public CalculatorProps build() { - CalculatorProps result = this.instance; - this.instance = new Jsii$Pojo(); - return result; - } - } - - /** - * A PoJo (plain-old-java-object) class that implements {@link CalculatorProps}. - */ - final class Jsii$Pojo implements CalculatorProps { /** - * Constructor used by builders. + * Builds the configured instance. + * @return a new instance of {@link CalculatorProps} + * @throws NullPointerException if any required attribute was not provided */ - protected Jsii$Pojo() { } + public CalculatorProps build() { + return new CalculatorProps() { + @javax.annotation.Nullable + private java.lang.Number initialValue = _initialValue; + @javax.annotation.Nullable + private java.lang.Number maximumValue = _maximumValue; + @Override + public java.lang.Number getInitialValue() { + return this.initialValue; + } - protected java.lang.Number _initialValue; + @Override + public void setInitialValue(@javax.annotation.Nullable final java.lang.Number value) { + this.initialValue = value; + } - public java.lang.Number getInitialValue() { - return this._initialValue; - } - public void setInitialValue(final java.lang.Number value) { - this._initialValue = value; - } + @Override + public java.lang.Number getMaximumValue() { + return this.maximumValue; + } - protected java.lang.Number _maximumValue; + @Override + public void setMaximumValue(@javax.annotation.Nullable final java.lang.Number value) { + this.maximumValue = value; + } - public java.lang.Number getMaximumValue() { - return this._maximumValue; - } - public void setMaximumValue(final java.lang.Number value) { - this._maximumValue = value; + }; } } /** * A proxy class which for javascript object literal which adhere to this interface. */ - class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.CalculatorProps { + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.CalculatorProps { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } + + @Override @javax.annotation.Nullable public java.lang.Number getInitialValue() { return this.jsiiGet("initialValue", java.lang.Number.class); } + @Override public void setInitialValue(@javax.annotation.Nullable final java.lang.Number value) { this.jsiiSet("initialValue", value); } + + @Override @javax.annotation.Nullable public java.lang.Number getMaximumValue() { return this.jsiiGet("maximumValue", java.lang.Number.class); } + @Override public void setMaximumValue(@javax.annotation.Nullable final java.lang.Number value) { this.jsiiSet("maximumValue", value); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DerivedClassHasNoProperties/Base.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DerivedClassHasNoProperties/Base.java index cc58ba29bb..d2e5cda040 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DerivedClassHasNoProperties/Base.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DerivedClassHasNoProperties/Base.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator.DerivedClassHasNoProperties; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.DerivedClassHasNoProperties.Base") public class Base extends software.amazon.jsii.JsiiObject { protected Base(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DerivedClassHasNoProperties/Derived.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DerivedClassHasNoProperties/Derived.java index df69bdb44c..695701fb6c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DerivedClassHasNoProperties/Derived.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DerivedClassHasNoProperties/Derived.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator.DerivedClassHasNoProperties; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.DerivedClassHasNoProperties.Derived") public class Derived extends software.amazon.jsii.tests.calculator.DerivedClassHasNoProperties.Base { protected Derived(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DerivedStruct.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DerivedStruct.java index 8a23335d4e..bf697153db 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DerivedStruct.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DerivedStruct.java @@ -1,8 +1,14 @@ package software.amazon.jsii.tests.calculator; + /** * A struct which derives from another struct. */ +@javax.annotation.Generated(value = "jsii-pacmak") public interface DerivedStruct extends software.amazon.jsii.JsiiSerializable, software.amazon.jsii.tests.calculator.lib.MyFirstStruct { + java.time.Instant getAnotherRequired(); + void setAnotherRequired(final java.time.Instant value); + java.lang.Boolean getBool(); + void setBool(final java.lang.Boolean value); /** * An example of a non primitive property. */ @@ -11,12 +17,6 @@ public interface DerivedStruct extends software.amazon.jsii.JsiiSerializable, so * An example of a non primitive property. */ void setNonPrimitive(final software.amazon.jsii.tests.calculator.DoubleTrouble value); - java.lang.Boolean getBool(); - void setBool(final java.lang.Boolean value); - java.time.Instant getAnotherRequired(); - void setAnotherRequired(final java.time.Instant value); - java.util.List getOptionalArray(); - void setOptionalArray(final java.util.List value); /** * This is optional. */ @@ -25,259 +25,253 @@ public interface DerivedStruct extends software.amazon.jsii.JsiiSerializable, so * This is optional. */ void setAnotherOptional(final java.util.Map value); + java.util.List getOptionalArray(); + void setOptionalArray(final java.util.List value); - // ================================================================== - // Builder - // ================================================================== - + /** + * @return a {@link Builder} of {@link DerivedStruct} + */ static Builder builder() { return new Builder(); } + /** - * A fluent step builder class for {@link DerivedStruct}. - * The {@link Build#build()} method will be available once all required properties are fulfilled. + * A builder for {@link DerivedStruct} */ final class Builder { + private java.time.Instant _anotherRequired; + private java.lang.Boolean _bool; + private software.amazon.jsii.tests.calculator.DoubleTrouble _nonPrimitive; + @javax.annotation.Nullable + private java.util.Map _anotherOptional; + @javax.annotation.Nullable + private java.util.List _optionalArray; + private java.lang.Number _anumber; + private java.lang.String _astring; + @javax.annotation.Nullable + private java.util.List _firstOptional; + /** - * An example of a non primitive property. + * Sets the value of AnotherRequired + * @param value the value to be set + * @return {@code this} */ - public BoolStep withNonPrimitive(final software.amazon.jsii.tests.calculator.DoubleTrouble value) { - return new FullBuilder().withNonPrimitive(value); + public Builder withAnotherRequired(final java.time.Instant value) { + this._anotherRequired = java.util.Objects.requireNonNull(value, "anotherRequired is required"); + return this; } - - public interface BoolStep { - /** - * Sets the value for {@link DerivedStruct#getBool}. - */ - AnotherRequiredStep withBool(final java.lang.Boolean value); + /** + * Sets the value of Bool + * @param value the value to be set + * @return {@code this} + */ + public Builder withBool(final java.lang.Boolean value) { + this._bool = java.util.Objects.requireNonNull(value, "bool is required"); + return this; } - - public interface AnotherRequiredStep { - /** - * Sets the value for {@link DerivedStruct#getAnotherRequired}. - */ - AstringStep withAnotherRequired(final java.time.Instant value); + /** + * Sets the value of NonPrimitive + * @param value An example of a non primitive property. + * @return {@code this} + */ + public Builder withNonPrimitive(final software.amazon.jsii.tests.calculator.DoubleTrouble value) { + this._nonPrimitive = java.util.Objects.requireNonNull(value, "nonPrimitive is required"); + return this; } - - public interface AstringStep { - /** - * A string value - */ - AnumberStep withAstring(final java.lang.String value); + /** + * Sets the value of AnotherOptional + * @param value This is optional. + * @return {@code this} + */ + public Builder withAnotherOptional(@javax.annotation.Nullable final java.util.Map value) { + this._anotherOptional = value; + return this; } - - public interface AnumberStep { - /** - * An awesome number value - */ - Build withAnumber(final java.lang.Number value); + /** + * Sets the value of OptionalArray + * @param value the value to be set + * @return {@code this} + */ + public Builder withOptionalArray(@javax.annotation.Nullable final java.util.List value) { + this._optionalArray = value; + return this; } - - public interface Build { - /** - * @return a new {@link DerivedStruct} object, initialized with the values set on this builder. - */ - DerivedStruct build(); - /** - * Sets the value for {@link DerivedStruct#getOptionalArray}. - */ - Build withOptionalArray(final java.util.List value); - /** - * This is optional. - */ - Build withAnotherOptional(final java.util.Map value); - /** - * Sets the value for {@link DerivedStruct#getFirstOptional}. - */ - Build withFirstOptional(final java.util.List value); + /** + * Sets the value of Anumber + * @param value An awesome number value + * @return {@code this} + */ + public Builder withAnumber(final java.lang.Number value) { + this._anumber = java.util.Objects.requireNonNull(value, "anumber is required"); + return this; } - - final class FullBuilder implements BoolStep, AnotherRequiredStep, AstringStep, AnumberStep, Build { - - private Jsii$Pojo instance = new Jsii$Pojo(); - - /** - * An example of a non primitive property. - */ - public BoolStep withNonPrimitive(final software.amazon.jsii.tests.calculator.DoubleTrouble value) { - java.util.Objects.requireNonNull(value, "DerivedStruct#nonPrimitive is required"); - this.instance._nonPrimitive = value; - return this; - } - public AnotherRequiredStep withBool(final java.lang.Boolean value) { - java.util.Objects.requireNonNull(value, "DerivedStruct#bool is required"); - this.instance._bool = value; - return this; - } - public AstringStep withAnotherRequired(final java.time.Instant value) { - java.util.Objects.requireNonNull(value, "DerivedStruct#anotherRequired is required"); - this.instance._anotherRequired = value; - return this; - } - public Build withOptionalArray(final java.util.List value) { - this.instance._optionalArray = value; - return this; - } - /** - * This is optional. - */ - public Build withAnotherOptional(final java.util.Map value) { - this.instance._anotherOptional = value; - return this; - } - /** - * A string value - */ - public AnumberStep withAstring(final java.lang.String value) { - java.util.Objects.requireNonNull(value, "DerivedStruct#astring is required"); - this.instance._astring = value; - return this; - } - /** - * An awesome number value - */ - public Build withAnumber(final java.lang.Number value) { - java.util.Objects.requireNonNull(value, "DerivedStruct#anumber is required"); - this.instance._anumber = value; - return this; - } - public Build withFirstOptional(final java.util.List value) { - this.instance._firstOptional = value; - return this; - } - public DerivedStruct build() { - DerivedStruct result = this.instance; - this.instance = new Jsii$Pojo(); - return result; - } + /** + * Sets the value of Astring + * @param value A string value + * @return {@code this} + */ + public Builder withAstring(final java.lang.String value) { + this._astring = java.util.Objects.requireNonNull(value, "astring is required"); + return this; + } + /** + * Sets the value of FirstOptional + * @param value the value to be set + * @return {@code this} + */ + public Builder withFirstOptional(@javax.annotation.Nullable final java.util.List value) { + this._firstOptional = value; + return this; } - } - - /** - * A PoJo (plain-old-java-object) class that implements {@link DerivedStruct}. - */ - final class Jsii$Pojo implements DerivedStruct { /** - * Constructor used by builders. + * Builds the configured instance. + * @return a new instance of {@link DerivedStruct} + * @throws NullPointerException if any required attribute was not provided */ - protected Jsii$Pojo() { } + public DerivedStruct build() { + return new DerivedStruct() { + private java.time.Instant anotherRequired = java.util.Objects.requireNonNull(_anotherRequired, "anotherRequired is required"); + private java.lang.Boolean bool = java.util.Objects.requireNonNull(_bool, "bool is required"); + private software.amazon.jsii.tests.calculator.DoubleTrouble nonPrimitive = java.util.Objects.requireNonNull(_nonPrimitive, "nonPrimitive is required"); + @javax.annotation.Nullable + private java.util.Map anotherOptional = _anotherOptional; + @javax.annotation.Nullable + private java.util.List optionalArray = _optionalArray; + private java.lang.Number anumber = java.util.Objects.requireNonNull(_anumber, "anumber is required"); + private java.lang.String astring = java.util.Objects.requireNonNull(_astring, "astring is required"); + @javax.annotation.Nullable + private java.util.List firstOptional = _firstOptional; + @Override + public java.time.Instant getAnotherRequired() { + return this.anotherRequired; + } - protected software.amazon.jsii.tests.calculator.DoubleTrouble _nonPrimitive; + @Override + public void setAnotherRequired(final java.time.Instant value) { + this.anotherRequired = java.util.Objects.requireNonNull(value, "anotherRequired is required"); + } - public software.amazon.jsii.tests.calculator.DoubleTrouble getNonPrimitive() { - return this._nonPrimitive; - } - public void setNonPrimitive(final software.amazon.jsii.tests.calculator.DoubleTrouble value) { - this._nonPrimitive = value; - } + @Override + public java.lang.Boolean getBool() { + return this.bool; + } - protected java.lang.Boolean _bool; + @Override + public void setBool(final java.lang.Boolean value) { + this.bool = java.util.Objects.requireNonNull(value, "bool is required"); + } - public java.lang.Boolean getBool() { - return this._bool; - } - public void setBool(final java.lang.Boolean value) { - this._bool = value; - } + @Override + public software.amazon.jsii.tests.calculator.DoubleTrouble getNonPrimitive() { + return this.nonPrimitive; + } - protected java.time.Instant _anotherRequired; + @Override + public void setNonPrimitive(final software.amazon.jsii.tests.calculator.DoubleTrouble value) { + this.nonPrimitive = java.util.Objects.requireNonNull(value, "nonPrimitive is required"); + } - public java.time.Instant getAnotherRequired() { - return this._anotherRequired; - } - public void setAnotherRequired(final java.time.Instant value) { - this._anotherRequired = value; - } + @Override + public java.util.Map getAnotherOptional() { + return this.anotherOptional; + } - protected java.util.List _optionalArray; + @Override + public void setAnotherOptional(@javax.annotation.Nullable final java.util.Map value) { + this.anotherOptional = value; + } - public java.util.List getOptionalArray() { - return this._optionalArray; - } - public void setOptionalArray(final java.util.List value) { - this._optionalArray = value; - } + @Override + public java.util.List getOptionalArray() { + return this.optionalArray; + } - protected java.util.Map _anotherOptional; + @Override + public void setOptionalArray(@javax.annotation.Nullable final java.util.List value) { + this.optionalArray = value; + } - public java.util.Map getAnotherOptional() { - return this._anotherOptional; - } - public void setAnotherOptional(final java.util.Map value) { - this._anotherOptional = value; - } + @Override + public java.lang.Number getAnumber() { + return this.anumber; + } - protected java.lang.String _astring; + @Override + public void setAnumber(final java.lang.Number value) { + this.anumber = java.util.Objects.requireNonNull(value, "anumber is required"); + } - public java.lang.String getAstring() { - return this._astring; - } - public void setAstring(final java.lang.String value) { - this._astring = value; - } + @Override + public java.lang.String getAstring() { + return this.astring; + } - protected java.lang.Number _anumber; + @Override + public void setAstring(final java.lang.String value) { + this.astring = java.util.Objects.requireNonNull(value, "astring is required"); + } - public java.lang.Number getAnumber() { - return this._anumber; - } - public void setAnumber(final java.lang.Number value) { - this._anumber = value; - } + @Override + public java.util.List getFirstOptional() { + return this.firstOptional; + } - protected java.util.List _firstOptional; + @Override + public void setFirstOptional(@javax.annotation.Nullable final java.util.List value) { + this.firstOptional = value; + } - public java.util.List getFirstOptional() { - return this._firstOptional; - } - public void setFirstOptional(final java.util.List value) { - this._firstOptional = value; + }; } } /** * A proxy class which for javascript object literal which adhere to this interface. */ - class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.DerivedStruct { + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.DerivedStruct { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } + + @Override + public java.time.Instant getAnotherRequired() { + return this.jsiiGet("anotherRequired", java.time.Instant.class); + } + @Override + public void setAnotherRequired(final java.time.Instant value) { + this.jsiiSet("anotherRequired", java.util.Objects.requireNonNull(value, "anotherRequired is required")); + } + + @Override + public java.lang.Boolean getBool() { + return this.jsiiGet("bool", java.lang.Boolean.class); + } + @Override + public void setBool(final java.lang.Boolean value) { + this.jsiiSet("bool", java.util.Objects.requireNonNull(value, "bool is required")); + } + /** * An example of a non primitive property. */ + @Override public software.amazon.jsii.tests.calculator.DoubleTrouble getNonPrimitive() { return this.jsiiGet("nonPrimitive", software.amazon.jsii.tests.calculator.DoubleTrouble.class); } /** * An example of a non primitive property. */ + @Override public void setNonPrimitive(final software.amazon.jsii.tests.calculator.DoubleTrouble value) { this.jsiiSet("nonPrimitive", java.util.Objects.requireNonNull(value, "nonPrimitive is required")); } - public java.lang.Boolean getBool() { - return this.jsiiGet("bool", java.lang.Boolean.class); - } - public void setBool(final java.lang.Boolean value) { - this.jsiiSet("bool", java.util.Objects.requireNonNull(value, "bool is required")); - } - public java.time.Instant getAnotherRequired() { - return this.jsiiGet("anotherRequired", java.time.Instant.class); - } - public void setAnotherRequired(final java.time.Instant value) { - this.jsiiSet("anotherRequired", java.util.Objects.requireNonNull(value, "anotherRequired is required")); - } - @javax.annotation.Nullable - public java.util.List getOptionalArray() { - return this.jsiiGet("optionalArray", java.util.List.class); - } - public void setOptionalArray(@javax.annotation.Nullable final java.util.List value) { - this.jsiiSet("optionalArray", value); - } + /** * This is optional. */ + @Override @javax.annotation.Nullable public java.util.Map getAnotherOptional() { return this.jsiiGet("anotherOptional", java.util.Map.class); @@ -285,37 +279,57 @@ public java.util.Map value) { this.jsiiSet("anotherOptional", value); } - /** - * A string value - */ - public java.lang.String getAstring() { - return this.jsiiGet("astring", java.lang.String.class); + + @Override + @javax.annotation.Nullable + public java.util.List getOptionalArray() { + return this.jsiiGet("optionalArray", java.util.List.class); } - /** - * A string value - */ - public void setAstring(final java.lang.String value) { - this.jsiiSet("astring", java.util.Objects.requireNonNull(value, "astring is required")); + @Override + public void setOptionalArray(@javax.annotation.Nullable final java.util.List value) { + this.jsiiSet("optionalArray", value); } + /** * An awesome number value */ + @Override public java.lang.Number getAnumber() { return this.jsiiGet("anumber", java.lang.Number.class); } /** * An awesome number value */ + @Override public void setAnumber(final java.lang.Number value) { this.jsiiSet("anumber", java.util.Objects.requireNonNull(value, "anumber is required")); } + + /** + * A string value + */ + @Override + public java.lang.String getAstring() { + return this.jsiiGet("astring", java.lang.String.class); + } + /** + * A string value + */ + @Override + public void setAstring(final java.lang.String value) { + this.jsiiSet("astring", java.util.Objects.requireNonNull(value, "astring is required")); + } + + @Override @javax.annotation.Nullable public java.util.List getFirstOptional() { return this.jsiiGet("firstOptional", java.util.List.class); } + @Override public void setFirstOptional(@javax.annotation.Nullable final java.util.List value) { this.jsiiSet("firstOptional", value); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DoubleTrouble.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DoubleTrouble.java index 29fe4839cc..594e059298 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DoubleTrouble.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/DoubleTrouble.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.DoubleTrouble") public class DoubleTrouble extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IFriendlyRandomGenerator { protected DoubleTrouble(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -8,16 +10,16 @@ public DoubleTrouble() { super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); } - /** - * Returns another random number. - */ - public java.lang.Number next() { - return this.jsiiCall("next", java.lang.Number.class); - } /** * Say hello! */ public java.lang.String hello() { return this.jsiiCall("hello", java.lang.String.class); } + /** + * Returns another random number. + */ + public java.lang.Number next() { + return this.jsiiCall("next", java.lang.Number.class); + } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/GiveMeStructs.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/GiveMeStructs.java index 0dc8c6dce9..dd1e23a2ba 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/GiveMeStructs.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/GiveMeStructs.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.GiveMeStructs") public class GiveMeStructs extends software.amazon.jsii.JsiiObject { protected GiveMeStructs(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -9,10 +11,10 @@ public GiveMeStructs() { software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); } /** - * Returns the "anumber" from a MyFirstStruct struct; + * Accepts a struct of type DerivedStruct and returns a struct of type FirstStruct. */ - public java.lang.Number readFirstNumber(final software.amazon.jsii.tests.calculator.lib.MyFirstStruct first) { - return this.jsiiCall("readFirstNumber", java.lang.Number.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(first, "first is required")).toArray()); + public software.amazon.jsii.tests.calculator.lib.MyFirstStruct derivedToFirst(final software.amazon.jsii.tests.calculator.DerivedStruct derived) { + return this.jsiiCall("derivedToFirst", software.amazon.jsii.tests.calculator.lib.MyFirstStruct.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(derived, "derived is required")).toArray()); } /** * Returns the boolean from a DerivedStruct struct. @@ -21,10 +23,10 @@ public software.amazon.jsii.tests.calculator.DoubleTrouble readDerivedNonPrimiti return this.jsiiCall("readDerivedNonPrimitive", software.amazon.jsii.tests.calculator.DoubleTrouble.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(derived, "derived is required")).toArray()); } /** - * Accepts a struct of type DerivedStruct and returns a struct of type FirstStruct. + * Returns the "anumber" from a MyFirstStruct struct; */ - public software.amazon.jsii.tests.calculator.lib.MyFirstStruct derivedToFirst(final software.amazon.jsii.tests.calculator.DerivedStruct derived) { - return this.jsiiCall("derivedToFirst", software.amazon.jsii.tests.calculator.lib.MyFirstStruct.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(derived, "derived is required")).toArray()); + public java.lang.Number readFirstNumber(final software.amazon.jsii.tests.calculator.lib.MyFirstStruct first) { + return this.jsiiCall("readFirstNumber", java.lang.Number.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(first, "first is required")).toArray()); } public software.amazon.jsii.tests.calculator.lib.StructWithOnlyOptionals getStructLiteral() { return this.jsiiGet("structLiteral", software.amazon.jsii.tests.calculator.lib.StructWithOnlyOptionals.class); diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IFriendlier.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IFriendlier.java index 219eedfefc..6834a91af0 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IFriendlier.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IFriendlier.java @@ -1,41 +1,49 @@ package software.amazon.jsii.tests.calculator; + /** * Even friendlier classes can implement this interface. */ +@javax.annotation.Generated(value = "jsii-pacmak") public interface IFriendlier extends software.amazon.jsii.JsiiSerializable, software.amazon.jsii.tests.calculator.lib.IFriendly { + /** + * Say farewell. + */ + java.lang.String farewell(); /** * Say goodbye. * @return A goodbye blessing. */ java.lang.String goodbye(); - /** - * Say farewell. - */ - java.lang.String farewell(); /** * A proxy class which for javascript object literal which adhere to this interface. */ - class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IFriendlier { + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IFriendlier { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } + + /** + * Say farewell. + */ + @Override + public java.lang.String farewell() { + return this.jsiiCall("farewell", java.lang.String.class); + } + /** * Say goodbye. * @return A goodbye blessing. */ + @Override public java.lang.String goodbye() { return this.jsiiCall("goodbye", java.lang.String.class); } - /** - * Say farewell. - */ - public java.lang.String farewell() { - return this.jsiiCall("farewell", java.lang.String.class); - } + /** * Say hello! */ + @Override public java.lang.String hello() { return this.jsiiCall("hello", java.lang.String.class); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IFriendlyRandomGenerator.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IFriendlyRandomGenerator.java index 1fb16bff3c..c35c360344 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IFriendlyRandomGenerator.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IFriendlyRandomGenerator.java @@ -1,23 +1,29 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") public interface IFriendlyRandomGenerator extends software.amazon.jsii.JsiiSerializable, software.amazon.jsii.tests.calculator.IRandomNumberGenerator, software.amazon.jsii.tests.calculator.lib.IFriendly { /** * A proxy class which for javascript object literal which adhere to this interface. */ - class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IFriendlyRandomGenerator { + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IFriendlyRandomGenerator { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } + /** * Returns another random number. * @return A random number. */ + @Override public java.lang.Number next() { return this.jsiiCall("next", java.lang.Number.class); } + /** * Say hello! */ + @Override public java.lang.String hello() { return this.jsiiCall("hello", java.lang.String.class); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithProperties.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithProperties.java index 3c5b872172..6dd3a7dfac 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithProperties.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithProperties.java @@ -1,101 +1,91 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") public interface IInterfaceWithProperties extends software.amazon.jsii.JsiiSerializable { java.lang.String getReadOnlyString(); java.lang.String getReadWriteString(); void setReadWriteString(final java.lang.String value); - // ================================================================== - // Builder - // ================================================================== - + /** + * @return a {@link Builder} of {@link IInterfaceWithProperties} + */ static Builder builder() { return new Builder(); } + /** - * A fluent step builder class for {@link IInterfaceWithProperties}. - * The {@link Build#build()} method will be available once all required properties are fulfilled. + * A builder for {@link IInterfaceWithProperties} */ final class Builder { - public ReadWriteStringStep withReadOnlyString(final java.lang.String value) { - return new FullBuilder().withReadOnlyString(value); - } - - public interface ReadWriteStringStep { - /** - * Sets the value for {@link IInterfaceWithProperties#getReadWriteString}. - */ - Build withReadWriteString(final java.lang.String value); - } + private java.lang.String _readOnlyString; + private java.lang.String _readWriteString; - public interface Build { - /** - * @return a new {@link IInterfaceWithProperties} object, initialized with the values set on this builder. - */ - IInterfaceWithProperties build(); + /** + * Sets the value of ReadOnlyString + * @param value the value to be set + * @return {@code this} + */ + public Builder withReadOnlyString(final java.lang.String value) { + this._readOnlyString = java.util.Objects.requireNonNull(value, "readOnlyString is required"); + return this; } - - final class FullBuilder implements ReadWriteStringStep, Build { - - private Jsii$Pojo instance = new Jsii$Pojo(); - - public ReadWriteStringStep withReadOnlyString(final java.lang.String value) { - java.util.Objects.requireNonNull(value, "IInterfaceWithProperties#readOnlyString is required"); - this.instance._readOnlyString = value; - return this; - } - public Build withReadWriteString(final java.lang.String value) { - java.util.Objects.requireNonNull(value, "IInterfaceWithProperties#readWriteString is required"); - this.instance._readWriteString = value; - return this; - } - public IInterfaceWithProperties build() { - IInterfaceWithProperties result = this.instance; - this.instance = new Jsii$Pojo(); - return result; - } + /** + * Sets the value of ReadWriteString + * @param value the value to be set + * @return {@code this} + */ + public Builder withReadWriteString(final java.lang.String value) { + this._readWriteString = java.util.Objects.requireNonNull(value, "readWriteString is required"); + return this; } - } - - /** - * A PoJo (plain-old-java-object) class that implements {@link IInterfaceWithProperties}. - */ - final class Jsii$Pojo implements IInterfaceWithProperties { /** - * Constructor used by builders. + * Builds the configured instance. + * @return a new instance of {@link IInterfaceWithProperties} + * @throws NullPointerException if any required attribute was not provided */ - protected Jsii$Pojo() { } + public IInterfaceWithProperties build() { + return new IInterfaceWithProperties() { + private final java.lang.String readOnlyString = java.util.Objects.requireNonNull(_readOnlyString, "readOnlyString is required"); + private java.lang.String readWriteString = java.util.Objects.requireNonNull(_readWriteString, "readWriteString is required"); + @Override + public java.lang.String getReadOnlyString() { + return this.readOnlyString; + } - protected java.lang.String _readOnlyString; + @Override + public java.lang.String getReadWriteString() { + return this.readWriteString; + } - public java.lang.String getReadOnlyString() { - return this._readOnlyString; - } + @Override + public void setReadWriteString(final java.lang.String value) { + this.readWriteString = java.util.Objects.requireNonNull(value, "readWriteString is required"); + } - protected java.lang.String _readWriteString; - - public java.lang.String getReadWriteString() { - return this._readWriteString; - } - public void setReadWriteString(final java.lang.String value) { - this._readWriteString = value; + }; } } /** * A proxy class which for javascript object literal which adhere to this interface. */ - class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IInterfaceWithProperties { + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IInterfaceWithProperties { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } + + @Override public java.lang.String getReadOnlyString() { return this.jsiiGet("readOnlyString", java.lang.String.class); } + + @Override public java.lang.String getReadWriteString() { return this.jsiiGet("readWriteString", java.lang.String.class); } + @Override public void setReadWriteString(final java.lang.String value) { this.jsiiSet("readWriteString", java.util.Objects.requireNonNull(value, "readWriteString is required")); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithPropertiesExtension.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithPropertiesExtension.java index 435c79dda6..4c89427a01 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithPropertiesExtension.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithPropertiesExtension.java @@ -1,127 +1,120 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") public interface IInterfaceWithPropertiesExtension extends software.amazon.jsii.JsiiSerializable, software.amazon.jsii.tests.calculator.IInterfaceWithProperties { java.lang.Number getFoo(); void setFoo(final java.lang.Number value); - // ================================================================== - // Builder - // ================================================================== - - static Builder builder() { - return new Builder(); - } /** - * A fluent step builder class for {@link IInterfaceWithPropertiesExtension}. - * The {@link Build#build()} method will be available once all required properties are fulfilled. + * @return a {@link Builder} of {@link IInterfaceWithPropertiesExtension} */ - final class Builder { - public ReadOnlyStringStep withFoo(final java.lang.Number value) { - return new FullBuilder().withFoo(value); - } - - public interface ReadOnlyStringStep { - /** - * Sets the value for {@link IInterfaceWithPropertiesExtension#getReadOnlyString}. - */ - ReadWriteStringStep withReadOnlyString(final java.lang.String value); - } - - public interface ReadWriteStringStep { - /** - * Sets the value for {@link IInterfaceWithPropertiesExtension#getReadWriteString}. - */ - Build withReadWriteString(final java.lang.String value); - } - - public interface Build { - /** - * @return a new {@link IInterfaceWithPropertiesExtension} object, initialized with the values set on this builder. - */ - IInterfaceWithPropertiesExtension build(); - } - - final class FullBuilder implements ReadOnlyStringStep, ReadWriteStringStep, Build { - - private Jsii$Pojo instance = new Jsii$Pojo(); - - public ReadOnlyStringStep withFoo(final java.lang.Number value) { - java.util.Objects.requireNonNull(value, "IInterfaceWithPropertiesExtension#foo is required"); - this.instance._foo = value; - return this; - } - public ReadWriteStringStep withReadOnlyString(final java.lang.String value) { - java.util.Objects.requireNonNull(value, "IInterfaceWithPropertiesExtension#readOnlyString is required"); - this.instance._readOnlyString = value; - return this; - } - public Build withReadWriteString(final java.lang.String value) { - java.util.Objects.requireNonNull(value, "IInterfaceWithPropertiesExtension#readWriteString is required"); - this.instance._readWriteString = value; - return this; - } - public IInterfaceWithPropertiesExtension build() { - IInterfaceWithPropertiesExtension result = this.instance; - this.instance = new Jsii$Pojo(); - return result; - } - } + static Builder builder() { + return new Builder(); } /** - * A PoJo (plain-old-java-object) class that implements {@link IInterfaceWithPropertiesExtension}. + * A builder for {@link IInterfaceWithPropertiesExtension} */ - final class Jsii$Pojo implements IInterfaceWithPropertiesExtension { + final class Builder { + private java.lang.Number _foo; + private java.lang.String _readOnlyString; + private java.lang.String _readWriteString; /** - * Constructor used by builders. + * Sets the value of Foo + * @param value the value to be set + * @return {@code this} */ - protected Jsii$Pojo() { } - - - protected java.lang.Number _foo; - - public java.lang.Number getFoo() { - return this._foo; + public Builder withFoo(final java.lang.Number value) { + this._foo = java.util.Objects.requireNonNull(value, "foo is required"); + return this; } - public void setFoo(final java.lang.Number value) { - this._foo = value; + /** + * Sets the value of ReadOnlyString + * @param value the value to be set + * @return {@code this} + */ + public Builder withReadOnlyString(final java.lang.String value) { + this._readOnlyString = java.util.Objects.requireNonNull(value, "readOnlyString is required"); + return this; } - - protected java.lang.String _readOnlyString; - - public java.lang.String getReadOnlyString() { - return this._readOnlyString; + /** + * Sets the value of ReadWriteString + * @param value the value to be set + * @return {@code this} + */ + public Builder withReadWriteString(final java.lang.String value) { + this._readWriteString = java.util.Objects.requireNonNull(value, "readWriteString is required"); + return this; } - protected java.lang.String _readWriteString; - - public java.lang.String getReadWriteString() { - return this._readWriteString; - } - public void setReadWriteString(final java.lang.String value) { - this._readWriteString = value; + /** + * Builds the configured instance. + * @return a new instance of {@link IInterfaceWithPropertiesExtension} + * @throws NullPointerException if any required attribute was not provided + */ + public IInterfaceWithPropertiesExtension build() { + return new IInterfaceWithPropertiesExtension() { + private java.lang.Number foo = java.util.Objects.requireNonNull(_foo, "foo is required"); + private final java.lang.String readOnlyString = java.util.Objects.requireNonNull(_readOnlyString, "readOnlyString is required"); + private java.lang.String readWriteString = java.util.Objects.requireNonNull(_readWriteString, "readWriteString is required"); + + @Override + public java.lang.Number getFoo() { + return this.foo; + } + + @Override + public void setFoo(final java.lang.Number value) { + this.foo = java.util.Objects.requireNonNull(value, "foo is required"); + } + + @Override + public java.lang.String getReadOnlyString() { + return this.readOnlyString; + } + + @Override + public java.lang.String getReadWriteString() { + return this.readWriteString; + } + + @Override + public void setReadWriteString(final java.lang.String value) { + this.readWriteString = java.util.Objects.requireNonNull(value, "readWriteString is required"); + } + + }; } } /** * A proxy class which for javascript object literal which adhere to this interface. */ - class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IInterfaceWithPropertiesExtension { + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IInterfaceWithPropertiesExtension { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } + + @Override public java.lang.Number getFoo() { return this.jsiiGet("foo", java.lang.Number.class); } + @Override public void setFoo(final java.lang.Number value) { this.jsiiSet("foo", java.util.Objects.requireNonNull(value, "foo is required")); } + + @Override public java.lang.String getReadOnlyString() { return this.jsiiGet("readOnlyString", java.lang.String.class); } + + @Override public java.lang.String getReadWriteString() { return this.jsiiGet("readWriteString", java.lang.String.class); } + @Override public void setReadWriteString(final java.lang.String value) { this.jsiiSet("readWriteString", java.util.Objects.requireNonNull(value, "readWriteString is required")); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IRandomNumberGenerator.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IRandomNumberGenerator.java index 92bf1a0c3f..866422292f 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IRandomNumberGenerator.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IRandomNumberGenerator.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator; + /** * Generates random numbers. */ +@javax.annotation.Generated(value = "jsii-pacmak") public interface IRandomNumberGenerator extends software.amazon.jsii.JsiiSerializable { /** * Returns another random number. @@ -12,14 +14,16 @@ public interface IRandomNumberGenerator extends software.amazon.jsii.JsiiSeriali /** * A proxy class which for javascript object literal which adhere to this interface. */ - class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IRandomNumberGenerator { + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IRandomNumberGenerator { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } + /** * Returns another random number. * @return A random number. */ + @Override public java.lang.Number next() { return this.jsiiCall("next", java.lang.Number.class); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ImplictBaseOfBase.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ImplictBaseOfBase.java index a02f43d21a..1049b4e661 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ImplictBaseOfBase.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ImplictBaseOfBase.java @@ -1,133 +1,129 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") public interface ImplictBaseOfBase extends software.amazon.jsii.JsiiSerializable, software.amazon.jsii.tests.calculator.base.BaseProps { java.time.Instant getGoo(); void setGoo(final java.time.Instant value); - // ================================================================== - // Builder - // ================================================================== - - static Builder builder() { - return new Builder(); - } /** - * A fluent step builder class for {@link ImplictBaseOfBase}. - * The {@link Build#build()} method will be available once all required properties are fulfilled. + * @return a {@link Builder} of {@link ImplictBaseOfBase} */ - final class Builder { - public BarStep withGoo(final java.time.Instant value) { - return new FullBuilder().withGoo(value); - } - - public interface BarStep { - /** - * Sets the value for {@link ImplictBaseOfBase#getBar}. - */ - FooStep withBar(final java.lang.String value); - } - - public interface FooStep { - /** - * Sets the value for {@link ImplictBaseOfBase#getFoo}. - */ - Build withFoo(final software.amazon.jsii.tests.calculator.baseofbase.Very value); - } - - public interface Build { - /** - * @return a new {@link ImplictBaseOfBase} object, initialized with the values set on this builder. - */ - ImplictBaseOfBase build(); - } - - final class FullBuilder implements BarStep, FooStep, Build { - - private Jsii$Pojo instance = new Jsii$Pojo(); - - public BarStep withGoo(final java.time.Instant value) { - java.util.Objects.requireNonNull(value, "ImplictBaseOfBase#goo is required"); - this.instance._goo = value; - return this; - } - public FooStep withBar(final java.lang.String value) { - java.util.Objects.requireNonNull(value, "ImplictBaseOfBase#bar is required"); - this.instance._bar = value; - return this; - } - public Build withFoo(final software.amazon.jsii.tests.calculator.baseofbase.Very value) { - java.util.Objects.requireNonNull(value, "ImplictBaseOfBase#foo is required"); - this.instance._foo = value; - return this; - } - public ImplictBaseOfBase build() { - ImplictBaseOfBase result = this.instance; - this.instance = new Jsii$Pojo(); - return result; - } - } + static Builder builder() { + return new Builder(); } /** - * A PoJo (plain-old-java-object) class that implements {@link ImplictBaseOfBase}. + * A builder for {@link ImplictBaseOfBase} */ - final class Jsii$Pojo implements ImplictBaseOfBase { + final class Builder { + private java.time.Instant _goo; + private java.lang.String _bar; + private software.amazon.jsii.tests.calculator.baseofbase.Very _foo; /** - * Constructor used by builders. + * Sets the value of Goo + * @param value the value to be set + * @return {@code this} */ - protected Jsii$Pojo() { } - - - protected java.time.Instant _goo; - - public java.time.Instant getGoo() { - return this._goo; - } - public void setGoo(final java.time.Instant value) { - this._goo = value; + public Builder withGoo(final java.time.Instant value) { + this._goo = java.util.Objects.requireNonNull(value, "goo is required"); + return this; } - - protected java.lang.String _bar; - - public java.lang.String getBar() { - return this._bar; + /** + * Sets the value of Bar + * @param value the value to be set + * @return {@code this} + */ + public Builder withBar(final java.lang.String value) { + this._bar = java.util.Objects.requireNonNull(value, "bar is required"); + return this; } - public void setBar(final java.lang.String value) { - this._bar = value; + /** + * Sets the value of Foo + * @param value the value to be set + * @return {@code this} + */ + public Builder withFoo(final software.amazon.jsii.tests.calculator.baseofbase.Very value) { + this._foo = java.util.Objects.requireNonNull(value, "foo is required"); + return this; } - protected software.amazon.jsii.tests.calculator.baseofbase.Very _foo; - - public software.amazon.jsii.tests.calculator.baseofbase.Very getFoo() { - return this._foo; - } - public void setFoo(final software.amazon.jsii.tests.calculator.baseofbase.Very value) { - this._foo = value; + /** + * Builds the configured instance. + * @return a new instance of {@link ImplictBaseOfBase} + * @throws NullPointerException if any required attribute was not provided + */ + public ImplictBaseOfBase build() { + return new ImplictBaseOfBase() { + private java.time.Instant goo = java.util.Objects.requireNonNull(_goo, "goo is required"); + private java.lang.String bar = java.util.Objects.requireNonNull(_bar, "bar is required"); + private software.amazon.jsii.tests.calculator.baseofbase.Very foo = java.util.Objects.requireNonNull(_foo, "foo is required"); + + @Override + public java.time.Instant getGoo() { + return this.goo; + } + + @Override + public void setGoo(final java.time.Instant value) { + this.goo = java.util.Objects.requireNonNull(value, "goo is required"); + } + + @Override + public java.lang.String getBar() { + return this.bar; + } + + @Override + public void setBar(final java.lang.String value) { + this.bar = java.util.Objects.requireNonNull(value, "bar is required"); + } + + @Override + public software.amazon.jsii.tests.calculator.baseofbase.Very getFoo() { + return this.foo; + } + + @Override + public void setFoo(final software.amazon.jsii.tests.calculator.baseofbase.Very value) { + this.foo = java.util.Objects.requireNonNull(value, "foo is required"); + } + + }; } } /** * A proxy class which for javascript object literal which adhere to this interface. */ - class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.ImplictBaseOfBase { + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.ImplictBaseOfBase { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } + + @Override public java.time.Instant getGoo() { return this.jsiiGet("goo", java.time.Instant.class); } + @Override public void setGoo(final java.time.Instant value) { this.jsiiSet("goo", java.util.Objects.requireNonNull(value, "goo is required")); } + + @Override public java.lang.String getBar() { return this.jsiiGet("bar", java.lang.String.class); } + @Override public void setBar(final java.lang.String value) { this.jsiiSet("bar", java.util.Objects.requireNonNull(value, "bar is required")); } + + @Override public software.amazon.jsii.tests.calculator.baseofbase.Very getFoo() { return this.jsiiGet("foo", software.amazon.jsii.tests.calculator.baseofbase.Very.class); } + @Override public void setFoo(final software.amazon.jsii.tests.calculator.baseofbase.Very value) { this.jsiiSet("foo", java.util.Objects.requireNonNull(value, "foo is required")); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JSObjectLiteralForInterface.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JSObjectLiteralForInterface.java index 512ab9a305..75b4f02acf 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JSObjectLiteralForInterface.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JSObjectLiteralForInterface.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.JSObjectLiteralForInterface") public class JSObjectLiteralForInterface extends software.amazon.jsii.JsiiObject { protected JSObjectLiteralForInterface(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JSObjectLiteralToNative.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JSObjectLiteralToNative.java index cda5cf5abc..b6d9728937 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JSObjectLiteralToNative.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JSObjectLiteralToNative.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.JSObjectLiteralToNative") public class JSObjectLiteralToNative extends software.amazon.jsii.JsiiObject { protected JSObjectLiteralToNative(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JSObjectLiteralToNativeClass.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JSObjectLiteralToNativeClass.java index 8c880e463a..3ea427c9ca 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JSObjectLiteralToNativeClass.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JSObjectLiteralToNativeClass.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.JSObjectLiteralToNativeClass") public class JSObjectLiteralToNativeClass extends software.amazon.jsii.JsiiObject { protected JSObjectLiteralToNativeClass(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JavaReservedWords.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JavaReservedWords.java index 96754b1a7d..dfc2060d7e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JavaReservedWords.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/JavaReservedWords.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.JavaReservedWords") public class JavaReservedWords extends software.amazon.jsii.JsiiObject { protected JavaReservedWords(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -44,12 +46,12 @@ public void continue_() { public void default_() { this.jsiiCall("default", Void.class); } - public void double_() { - this.jsiiCall("double", Void.class); - } public void do_() { this.jsiiCall("do", Void.class); } + public void double_() { + this.jsiiCall("double", Void.class); + } public void else_() { this.jsiiCall("else", Void.class); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Multiply.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Multiply.java index b3758b078c..aab0f978b1 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Multiply.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Multiply.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator; + /** * The "*" binary operation. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.Multiply") public class Multiply extends software.amazon.jsii.tests.calculator.BinaryOperation implements software.amazon.jsii.tests.calculator.IFriendlier,software.amazon.jsii.tests.calculator.IRandomNumberGenerator { protected Multiply(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -17,10 +19,10 @@ public Multiply(final software.amazon.jsii.tests.calculator.lib.Value lhs, final software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, java.util.stream.Stream.concat(java.util.stream.Stream.of(java.util.Objects.requireNonNull(lhs, "lhs is required")), java.util.stream.Stream.of(java.util.Objects.requireNonNull(rhs, "rhs is required"))).toArray()); } /** - * String representation of the value. + * Say farewell. */ - public java.lang.String toString() { - return this.jsiiCall("toString", java.lang.String.class); + public java.lang.String farewell() { + return this.jsiiCall("farewell", java.lang.String.class); } /** * Say goodbye. @@ -28,18 +30,18 @@ public java.lang.String toString() { public java.lang.String goodbye() { return this.jsiiCall("goodbye", java.lang.String.class); } - /** - * Say farewell. - */ - public java.lang.String farewell() { - return this.jsiiCall("farewell", java.lang.String.class); - } /** * Returns another random number. */ public java.lang.Number next() { return this.jsiiCall("next", java.lang.Number.class); } + /** + * String representation of the value. + */ + public java.lang.String toString() { + return this.jsiiCall("toString", java.lang.String.class); + } /** * The value. */ diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Negate.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Negate.java index 8699ac6836..9389c02b24 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Negate.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Negate.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator; + /** * The negation operation ("-value") */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.Negate") public class Negate extends software.amazon.jsii.tests.calculator.UnaryOperation implements software.amazon.jsii.tests.calculator.IFriendlier { protected Negate(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -12,16 +14,10 @@ public Negate(final software.amazon.jsii.tests.calculator.lib.Value operand) { software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, java.util.stream.Stream.of(java.util.Objects.requireNonNull(operand, "operand is required")).toArray()); } /** - * String representation of the value. - */ - public java.lang.String toString() { - return this.jsiiCall("toString", java.lang.String.class); - } - /** - * Say hello! + * Say farewell. */ - public java.lang.String hello() { - return this.jsiiCall("hello", java.lang.String.class); + public java.lang.String farewell() { + return this.jsiiCall("farewell", java.lang.String.class); } /** * Say goodbye. @@ -30,10 +26,16 @@ public java.lang.String goodbye() { return this.jsiiCall("goodbye", java.lang.String.class); } /** - * Say farewell. + * Say hello! */ - public java.lang.String farewell() { - return this.jsiiCall("farewell", java.lang.String.class); + public java.lang.String hello() { + return this.jsiiCall("hello", java.lang.String.class); + } + /** + * String representation of the value. + */ + public java.lang.String toString() { + return this.jsiiCall("toString", java.lang.String.class); } /** * The value. diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/NodeStandardLibrary.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/NodeStandardLibrary.java index 0a2c6a851a..500a7b6973 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/NodeStandardLibrary.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/NodeStandardLibrary.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator; + /** * Test fixture to verify that jsii modules can use the node standard library. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.NodeStandardLibrary") public class NodeStandardLibrary extends software.amazon.jsii.JsiiObject { protected NodeStandardLibrary(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -11,6 +13,13 @@ public NodeStandardLibrary() { super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); } + /** + * Uses node.js "crypto" module to calculate sha256 of a string. + * @return "6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50" + */ + public java.lang.String cryptoSha256() { + return this.jsiiCall("cryptoSha256", java.lang.String.class); + } /** * Reads a local resource file (resource.txt) asynchronously. * @return "Hello, resource!" @@ -25,13 +34,6 @@ public java.lang.String fsReadFile() { public java.lang.String fsReadFileSync() { return this.jsiiCall("fsReadFileSync", java.lang.String.class); } - /** - * Uses node.js "crypto" module to calculate sha256 of a string. - * @return "6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50" - */ - public java.lang.String cryptoSha256() { - return this.jsiiCall("cryptoSha256", java.lang.String.class); - } /** * Returns the current os.platform() from the "os" node module. */ diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/NumberGenerator.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/NumberGenerator.java index 1f1e900e53..73137da695 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/NumberGenerator.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/NumberGenerator.java @@ -1,8 +1,10 @@ package software.amazon.jsii.tests.calculator; + /** * This allows us to test that a reference can be stored for objects that * implement interfaces. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.NumberGenerator") public class NumberGenerator extends software.amazon.jsii.JsiiObject { protected NumberGenerator(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -12,12 +14,12 @@ public NumberGenerator(final software.amazon.jsii.tests.calculator.IRandomNumber super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, java.util.stream.Stream.of(java.util.Objects.requireNonNull(generator, "generator is required")).toArray()); } - public java.lang.Number nextTimes100() { - return this.jsiiCall("nextTimes100", java.lang.Number.class); - } public java.lang.Boolean isSameGenerator(final software.amazon.jsii.tests.calculator.IRandomNumberGenerator gen) { return this.jsiiCall("isSameGenerator", java.lang.Boolean.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(gen, "gen is required")).toArray()); } + public java.lang.Number nextTimes100() { + return this.jsiiCall("nextTimes100", java.lang.Number.class); + } public software.amazon.jsii.tests.calculator.IRandomNumberGenerator getGenerator() { return this.jsiiGet("generator", software.amazon.jsii.tests.calculator.IRandomNumberGenerator.class); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ObjectRefsInCollections.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ObjectRefsInCollections.java index fede6a349c..79acf4725f 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ObjectRefsInCollections.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ObjectRefsInCollections.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator; + /** * Verify that object references can be passed inside collections. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.ObjectRefsInCollections") public class ObjectRefsInCollections extends software.amazon.jsii.JsiiObject { protected ObjectRefsInCollections(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/OverrideReturnsObject.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/OverrideReturnsObject.java index 360e5a0acb..2f736119cb 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/OverrideReturnsObject.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/OverrideReturnsObject.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.OverrideReturnsObject") public class OverrideReturnsObject extends software.amazon.jsii.JsiiObject { protected OverrideReturnsObject(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Polymorphism.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Polymorphism.java index 93edfb0568..cfe16bb65c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Polymorphism.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Polymorphism.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.Polymorphism") public class Polymorphism extends software.amazon.jsii.JsiiObject { protected Polymorphism(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Power.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Power.java index b610b89e3f..20fd27b6ea 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Power.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Power.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator; + /** * The power operation. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.Power") public class Power extends software.amazon.jsii.tests.calculator.composition.CompositeOperation { protected Power(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -22,12 +24,6 @@ public Power(final software.amazon.jsii.tests.calculator.lib.Value base, final s public software.amazon.jsii.tests.calculator.lib.Value getBase() { return this.jsiiGet("base", software.amazon.jsii.tests.calculator.lib.Value.class); } - /** - * The number of times to multiply - */ - public software.amazon.jsii.tests.calculator.lib.Value getPow() { - return this.jsiiGet("pow", software.amazon.jsii.tests.calculator.lib.Value.class); - } /** * The expression that this operation consists of. * Must be implemented by derived classes. @@ -35,4 +31,10 @@ public software.amazon.jsii.tests.calculator.lib.Value getPow() { public software.amazon.jsii.tests.calculator.lib.Value getExpression() { return this.jsiiGet("expression", software.amazon.jsii.tests.calculator.lib.Value.class); } + /** + * The number of times to multiply + */ + public software.amazon.jsii.tests.calculator.lib.Value getPow() { + return this.jsiiGet("pow", software.amazon.jsii.tests.calculator.lib.Value.class); + } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ReferenceEnumFromScopedPackage.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ReferenceEnumFromScopedPackage.java index 3e3e65c34d..48bfbaf1f3 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ReferenceEnumFromScopedPackage.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ReferenceEnumFromScopedPackage.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator; + /** * See awslabs/jsii#138 */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.ReferenceEnumFromScopedPackage") public class ReferenceEnumFromScopedPackage extends software.amazon.jsii.JsiiObject { protected ReferenceEnumFromScopedPackage(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ReturnsNumber.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ReturnsNumber.java index 42815a13dd..df433c07c4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ReturnsNumber.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ReturnsNumber.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") public interface ReturnsNumber extends software.amazon.jsii.JsiiSerializable { java.lang.Number getNumberProp(); java.lang.Number obtainNumber(); @@ -6,13 +8,17 @@ public interface ReturnsNumber extends software.amazon.jsii.JsiiSerializable { /** * A proxy class which for javascript object literal which adhere to this interface. */ - class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.ReturnsNumber { + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.ReturnsNumber { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } + + @Override public java.lang.Number getNumberProp() { return this.jsiiGet("numberProp", java.lang.Number.class); } + + @Override public java.lang.Number obtainNumber() { return this.jsiiCall("obtainNumber", java.lang.Number.class); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/RuntimeTypeChecking.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/RuntimeTypeChecking.java index 04bf372443..0465fc6d77 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/RuntimeTypeChecking.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/RuntimeTypeChecking.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.RuntimeTypeChecking") public class RuntimeTypeChecking extends software.amazon.jsii.JsiiObject { protected RuntimeTypeChecking(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Statics.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Statics.java index 0711cfdb1d..0024b60fec 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Statics.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Statics.java @@ -1,14 +1,16 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.Statics") public class Statics extends software.amazon.jsii.JsiiObject { protected Statics(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } static { - FOO = software.amazon.jsii.JsiiObject.jsiiStaticGet(software.amazon.jsii.tests.calculator.Statics.class, "Foo", java.lang.String.class); BAR = software.amazon.jsii.JsiiObject.jsiiStaticGet(software.amazon.jsii.tests.calculator.Statics.class, "BAR", java.lang.Number.class); - ZOO_BAR = software.amazon.jsii.JsiiObject.jsiiStaticGet(software.amazon.jsii.tests.calculator.Statics.class, "zooBar", java.util.Map.class); CONST_OBJ = software.amazon.jsii.JsiiObject.jsiiStaticGet(software.amazon.jsii.tests.calculator.Statics.class, "ConstObj", software.amazon.jsii.tests.calculator.DoubleTrouble.class); + FOO = software.amazon.jsii.JsiiObject.jsiiStaticGet(software.amazon.jsii.tests.calculator.Statics.class, "Foo", java.lang.String.class); + ZOO_BAR = software.amazon.jsii.JsiiObject.jsiiStaticGet(software.amazon.jsii.tests.calculator.Statics.class, "zooBar", java.util.Map.class); } public Statics(final java.lang.String value) { super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); @@ -24,17 +26,15 @@ public static java.lang.String staticMethod(final java.lang.String name) { public java.lang.String justMethod() { return this.jsiiCall("justMethod", java.lang.String.class); } - public java.lang.String getValue() { - return this.jsiiGet("value", java.lang.String.class); - } - /** - * Jsdocs for static property. - */ - public final static java.lang.String FOO; /** * Constants may also use all-caps. */ public final static java.lang.Number BAR; + public final static software.amazon.jsii.tests.calculator.DoubleTrouble CONST_OBJ; + /** + * Jsdocs for static property. + */ + public final static java.lang.String FOO; /** * Constants can also use camelCase. */ @@ -59,5 +59,7 @@ public static java.lang.Number getNonConstStatic() { public static void setNonConstStatic(final java.lang.Number value) { software.amazon.jsii.JsiiObject.jsiiStaticSet(software.amazon.jsii.tests.calculator.Statics.class, "nonConstStatic", java.util.Objects.requireNonNull(value, "nonConstStatic is required")); } - public final static software.amazon.jsii.tests.calculator.DoubleTrouble CONST_OBJ; + public java.lang.String getValue() { + return this.jsiiGet("value", java.lang.String.class); + } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StringEnum.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StringEnum.java index f1ac3e21f4..2e0bf63b36 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StringEnum.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/StringEnum.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.StringEnum") public enum StringEnum { A, diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Sum.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Sum.java index 6ce1ac6153..82254a7fde 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Sum.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Sum.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator; + /** * An operation that sums multiple values. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.Sum") public class Sum extends software.amazon.jsii.tests.calculator.composition.CompositeOperation { protected Sum(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -11,6 +13,13 @@ public Sum() { super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); } + /** + * The expression that this operation consists of. + * Must be implemented by derived classes. + */ + public software.amazon.jsii.tests.calculator.lib.Value getExpression() { + return this.jsiiGet("expression", software.amazon.jsii.tests.calculator.lib.Value.class); + } /** * The parts to sum. */ @@ -23,11 +32,4 @@ public java.util.List getParts( public void setParts(final java.util.List value) { this.jsiiSet("parts", java.util.Objects.requireNonNull(value, "parts is required")); } - /** - * The expression that this operation consists of. - * Must be implemented by derived classes. - */ - public software.amazon.jsii.tests.calculator.lib.Value getExpression() { - return this.jsiiGet("expression", software.amazon.jsii.tests.calculator.lib.Value.class); - } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/SyncVirtualMethods.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/SyncVirtualMethods.java index 921c1151a7..671884ad61 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/SyncVirtualMethods.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/SyncVirtualMethods.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.SyncVirtualMethods") public class SyncVirtualMethods extends software.amazon.jsii.JsiiObject { protected SyncVirtualMethods(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -8,67 +10,67 @@ public SyncVirtualMethods() { super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); } - public java.lang.Number callerIsMethod() { - return this.jsiiCall("callerIsMethod", java.lang.Number.class); - } public java.lang.Number callerIsAsync() { return this.jsiiAsyncCall("callerIsAsync", java.lang.Number.class); } - public java.lang.Number virtualMethod(final java.lang.Number n) { - return this.jsiiCall("virtualMethod", java.lang.Number.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(n, "n is required")).toArray()); + public java.lang.Number callerIsMethod() { + return this.jsiiCall("callerIsMethod", java.lang.Number.class); + } + public void modifyOtherProperty(final java.lang.String value) { + this.jsiiCall("modifyOtherProperty", Void.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(value, "value is required")).toArray()); } public void modifyValueOfTheProperty(final java.lang.String value) { this.jsiiCall("modifyValueOfTheProperty", Void.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(value, "value is required")).toArray()); } - public java.lang.String retrieveValueOfTheProperty() { - return this.jsiiCall("retrieveValueOfTheProperty", java.lang.String.class); + public java.lang.Number readA() { + return this.jsiiCall("readA", java.lang.Number.class); + } + public java.lang.String retrieveOtherProperty() { + return this.jsiiCall("retrieveOtherProperty", java.lang.String.class); } public java.lang.String retrieveReadOnlyProperty() { return this.jsiiCall("retrieveReadOnlyProperty", java.lang.String.class); } - public void modifyOtherProperty(final java.lang.String value) { - this.jsiiCall("modifyOtherProperty", Void.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(value, "value is required")).toArray()); - } - public java.lang.String retrieveOtherProperty() { - return this.jsiiCall("retrieveOtherProperty", java.lang.String.class); + public java.lang.String retrieveValueOfTheProperty() { + return this.jsiiCall("retrieveValueOfTheProperty", java.lang.String.class); } - public java.lang.Number readA() { - return this.jsiiCall("readA", java.lang.Number.class); + public java.lang.Number virtualMethod(final java.lang.Number n) { + return this.jsiiCall("virtualMethod", java.lang.Number.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(n, "n is required")).toArray()); } public void writeA(final java.lang.Number value) { this.jsiiCall("writeA", Void.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(value, "value is required")).toArray()); } + public java.lang.String getReadonlyProperty() { + return this.jsiiGet("readonlyProperty", java.lang.String.class); + } + public java.lang.Number getA() { + return this.jsiiGet("a", java.lang.Number.class); + } + public void setA(final java.lang.Number value) { + this.jsiiSet("a", java.util.Objects.requireNonNull(value, "a is required")); + } public java.lang.Number getCallerIsProperty() { return this.jsiiGet("callerIsProperty", java.lang.Number.class); } public void setCallerIsProperty(final java.lang.Number value) { this.jsiiSet("callerIsProperty", java.util.Objects.requireNonNull(value, "callerIsProperty is required")); } - public java.lang.String getTheProperty() { - return this.jsiiGet("theProperty", java.lang.String.class); - } - public void setTheProperty(final java.lang.String value) { - this.jsiiSet("theProperty", java.util.Objects.requireNonNull(value, "theProperty is required")); - } - public java.lang.String getReadonlyProperty() { - return this.jsiiGet("readonlyProperty", java.lang.String.class); - } public java.lang.String getOtherProperty() { return this.jsiiGet("otherProperty", java.lang.String.class); } public void setOtherProperty(final java.lang.String value) { this.jsiiSet("otherProperty", java.util.Objects.requireNonNull(value, "otherProperty is required")); } + public java.lang.String getTheProperty() { + return this.jsiiGet("theProperty", java.lang.String.class); + } + public void setTheProperty(final java.lang.String value) { + this.jsiiSet("theProperty", java.util.Objects.requireNonNull(value, "theProperty is required")); + } public java.lang.String getValueOfOtherProperty() { return this.jsiiGet("valueOfOtherProperty", java.lang.String.class); } public void setValueOfOtherProperty(final java.lang.String value) { this.jsiiSet("valueOfOtherProperty", java.util.Objects.requireNonNull(value, "valueOfOtherProperty is required")); } - public java.lang.Number getA() { - return this.jsiiGet("a", java.lang.Number.class); - } - public void setA(final java.lang.Number value) { - this.jsiiSet("a", java.util.Objects.requireNonNull(value, "a is required")); - } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Thrower.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Thrower.java index b6f823bb28..236454bc98 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Thrower.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/Thrower.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.Thrower") public class Thrower extends software.amazon.jsii.JsiiObject { protected Thrower(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UnaryOperation.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UnaryOperation.java index c8932de16c..e7a44798e4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UnaryOperation.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UnaryOperation.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator; + /** * An operation on a single operand. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.UnaryOperation") public abstract class UnaryOperation extends software.amazon.jsii.tests.calculator.lib.Operation { protected UnaryOperation(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UnionProperties.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UnionProperties.java index 63ad41f2e3..46ec1e090d 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UnionProperties.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UnionProperties.java @@ -1,131 +1,133 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") public interface UnionProperties extends software.amazon.jsii.JsiiSerializable { + java.lang.Object getBar(); java.lang.Object getFoo(); void setFoo(final java.lang.String value); void setFoo(final java.lang.Number value); - java.lang.Object getBar(); - - // ================================================================== - // Builder - // ================================================================== + /** + * @return a {@link Builder} of {@link UnionProperties} + */ static Builder builder() { return new Builder(); } + /** - * A fluent step builder class for {@link UnionProperties}. - * The {@link Build#build()} method will be available once all required properties are fulfilled. + * A builder for {@link UnionProperties} */ final class Builder { - public Build withBar(final java.lang.String value) { - return new FullBuilder().withBar(value); + private java.lang.Object _bar; + @javax.annotation.Nullable + private java.lang.Object _foo; + + /** + * Sets the value of Bar + * @param value the value to be set + * @return {@code this} + */ + public Builder withBar(final java.lang.String value) { + this._bar = java.util.Objects.requireNonNull(value, "bar is required"); + return this; } - public Build withBar(final java.lang.Number value) { - return new FullBuilder().withBar(value); + /** + * Sets the value of Bar + * @param value the value to be set + * @return {@code this} + */ + public Builder withBar(final java.lang.Number value) { + this._bar = java.util.Objects.requireNonNull(value, "bar is required"); + return this; } - public Build withBar(final software.amazon.jsii.tests.calculator.AllTypes value) { - return new FullBuilder().withBar(value); + /** + * Sets the value of Bar + * @param value the value to be set + * @return {@code this} + */ + public Builder withBar(final software.amazon.jsii.tests.calculator.AllTypes value) { + this._bar = java.util.Objects.requireNonNull(value, "bar is required"); + return this; } - - public interface Build { - /** - * @return a new {@link UnionProperties} object, initialized with the values set on this builder. - */ - UnionProperties build(); - /** - * Sets the value for {@link UnionProperties#getFoo}. - */ - Build withFoo(final java.lang.String value); - /** - * Sets the value for {@link UnionProperties#getFoo}. - */ - Build withFoo(final java.lang.Number value); + /** + * Sets the value of Foo + * @param value the value to be set + * @return {@code this} + */ + public Builder withFoo(@javax.annotation.Nullable final java.lang.String value) { + this._foo = value; + return this; } - - final class FullBuilder implements Build { - - private Jsii$Pojo instance = new Jsii$Pojo(); - - public Build withFoo(final java.lang.String value) { - this.instance._foo = value; - return this; - } - public Build withFoo(final java.lang.Number value) { - this.instance._foo = value; - return this; - } - public Build withBar(final java.lang.String value) { - java.util.Objects.requireNonNull(value, "UnionProperties#bar is required"); - this.instance._bar = value; - return this; - } - public Build withBar(final java.lang.Number value) { - java.util.Objects.requireNonNull(value, "UnionProperties#bar is required"); - this.instance._bar = value; - return this; - } - public Build withBar(final software.amazon.jsii.tests.calculator.AllTypes value) { - java.util.Objects.requireNonNull(value, "UnionProperties#bar is required"); - this.instance._bar = value; - return this; - } - public UnionProperties build() { - UnionProperties result = this.instance; - this.instance = new Jsii$Pojo(); - return result; - } + /** + * Sets the value of Foo + * @param value the value to be set + * @return {@code this} + */ + public Builder withFoo(@javax.annotation.Nullable final java.lang.Number value) { + this._foo = value; + return this; } - } - - /** - * A PoJo (plain-old-java-object) class that implements {@link UnionProperties}. - */ - final class Jsii$Pojo implements UnionProperties { /** - * Constructor used by builders. + * Builds the configured instance. + * @return a new instance of {@link UnionProperties} + * @throws NullPointerException if any required attribute was not provided */ - protected Jsii$Pojo() { } + public UnionProperties build() { + return new UnionProperties() { + private final java.lang.Object bar = java.util.Objects.requireNonNull(_bar, "bar is required"); + @javax.annotation.Nullable + private java.lang.Object foo = _foo; + @Override + public java.lang.Object getBar() { + return this.bar; + } - protected java.lang.Object _foo; + @Override + public java.lang.Object getFoo() { + return this.foo; + } - public java.lang.Object getFoo() { - return this._foo; - } - public void setFoo(final java.lang.String value) { - this._foo = value; - } - public void setFoo(final java.lang.Number value) { - this._foo = value; - } + @Override + public void setFoo(@javax.annotation.Nullable final java.lang.String value) { + this.foo = value; + } - protected java.lang.Object _bar; + @Override + public void setFoo(@javax.annotation.Nullable final java.lang.Number value) { + this.foo = value; + } - public java.lang.Object getBar() { - return this._bar; + }; } } /** * A proxy class which for javascript object literal which adhere to this interface. */ - class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.UnionProperties { + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.UnionProperties { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } + + @Override + public java.lang.Object getBar() { + return this.jsiiGet("bar", java.lang.Object.class); + } + + @Override @javax.annotation.Nullable public java.lang.Object getFoo() { return this.jsiiGet("foo", java.lang.Object.class); } + @Override public void setFoo(@javax.annotation.Nullable final java.lang.String value) { this.jsiiSet("foo", value); } + @Override public void setFoo(@javax.annotation.Nullable final java.lang.Number value) { this.jsiiSet("foo", value); } - public java.lang.Object getBar() { - return this.jsiiGet("bar", java.lang.Object.class); - } } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UseBundledDependency.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UseBundledDependency.java index ee9a0e2e81..636dfcd7b4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UseBundledDependency.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UseBundledDependency.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.UseBundledDependency") public class UseBundledDependency extends software.amazon.jsii.JsiiObject { protected UseBundledDependency(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UseCalcBase.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UseCalcBase.java index 7e832ebad5..3394f6e099 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UseCalcBase.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UseCalcBase.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator; + /** * Depend on a type from jsii-calc-base as a test for awslabs/jsii#128 */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.UseCalcBase") public class UseCalcBase extends software.amazon.jsii.JsiiObject { protected UseCalcBase(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UsesInterfaceWithProperties.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UsesInterfaceWithProperties.java index 72443afc68..a54f861934 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UsesInterfaceWithProperties.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UsesInterfaceWithProperties.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.UsesInterfaceWithProperties") public class UsesInterfaceWithProperties extends software.amazon.jsii.JsiiObject { protected UsesInterfaceWithProperties(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -11,12 +13,12 @@ public UsesInterfaceWithProperties(final software.amazon.jsii.tests.calculator.I public java.lang.String justRead() { return this.jsiiCall("justRead", java.lang.String.class); } - public java.lang.String writeAndRead(final java.lang.String value) { - return this.jsiiCall("writeAndRead", java.lang.String.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(value, "value is required")).toArray()); - } public java.lang.String readStringAndNumber(final software.amazon.jsii.tests.calculator.IInterfaceWithPropertiesExtension ext) { return this.jsiiCall("readStringAndNumber", java.lang.String.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(ext, "ext is required")).toArray()); } + public java.lang.String writeAndRead(final java.lang.String value) { + return this.jsiiCall("writeAndRead", java.lang.String.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(value, "value is required")).toArray()); + } public software.amazon.jsii.tests.calculator.IInterfaceWithProperties getObj() { return this.jsiiGet("obj", software.amazon.jsii.tests.calculator.IInterfaceWithProperties.class); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/VariadicMethod.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/VariadicMethod.java index c6d34b645d..7b7ab2e7b6 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/VariadicMethod.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/VariadicMethod.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.VariadicMethod") public class VariadicMethod extends software.amazon.jsii.JsiiObject { protected VariadicMethod(final software.amazon.jsii.JsiiObject.InitializationMode mode) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/VirtualMethodPlayground.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/VirtualMethodPlayground.java index 0012fc26ba..0a0b0b6d58 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/VirtualMethodPlayground.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/VirtualMethodPlayground.java @@ -1,4 +1,6 @@ package software.amazon.jsii.tests.calculator; + +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.VirtualMethodPlayground") public class VirtualMethodPlayground extends software.amazon.jsii.JsiiObject { protected VirtualMethodPlayground(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -8,19 +10,19 @@ public VirtualMethodPlayground() { super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); } - public java.lang.Number serialSumAsync(final java.lang.Number count) { - return this.jsiiAsyncCall("serialSumAsync", java.lang.Number.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(count, "count is required")).toArray()); + public java.lang.Number overrideMeAsync(final java.lang.Number index) { + return this.jsiiAsyncCall("overrideMeAsync", java.lang.Number.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(index, "index is required")).toArray()); + } + public java.lang.Number overrideMeSync(final java.lang.Number index) { + return this.jsiiCall("overrideMeSync", java.lang.Number.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(index, "index is required")).toArray()); } public java.lang.Number parallelSumAsync(final java.lang.Number count) { return this.jsiiAsyncCall("parallelSumAsync", java.lang.Number.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(count, "count is required")).toArray()); } + public java.lang.Number serialSumAsync(final java.lang.Number count) { + return this.jsiiAsyncCall("serialSumAsync", java.lang.Number.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(count, "count is required")).toArray()); + } public java.lang.Number sumSync(final java.lang.Number count) { return this.jsiiCall("sumSync", java.lang.Number.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(count, "count is required")).toArray()); } - public java.lang.Number overrideMeAsync(final java.lang.Number index) { - return this.jsiiAsyncCall("overrideMeAsync", java.lang.Number.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(index, "index is required")).toArray()); - } - public java.lang.Number overrideMeSync(final java.lang.Number index) { - return this.jsiiCall("overrideMeSync", java.lang.Number.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(index, "index is required")).toArray()); - } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/composition/CompositeOperation.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/composition/CompositeOperation.java index e3f852d4cd..c3d2ce3d2e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/composition/CompositeOperation.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/composition/CompositeOperation.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator.composition; + /** * Abstract operation composed from an expression of other operations. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.composition.CompositeOperation") public abstract class CompositeOperation extends software.amazon.jsii.tests.calculator.lib.Operation { protected CompositeOperation(final software.amazon.jsii.JsiiObject.InitializationMode mode) { @@ -14,28 +16,17 @@ public java.lang.String toString() { return this.jsiiCall("toString", java.lang.String.class); } /** - * The .toString() style. - */ - public software.amazon.jsii.tests.calculator.composition.CompositionStringStyle getStringStyle() { - return this.jsiiGet("stringStyle", software.amazon.jsii.tests.calculator.composition.CompositionStringStyle.class); - } - /** - * The .toString() style. - */ - public void setStringStyle(final software.amazon.jsii.tests.calculator.composition.CompositionStringStyle value) { - this.jsiiSet("stringStyle", java.util.Objects.requireNonNull(value, "stringStyle is required")); - } - /** - * A set of prefixes to include in a decorated .toString(). + * The expression that this operation consists of. + * Must be implemented by derived classes. */ - public java.util.List getDecorationPrefixes() { - return this.jsiiGet("decorationPrefixes", java.util.List.class); + public software.amazon.jsii.tests.calculator.lib.Value getExpression() { + return this.jsiiGet("expression", software.amazon.jsii.tests.calculator.lib.Value.class); } /** - * A set of prefixes to include in a decorated .toString(). + * The value. */ - public void setDecorationPrefixes(final java.util.List value) { - this.jsiiSet("decorationPrefixes", java.util.Objects.requireNonNull(value, "decorationPrefixes is required")); + public java.lang.Number getValue() { + return this.jsiiGet("value", java.lang.Number.class); } /** * A set of postfixes to include in a decorated .toString(). @@ -50,16 +41,27 @@ public void setDecorationPostfixes(final java.util.List value) this.jsiiSet("decorationPostfixes", java.util.Objects.requireNonNull(value, "decorationPostfixes is required")); } /** - * The value. + * A set of prefixes to include in a decorated .toString(). */ - public java.lang.Number getValue() { - return this.jsiiGet("value", java.lang.Number.class); + public java.util.List getDecorationPrefixes() { + return this.jsiiGet("decorationPrefixes", java.util.List.class); } /** - * The expression that this operation consists of. - * Must be implemented by derived classes. + * A set of prefixes to include in a decorated .toString(). */ - public software.amazon.jsii.tests.calculator.lib.Value getExpression() { - return this.jsiiGet("expression", software.amazon.jsii.tests.calculator.lib.Value.class); + public void setDecorationPrefixes(final java.util.List value) { + this.jsiiSet("decorationPrefixes", java.util.Objects.requireNonNull(value, "decorationPrefixes is required")); + } + /** + * The .toString() style. + */ + public software.amazon.jsii.tests.calculator.composition.CompositionStringStyle getStringStyle() { + return this.jsiiGet("stringStyle", software.amazon.jsii.tests.calculator.composition.CompositionStringStyle.class); + } + /** + * The .toString() style. + */ + public void setStringStyle(final software.amazon.jsii.tests.calculator.composition.CompositionStringStyle value) { + this.jsiiSet("stringStyle", java.util.Objects.requireNonNull(value, "stringStyle is required")); } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/composition/CompositionStringStyle.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/composition/CompositionStringStyle.java index 37bfbfffcf..d013d559aa 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/composition/CompositionStringStyle.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/composition/CompositionStringStyle.java @@ -1,7 +1,9 @@ package software.amazon.jsii.tests.calculator.composition; + /** * Style of .toString() output for CompositeOperation. */ +@javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.composition.CompositionStringStyle") public enum CompositionStringStyle { Normal, diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst b/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst index ef3c867005..ae1765d3e1 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst +++ b/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst @@ -184,19 +184,34 @@ AllTypes :rtype: :py:class:`~jsii-calc.StringEnum` - .. py:attribute:: booleanProperty + .. py:attribute:: enumPropertyValue - :type: boolean + :type: number *(readonly)* - .. py:attribute:: stringProperty + .. py:attribute:: anyArrayProperty + + :type: any + + + .. py:attribute:: anyMapProperty + + :type: any + + + .. py:attribute:: anyProperty + + :type: any + + + .. py:attribute:: arrayProperty :type: string - .. py:attribute:: numberProperty + .. py:attribute:: booleanProperty - :type: number + :type: boolean .. py:attribute:: dateProperty @@ -204,6 +219,11 @@ AllTypes :type: date + .. py:attribute:: enumProperty + + :type: :py:class:`~jsii-calc.AllTypesEnum` + + .. py:attribute:: jsonProperty :type: json @@ -214,29 +234,29 @@ AllTypes :type: number - .. py:attribute:: arrayProperty + .. py:attribute:: numberProperty - :type: string + :type: number - .. py:attribute:: anyProperty + .. py:attribute:: stringProperty - :type: any + :type: string - .. py:attribute:: anyArrayProperty + .. py:attribute:: unionArrayProperty - :type: any + :type: number or :py:class:`~jsii-calc.composition.CompositeOperation` - .. py:attribute:: anyMapProperty + .. py:attribute:: unionMapProperty - :type: any + :type: string or number - .. py:attribute:: unknownProperty + .. py:attribute:: unionProperty - :type: any + :type: string or number or :py:class:`~jsii-calc.Multiply` .. py:attribute:: unknownArrayProperty @@ -249,19 +269,9 @@ AllTypes :type: any - .. py:attribute:: unionProperty - - :type: string or number or :py:class:`~jsii-calc.Multiply` - - - .. py:attribute:: unionArrayProperty - - :type: number or :py:class:`~jsii-calc.composition.CompositeOperation` - - - .. py:attribute:: unionMapProperty + .. py:attribute:: unknownProperty - :type: string or number + :type: any .. py:attribute:: optionalEnumValue @@ -269,16 +279,6 @@ AllTypes :type: :py:class:`~jsii-calc.StringEnum` or undefined - .. py:attribute:: enumProperty - - :type: :py:class:`~jsii-calc.AllTypesEnum` - - - .. py:attribute:: enumPropertyValue - - :type: number *(readonly)* - - AllTypesEnum (enum) ^^^^^^^^^^^^^^^^^^^ @@ -333,16 +333,6 @@ AllowedMethodNames - .. py:method:: getFoo(withParam) -> string - - getXxx() is not allowed (see negatives), but getXxx(a, ...) is okay. - - - :param withParam: - :type withParam: string - :rtype: string - - .. py:method:: getBar(_p1, _p2) :param _p1: @@ -351,25 +341,35 @@ AllowedMethodNames :type _p2: number - .. py:method:: setFoo(_x, _y) + .. py:method:: getFoo(withParam) -> string - setFoo(x) is not allowed (see negatives), but setXxx(a, b, ...) is okay. + getXxx() is not allowed (see negatives), but getXxx(a, ...) is okay. + + + :param withParam: + :type withParam: string + :rtype: string + .. py:method:: setBar(_x, _y, _z) + :param _x: :type _x: string :param _y: :type _y: number + :param _z: + :type _z: boolean - .. py:method:: setBar(_x, _y, _z) + .. py:method:: setFoo(_x, _y) + + setFoo(x) is not allowed (see negatives), but setXxx(a, b, ...) is okay. + :param _x: :type _x: string :param _y: :type _y: number - :param _z: - :type _z: boolean AsyncVirtualMethods @@ -401,35 +401,35 @@ AsyncVirtualMethods :rtype: number - .. py:method:: overrideMe(mult) -> number - - :param mult: - :type mult: number - :rtype: number + .. py:method:: callMe2() -> number + Just calls "overrideMeToo" - .. py:method:: overrideMeToo() -> number :rtype: number - .. py:method:: callMe2() -> number + .. py:method:: callMeDoublePromise() -> number - Just calls "overrideMeToo" + This method calls the "callMe" async method indirectly, which will then invoke a virtual method. This is a "double promise" situation, which means that callbacks are not going to be available immediate, but only after an "immediates" cycle. :rtype: number - .. py:method:: callMeDoublePromise() -> number + .. py:method:: dontOverrideMe() -> number + + :rtype: number - This method calls the "callMe" async method indirectly, which will then invoke a virtual method. This is a "double promise" situation, which means that callbacks are not going to be available immediate, but only after an "immediates" cycle. + .. py:method:: overrideMe(mult) -> number + :param mult: + :type mult: number :rtype: number - .. py:method:: dontOverrideMe() -> number + .. py:method:: overrideMeToo() -> number :rtype: number @@ -540,20 +540,20 @@ Calculator :type value: number - .. py:method:: pow(value) + .. py:method:: neg() - Raises the current value by a power. + Negates the current value. - :param value: - :type value: number - .. py:method:: neg() + .. py:method:: pow(value) - Negates the current value. + Raises the current value by a power. + :param value: + :type value: number .. py:method:: readUnionValue() -> number @@ -564,44 +564,44 @@ Calculator :rtype: number - .. py:attribute:: curr + .. py:attribute:: expression - The current value. + Returns the expression. - :type: :py:class:`@scope/jsii-calc-lib.Value` + :type: :py:class:`@scope/jsii-calc-lib.Value` *(readonly)* - .. py:attribute:: operationsMap + .. py:attribute:: operationsLog - A map of per operation name of all operations performed. + A log of all operations. :type: :py:class:`@scope/jsii-calc-lib.Value` *(readonly)* - .. py:attribute:: operationsLog + .. py:attribute:: operationsMap - A log of all operations. + A map of per operation name of all operations performed. :type: :py:class:`@scope/jsii-calc-lib.Value` *(readonly)* - .. py:attribute:: maxValue + .. py:attribute:: curr - The maximum value allows in this calculator. + The current value. - :type: number or undefined + :type: :py:class:`@scope/jsii-calc-lib.Value` - .. py:attribute:: expression + .. py:attribute:: maxValue - Returns the expression. + The maximum value allows in this calculator. - :type: :py:class:`@scope/jsii-calc-lib.Value` *(readonly)* + :type: number or undefined .. py:attribute:: unionProperty @@ -741,12 +741,9 @@ DerivedStruct (interface) :extends: :py:class:`@scope/jsii-calc-lib.MyFirstStruct` - .. py:attribute:: nonPrimitive - - An example of a non primitive property. - + .. py:attribute:: anotherRequired - :type: :py:class:`~jsii-calc.DoubleTrouble` + :type: date .. py:attribute:: bool @@ -754,14 +751,12 @@ DerivedStruct (interface) :type: boolean - .. py:attribute:: anotherRequired - - :type: date + .. py:attribute:: nonPrimitive + An example of a non primitive property. - .. py:attribute:: optionalArray - :type: string or undefined + :type: :py:class:`~jsii-calc.DoubleTrouble` .. py:attribute:: anotherOptional @@ -772,6 +767,11 @@ DerivedStruct (interface) :type: :py:class:`@scope/jsii-calc-lib.Value` or undefined + .. py:attribute:: optionalArray + + :type: string or undefined + + DoubleTrouble ^^^^^^^^^^^^^ @@ -797,20 +797,20 @@ DoubleTrouble :implements: :py:class:`~jsii-calc.IFriendlyRandomGenerator` - .. py:method:: next() -> number + .. py:method:: hello() -> string - Returns another random number. + Say hello! - :rtype: number + :rtype: string - .. py:method:: hello() -> string + .. py:method:: next() -> number - Say hello! + Returns another random number. - :rtype: string + :rtype: number GiveMeStructs @@ -837,14 +837,14 @@ GiveMeStructs - .. py:method:: readFirstNumber(first) -> number + .. py:method:: derivedToFirst(derived) -> @scope/jsii-calc-lib.MyFirstStruct - Returns the "anumber" from a MyFirstStruct struct; + Accepts a struct of type DerivedStruct and returns a struct of type FirstStruct. - :param first: - :type first: :py:class:`@scope/jsii-calc-lib.MyFirstStruct` - :rtype: number + :param derived: + :type derived: :py:class:`~jsii-calc.DerivedStruct` + :rtype: :py:class:`@scope/jsii-calc-lib.MyFirstStruct` .. py:method:: readDerivedNonPrimitive(derived) -> jsii-calc.DoubleTrouble @@ -857,14 +857,14 @@ GiveMeStructs :rtype: :py:class:`~jsii-calc.DoubleTrouble` - .. py:method:: derivedToFirst(derived) -> @scope/jsii-calc-lib.MyFirstStruct + .. py:method:: readFirstNumber(first) -> number - Accepts a struct of type DerivedStruct and returns a struct of type FirstStruct. + Returns the "anumber" from a MyFirstStruct struct; - :param derived: - :type derived: :py:class:`~jsii-calc.DerivedStruct` - :rtype: :py:class:`@scope/jsii-calc-lib.MyFirstStruct` + :param first: + :type first: :py:class:`@scope/jsii-calc-lib.MyFirstStruct` + :rtype: number .. py:attribute:: structLiteral @@ -901,20 +901,20 @@ IFriendlier (interface) :extends: :py:class:`@scope/jsii-calc-lib.IFriendly` - .. py:method:: goodbye() -> string + .. py:method:: farewell() -> string - Say goodbye. + Say farewell. - :return: A goodbye blessing. :rtype: string - .. py:method:: farewell() -> string + .. py:method:: goodbye() -> string - Say farewell. + Say goodbye. + :return: A goodbye blessing. :rtype: string @@ -1248,11 +1248,11 @@ JavaReservedWords - .. py:method:: double() + .. py:method:: do() - .. py:method:: do() + .. py:method:: double() @@ -1447,9 +1447,9 @@ Multiply :param rhs: Right-hand side operand :type rhs: :py:class:`@scope/jsii-calc-lib.Value` - .. py:method:: toString() -> string + .. py:method:: farewell() -> string - String representation of the value. + Say farewell. :rtype: string @@ -1463,20 +1463,20 @@ Multiply :rtype: string - .. py:method:: farewell() -> string + .. py:method:: next() -> number - Say farewell. + Returns another random number. - :rtype: string + :rtype: number - .. py:method:: next() -> number + .. py:method:: toString() -> string - Returns another random number. + String representation of the value. - :rtype: number + :rtype: string .. py:attribute:: value @@ -1518,33 +1518,33 @@ Negate :param operand: :type operand: :py:class:`@scope/jsii-calc-lib.Value` - .. py:method:: toString() -> string + .. py:method:: farewell() -> string - String representation of the value. + Say farewell. :rtype: string - .. py:method:: hello() -> string + .. py:method:: goodbye() -> string - Say hello! + Say goodbye. :rtype: string - .. py:method:: goodbye() -> string + .. py:method:: hello() -> string - Say goodbye. + Say hello! :rtype: string - .. py:method:: farewell() -> string + .. py:method:: toString() -> string - Say farewell. + String representation of the value. :rtype: string @@ -1585,30 +1585,30 @@ NodeStandardLibrary - .. py:method:: fsReadFile() -> string + .. py:method:: cryptoSha256() -> string - Reads a local resource file (resource.txt) asynchronously. + Uses node.js "crypto" module to calculate sha256 of a string. - :return: "Hello, resource!" + :return: "6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50" :rtype: string - .. py:method:: fsReadFileSync() -> string + .. py:method:: fsReadFile() -> string - Sync version of fsReadFile. + Reads a local resource file (resource.txt) asynchronously. - :return: "Hello, resource! SYNC!" + :return: "Hello, resource!" :rtype: string - .. py:method:: cryptoSha256() -> string + .. py:method:: fsReadFileSync() -> string - Uses node.js "crypto" module to calculate sha256 of a string. + Sync version of fsReadFile. - :return: "6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50" + :return: "Hello, resource! SYNC!" :rtype: string @@ -1649,11 +1649,6 @@ NumberGenerator :param generator: :type generator: :py:class:`~jsii-calc.IRandomNumberGenerator` - .. py:method:: nextTimes100() -> number - - :rtype: number - - .. py:method:: isSameGenerator(gen) -> boolean :param gen: @@ -1661,6 +1656,11 @@ NumberGenerator :rtype: boolean + .. py:method:: nextTimes100() -> number + + :rtype: number + + .. py:attribute:: generator :type: :py:class:`~jsii-calc.IRandomNumberGenerator` @@ -1815,17 +1815,17 @@ Power :type: :py:class:`@scope/jsii-calc-lib.Value` *(readonly)* - .. py:attribute:: pow + .. py:attribute:: expression - The number of times to multiply + The expression that this operation consists of. Must be implemented by derived classes. :type: :py:class:`@scope/jsii-calc-lib.Value` *(readonly)* - .. py:attribute:: expression + .. py:attribute:: pow - The expression that this operation consists of. Must be implemented by derived classes. + The number of times to multiply :type: :py:class:`@scope/jsii-calc-lib.Value` *(readonly)* @@ -1987,25 +1987,25 @@ Statics :rtype: string - .. py:attribute:: value + .. py:attribute:: BAR - :type: string *(readonly)* + Constants may also use all-caps. - .. py:attribute:: Foo + :type: number *(readonly)* *(static)* - Jsdocs for static property. + .. py:attribute:: ConstObj - :type: string *(readonly)* *(static)* + :type: :py:class:`~jsii-calc.DoubleTrouble` *(readonly)* *(static)* - .. py:attribute:: BAR + .. py:attribute:: Foo - Constants may also use all-caps. + Jsdocs for static property. - :type: number *(readonly)* *(static)* + :type: string *(readonly)* *(static)* .. py:attribute:: zooBar @@ -2029,9 +2029,9 @@ Statics :type: number *(static)* - .. py:attribute:: ConstObj + .. py:attribute:: value - :type: :py:class:`~jsii-calc.DoubleTrouble` *(readonly)* *(static)* + :type: string *(readonly)* StringEnum (enum) @@ -2092,20 +2092,20 @@ Sum :extends: :py:class:`~jsii-calc.composition.CompositeOperation` - .. py:attribute:: parts + .. py:attribute:: expression - The parts to sum. + The expression that this operation consists of. Must be implemented by derived classes. - :type: :py:class:`@scope/jsii-calc-lib.Value` + :type: :py:class:`@scope/jsii-calc-lib.Value` *(readonly)* - .. py:attribute:: expression + .. py:attribute:: parts - The expression that this operation consists of. Must be implemented by derived classes. + The parts to sum. - :type: :py:class:`@scope/jsii-calc-lib.Value` *(readonly)* + :type: :py:class:`@scope/jsii-calc-lib.Value` SyncVirtualMethods @@ -2132,21 +2132,20 @@ SyncVirtualMethods - .. py:method:: callerIsMethod() -> number + .. py:method:: callerIsAsync() -> number :rtype: number - .. py:method:: callerIsAsync() -> number + .. py:method:: callerIsMethod() -> number :rtype: number - .. py:method:: virtualMethod(n) -> number + .. py:method:: modifyOtherProperty(value) - :param n: - :type n: number - :rtype: number + :param value: + :type value: string .. py:method:: modifyValueOfTheProperty(value) @@ -2155,29 +2154,30 @@ SyncVirtualMethods :type value: string - .. py:method:: retrieveValueOfTheProperty() -> string + .. py:method:: readA() -> number - :rtype: string + :rtype: number - .. py:method:: retrieveReadOnlyProperty() -> string + .. py:method:: retrieveOtherProperty() -> string :rtype: string - .. py:method:: modifyOtherProperty(value) + .. py:method:: retrieveReadOnlyProperty() -> string - :param value: - :type value: string + :rtype: string - .. py:method:: retrieveOtherProperty() -> string + .. py:method:: retrieveValueOfTheProperty() -> string :rtype: string - .. py:method:: readA() -> number + .. py:method:: virtualMethod(n) -> number + :param n: + :type n: number :rtype: number @@ -2187,19 +2187,19 @@ SyncVirtualMethods :type value: number - .. py:attribute:: callerIsProperty + .. py:attribute:: readonlyProperty - :type: number + :type: string *(readonly)* - .. py:attribute:: theProperty + .. py:attribute:: a - :type: string + :type: number - .. py:attribute:: readonlyProperty + .. py:attribute:: callerIsProperty - :type: string *(readonly)* + :type: number .. py:attribute:: otherProperty @@ -2207,14 +2207,14 @@ SyncVirtualMethods :type: string - .. py:attribute:: valueOfOtherProperty + .. py:attribute:: theProperty :type: string - .. py:attribute:: a + .. py:attribute:: valueOfOtherProperty - :type: number + :type: string Thrower @@ -2306,14 +2306,14 @@ UnionProperties (interface) - .. py:attribute:: foo + .. py:attribute:: bar - :type: string or number or undefined + :type: string or number or :py:class:`~jsii-calc.AllTypes` *(readonly)* - .. py:attribute:: bar + .. py:attribute:: foo - :type: string or number or :py:class:`~jsii-calc.AllTypes` *(readonly)* + :type: string or number or undefined UseBundledDependency @@ -2408,17 +2408,17 @@ UsesInterfaceWithProperties :rtype: string - .. py:method:: writeAndRead(value) -> string + .. py:method:: readStringAndNumber(ext) -> string - :param value: - :type value: string + :param ext: + :type ext: :py:class:`~jsii-calc.IInterfaceWithPropertiesExtension` :rtype: string - .. py:method:: readStringAndNumber(ext) -> string + .. py:method:: writeAndRead(value) -> string - :param ext: - :type ext: :py:class:`~jsii-calc.IInterfaceWithPropertiesExtension` + :param value: + :type value: string :rtype: string @@ -2486,38 +2486,38 @@ VirtualMethodPlayground - .. py:method:: serialSumAsync(count) -> number + .. py:method:: overrideMeAsync(index) -> number - :param count: - :type count: number + :param index: + :type index: number :rtype: number - .. py:method:: parallelSumAsync(count) -> number + .. py:method:: overrideMeSync(index) -> number - :param count: - :type count: number + :param index: + :type index: number :rtype: number - .. py:method:: sumSync(count) -> number + .. py:method:: parallelSumAsync(count) -> number :param count: :type count: number :rtype: number - .. py:method:: overrideMeAsync(index) -> number + .. py:method:: serialSumAsync(count) -> number - :param index: - :type index: number + :param count: + :type count: number :rtype: number - .. py:method:: overrideMeSync(index) -> number + .. py:method:: sumSync(count) -> number - :param index: - :type index: number + :param count: + :type count: number :rtype: number @@ -2563,20 +2563,20 @@ CompositeOperation :rtype: string - .. py:attribute:: stringStyle + .. py:attribute:: expression - The .toString() style. + The expression that this operation consists of. Must be implemented by derived classes. - :type: :py:class:`~jsii-calc.composition.CompositionStringStyle` + :type: :py:class:`@scope/jsii-calc-lib.Value` *(readonly)* *(abstract)* - .. py:attribute:: decorationPrefixes + .. py:attribute:: value - A set of prefixes to include in a decorated .toString(). + The value. - :type: string + :type: number *(readonly)* .. py:attribute:: decorationPostfixes @@ -2587,20 +2587,20 @@ CompositeOperation :type: string - .. py:attribute:: value + .. py:attribute:: decorationPrefixes - The value. + A set of prefixes to include in a decorated .toString(). - :type: number *(readonly)* + :type: string - .. py:attribute:: expression + .. py:attribute:: stringStyle - The expression that this operation consists of. Must be implemented by derived classes. + The .toString() style. - :type: :py:class:`@scope/jsii-calc-lib.Value` *(readonly)* *(abstract)* + :type: :py:class:`~jsii-calc.composition.CompositionStringStyle` CompositionStringStyle (enum) diff --git a/packages/jsii-pacmak/tsconfig.json b/packages/jsii-pacmak/tsconfig.json index 6f8f29cf64..8e56e59151 100644 --- a/packages/jsii-pacmak/tsconfig.json +++ b/packages/jsii-pacmak/tsconfig.json @@ -48,7 +48,19 @@ // "inlineSources": false, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ /* Experimental Options */ - "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */ + "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - } + "composite": true /* Allow this project to be referenced by others. */ + }, + "include": [ + "**/*.ts" + ], + "exclude": [ + "**/*.d.ts", + "node_modules" + ], + "references": [ + { "path": "../codemaker" }, + { "path": "../jsii-spec" } + ] } diff --git a/packages/jsii/lib/compiler.ts b/packages/jsii/lib/compiler.ts index 077137b638..feeb0a331b 100644 --- a/packages/jsii/lib/compiler.ts +++ b/packages/jsii/lib/compiler.ts @@ -95,20 +95,37 @@ export async function compilePackage(packageDir: string, includeDirs = [ 'test', return { ...sorted, fingerprint } as spec.Assembly; /** - * Sort members (aka Methods or Properties) so static members are listed before non-static members, and members - * of each group are listed in alphanumerical order. + * Sort members (aka Methods or Properties) so that: + * + * - static members are listed before non-static members + * - immutable properties are listed before mutable properties + * - required properties are listed before optional properties + * - members are listed alphanumarically sorted * * @param arr the elements to sort * * @return a sorted copy of ``arr``. */ - function _sortMembers(arr: T[]): T[] { + function _sortMembers(arr: T[]): T[] { return arr.sort((lval: T, rval: T) => { - const lstr = `${lval.static ? '0' : '1'}|${lval.name}`; - const rstr = `${rval.static ? '0' : '1'}|${rval.name}`; - return lstr.localeCompare(rstr); + return _comparable(lval).localeCompare(_comparable(rval)); }); + + function _comparable(val: T): string { + return [ + val.static ? '0' : '1', + val.immutable ? '0' : '1', + !(val.type && val.type.optional) ? '0' : '1', + val.name + ].join('|'); + } } + type ComparableMember = { + name?: string; + static?: boolean; + immutable?: boolean; + type?: { optional?: boolean; }; + }; } } From ba64a6dcfc7a09aca814a4ca529db929bd138f50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=91=A8=F0=9F=8F=BC=E2=80=8D=F0=9F=92=BB=20Romain=20M?= =?UTF-8?q?arcadier-Muller?= Date: Tue, 14 Aug 2018 19:23:19 +0200 Subject: [PATCH 4/4] Remove project references --- packages/codemaker/package.json | 4 +- packages/codemaker/tsconfig.json | 3 +- packages/jsii-pacmak/package.json | 4 +- packages/jsii-pacmak/tsconfig.json | 16 +------- packages/jsii-spec/package.json | 6 +-- packages/jsii-spec/tsconfig.json | 13 +----- packages/jsii/package.json | 6 +-- packages/jsii/test/tsconfig.json | 64 ------------------------------ packages/jsii/tsconfig.json | 16 +------- 9 files changed, 17 insertions(+), 115 deletions(-) delete mode 100644 packages/jsii/test/tsconfig.json diff --git a/packages/codemaker/package.json b/packages/codemaker/package.json index 43492a89c5..a1b81d5223 100644 --- a/packages/codemaker/package.json +++ b/packages/codemaker/package.json @@ -5,8 +5,8 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "build": "tsc -b", - "watch": "tsc -b -w", + "build": "tsc", + "watch": "tsc -w", "test": "nodeunit test/test.*.js", "package": "rm -fr dist/js && mkdir -p dist/js && mv $(npm pack) dist/js" }, diff --git a/packages/codemaker/tsconfig.json b/packages/codemaker/tsconfig.json index 501c3c7517..ad474280a6 100644 --- a/packages/codemaker/tsconfig.json +++ b/packages/codemaker/tsconfig.json @@ -12,7 +12,6 @@ "noUnusedLocals": true, /* Report errors on unused locals. */ "noUnusedParameters": true, /* Report errors on unused parameters. */ "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - "composite": true, /* Allow this project to be referenced by others. */ + "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */ } } diff --git a/packages/jsii-pacmak/package.json b/packages/jsii-pacmak/package.json index 46cf880d3e..5cebbdb95c 100644 --- a/packages/jsii-pacmak/package.json +++ b/packages/jsii-pacmak/package.json @@ -9,8 +9,8 @@ "types": "lib/index.d.ts", "scripts": { "gen": "/bin/bash generate.sh", - "build": "npm run gen && tsc -b && chmod +x bin/jsii-pacmak && tslint -p .", - "watch": "tsc -b -w", + "build": "npm run gen && tsc && chmod +x bin/jsii-pacmak && tslint -p .", + "watch": "tsc -w", "lint": "tslint -p . --force", "test": "/bin/bash test/diff-test.sh && /bin/bash test/build-test.sh", "package": "package-js" diff --git a/packages/jsii-pacmak/tsconfig.json b/packages/jsii-pacmak/tsconfig.json index 8e56e59151..6f8f29cf64 100644 --- a/packages/jsii-pacmak/tsconfig.json +++ b/packages/jsii-pacmak/tsconfig.json @@ -48,19 +48,7 @@ // "inlineSources": false, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ /* Experimental Options */ - "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - "composite": true /* Allow this project to be referenced by others. */ - }, - "include": [ - "**/*.ts" - ], - "exclude": [ - "**/*.d.ts", - "node_modules" - ], - "references": [ - { "path": "../codemaker" }, - { "path": "../jsii-spec" } - ] + } } diff --git a/packages/jsii-spec/package.json b/packages/jsii-spec/package.json index 474372aa5b..c4c3ee8069 100644 --- a/packages/jsii-spec/package.json +++ b/packages/jsii-spec/package.json @@ -5,9 +5,9 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch": "tsc -b -w", - "build": "tsc -b && bash generate-json-schema.sh", - "test": "tsc -b test && nodeunit test/test.*.js", + "watch": "tsc -w", + "build": "tsc && bash generate-json-schema.sh", + "test": "nodeunit test/test.*.js", "package": "package-js" }, "devDependencies": { diff --git a/packages/jsii-spec/tsconfig.json b/packages/jsii-spec/tsconfig.json index 9b1b0b8fe7..6f8f29cf64 100644 --- a/packages/jsii-spec/tsconfig.json +++ b/packages/jsii-spec/tsconfig.json @@ -48,16 +48,7 @@ // "inlineSources": false, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ /* Experimental Options */ - "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - "composite": true /* Allow the project to be referenced by others */ - }, - "include": [ - "**/*.ts" - ], - "exclude": [ - "**/*.d.ts", - "node_modules", - "test" - ] + } } diff --git a/packages/jsii/package.json b/packages/jsii/package.json index b84342017f..be92e8ebe1 100644 --- a/packages/jsii/package.json +++ b/packages/jsii/package.json @@ -8,9 +8,9 @@ "jsii": "bin/jsii" }, "scripts": { - "watch": "tsc -b -w", - "build": "/bin/bash generate.sh && tsc -b && chmod +x bin/jsii", - "test": "tsc -b test && nodeunit test/test.*.js", + "watch": "tsc -w", + "build": "/bin/bash generate.sh && tsc && chmod +x bin/jsii", + "test": "nodeunit test/test.*.js", "package": "package-js" }, "keywords": [ diff --git a/packages/jsii/test/tsconfig.json b/packages/jsii/test/tsconfig.json deleted file mode 100644 index 9a28d19195..0000000000 --- a/packages/jsii/test/tsconfig.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "compilerOptions": { - /* Basic Options */ - "target": "ES2018", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["es2016", "es2017.object", "es2017.string"], /* Specify library files to be included in the compilation: */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - "strictNullChecks": true, /* Enable strict null checks. */ - "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - "strictPropertyInitialization": false, /* DO NOT Raise error on class attribute not initialized by constructor. */ - - /* Additional Checks */ - "noUnusedLocals": true, /* Report errors on unused locals. */ - "noUnusedParameters": true, /* Report errors on unused parameters. */ - "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - - /* Source Map Options */ - // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ - "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - }, - "include": [ - "*.ts" - ], - "exclude": [ - "**/*.d.ts", - "negatives/neg.*.ts" - ], - "references": [ - { "path": "../" } - ] - } diff --git a/packages/jsii/tsconfig.json b/packages/jsii/tsconfig.json index 4df49bea79..907de24775 100644 --- a/packages/jsii/tsconfig.json +++ b/packages/jsii/tsconfig.json @@ -48,19 +48,7 @@ "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ /* Experimental Options */ - "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - "composite": true /* Allow this project to be referenced by others. */ - }, - "include": [ - "**/*.ts" - ], - "exclude": [ - "**/*.d.ts", - "node_modules", - "test" - ], - "references": [ - { "path": "../jsii-spec" } - ] + } }