diff --git a/packages/jsii-calc-base/test/assembly.jsii b/packages/jsii-calc-base/test/assembly.jsii index d9b4a575a4..c8e66971d3 100644 --- a/packages/jsii-calc-base/test/assembly.jsii +++ b/packages/jsii-calc-base/test/assembly.jsii @@ -73,7 +73,6 @@ }, "name": "typeName", "returns": { - "optional": true, "primitive": "any" } } @@ -103,5 +102,5 @@ } }, "version": "0.7.8", - "fingerprint": "K1rAUs6WiQ5lF08T46B8v/5UL8T8Ot59e0Nc8rh2jiQ=" + "fingerprint": "FbKHAP60R40tOOnvhCeDrZDrNlgzIypOfAdWPed+Jog=" } diff --git a/packages/jsii-calc/lib/compliance.ts b/packages/jsii-calc/lib/compliance.ts index 783a5a94cf..a0989493cc 100644 --- a/packages/jsii-calc/lib/compliance.ts +++ b/packages/jsii-calc/lib/compliance.ts @@ -939,3 +939,12 @@ export interface IInterfaceWithMethods { export interface IInterfaceThatShouldNotBeADataType extends IInterfaceWithMethods { readonly otherValue: string; } + +/** + * jsii#284: do not recognize "any" as an optional argument + */ +export class DoNotRecognizeAnyAsOptional { + public method(_requiredAny: any, _optionalAny?: any, _optionalString?: string) { + + } +} diff --git a/packages/jsii-calc/test/assembly.jsii b/packages/jsii-calc/test/assembly.jsii index 97e7a8e8a5..d245fa15e5 100644 --- a/packages/jsii-calc/test/assembly.jsii +++ b/packages/jsii-calc/test/assembly.jsii @@ -382,7 +382,6 @@ "type": { "collection": { "elementtype": { - "optional": true, "primitive": "any" }, "kind": "array" @@ -394,13 +393,18 @@ "type": { "collection": { "elementtype": { - "optional": true, "primitive": "any" }, "kind": "map" } } }, + { + "name": "anyProperty", + "type": { + "primitive": "any" + } + }, { "name": "arrayProperty", "type": { @@ -528,7 +532,6 @@ "type": { "collection": { "elementtype": { - "optional": true, "primitive": "any" }, "kind": "array" @@ -540,7 +543,6 @@ "type": { "collection": { "elementtype": { - "optional": true, "primitive": "any" }, "kind": "map" @@ -548,9 +550,8 @@ } }, { - "name": "anyProperty", + "name": "unknownProperty", "type": { - "optional": true, "primitive": "any" } }, @@ -560,13 +561,6 @@ "fqn": "jsii-calc.StringEnum", "optional": true } - }, - { - "name": "unknownProperty", - "type": { - "optional": true, - "primitive": "any" - } } ] }, @@ -1301,6 +1295,45 @@ ], "name": "DoNotOverridePrivates" }, + "jsii-calc.DoNotRecognizeAnyAsOptional": { + "assembly": "jsii-calc", + "docs": { + "comment": "jsii#284: do not recognize \"any\" as an optional argument" + }, + "fqn": "jsii-calc.DoNotRecognizeAnyAsOptional", + "initializer": { + "initializer": true + }, + "kind": "class", + "methods": [ + { + "name": "method", + "parameters": [ + { + "name": "_requiredAny", + "type": { + "primitive": "any" + } + }, + { + "name": "_optionalAny", + "type": { + "optional": true, + "primitive": "any" + } + }, + { + "name": "_optionalString", + "type": { + "optional": true, + "primitive": "string" + } + } + ] + } + ], + "name": "DoNotRecognizeAnyAsOptional" + }, "jsii-calc.DoubleTrouble": { "assembly": "jsii-calc", "fqn": "jsii-calc.DoubleTrouble", @@ -3062,7 +3095,6 @@ { "name": "value", "returns": { - "optional": true, "primitive": "any" } } @@ -3412,5 +3444,5 @@ } }, "version": "0.7.8", - "fingerprint": "Xn7Rk17rqR3AaMx3+ssxT0GR1sCWwz0OGC+C8QuLI3A=" + "fingerprint": "2BaszImarh4WChl9DFUcygfTpEfXU17fHQT2wgEptfM=" } diff --git a/packages/jsii-java-runtime-test/project/.gitignore b/packages/jsii-java-runtime-test/project/.gitignore index 58d35b13a4..46aa9ff1a5 100644 --- a/packages/jsii-java-runtime-test/project/.gitignore +++ b/packages/jsii-java-runtime-test/project/.gitignore @@ -1,3 +1,5 @@ +bin/ + !index.js .idea pom.xml diff --git a/packages/jsii-java-runtime/project/.gitignore b/packages/jsii-java-runtime/project/.gitignore index d0b519a66f..a6e9c72336 100644 --- a/packages/jsii-java-runtime/project/.gitignore +++ b/packages/jsii-java-runtime/project/.gitignore @@ -1,3 +1,5 @@ +bin/ + !index.js .idea pom.xml diff --git a/packages/jsii-pacmak/test/.gitignore b/packages/jsii-pacmak/test/.gitignore index 013c75f014..ad8d4b09f2 100644 --- a/packages/jsii-pacmak/test/.gitignore +++ b/packages/jsii-pacmak/test/.gitignore @@ -1,2 +1,4 @@ +**/java/bin/ + !*.tgz diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/.jsii index d9b4a575a4..c8e66971d3 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/.jsii @@ -73,7 +73,6 @@ }, "name": "typeName", "returns": { - "optional": true, "primitive": "any" } } @@ -103,5 +102,5 @@ } }, "version": "0.7.8", - "fingerprint": "K1rAUs6WiQ5lF08T46B8v/5UL8T8Ot59e0Nc8rh2jiQ=" + "fingerprint": "FbKHAP60R40tOOnvhCeDrZDrNlgzIypOfAdWPed+Jog=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/Base.cs b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/Base.cs index 83224daeac..c38472e6b3 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/Base.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/dotnet/Amazon.JSII.Tests.CalculatorPackageId.BasePackageId/Amazon/JSII/Tests/CalculatorNamespace/BaseNamespace/Base.cs @@ -19,7 +19,7 @@ protected Base(DeputyProps props): base(props) } /// the name of the class (to verify native type names are created for derived classes). - [JsiiMethod("typeName", "{\"primitive\":\"any\",\"optional\":true}", "[]")] + [JsiiMethod("typeName", "{\"primitive\":\"any\"}", "[]")] public virtual object TypeName() { return InvokeInstanceMethod(new object[]{}); 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 2b1a3402f8..7a64b8e3d7 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 @@ -13,7 +13,6 @@ protected Base(final software.amazon.jsii.JsiiObject.InitializationMode mode) { /** * @return the name of the class (to verify native type names are created for derived classes). */ - @javax.annotation.Nullable public java.lang.Object typeName() { return this.jsiiCall("typeName", java.lang.Object.class); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/sphinx/_scope_jsii-calc-base.rst b/packages/jsii-pacmak/test/expected.jsii-calc-base/sphinx/_scope_jsii-calc-base.rst index 006c87fdd1..f7c0678760 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/sphinx/_scope_jsii-calc-base.rst +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/sphinx/_scope_jsii-calc-base.rst @@ -158,7 +158,7 @@ Base .. py:method:: typeName() -> any :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any or ``undefined`` + :rtype: any BaseProps (interface) 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 0121d0e144..2e9437ce51 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 @@ -349,7 +349,7 @@ Number *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any or ``undefined`` + :rtype: any .. py:method:: toString() -> string @@ -411,7 +411,7 @@ Operation *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any or ``undefined`` + :rtype: any .. py:attribute:: value @@ -528,6 +528,6 @@ Value *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any or ``undefined`` + :rtype: any diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii index 97e7a8e8a5..d245fa15e5 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii @@ -382,7 +382,6 @@ "type": { "collection": { "elementtype": { - "optional": true, "primitive": "any" }, "kind": "array" @@ -394,13 +393,18 @@ "type": { "collection": { "elementtype": { - "optional": true, "primitive": "any" }, "kind": "map" } } }, + { + "name": "anyProperty", + "type": { + "primitive": "any" + } + }, { "name": "arrayProperty", "type": { @@ -528,7 +532,6 @@ "type": { "collection": { "elementtype": { - "optional": true, "primitive": "any" }, "kind": "array" @@ -540,7 +543,6 @@ "type": { "collection": { "elementtype": { - "optional": true, "primitive": "any" }, "kind": "map" @@ -548,9 +550,8 @@ } }, { - "name": "anyProperty", + "name": "unknownProperty", "type": { - "optional": true, "primitive": "any" } }, @@ -560,13 +561,6 @@ "fqn": "jsii-calc.StringEnum", "optional": true } - }, - { - "name": "unknownProperty", - "type": { - "optional": true, - "primitive": "any" - } } ] }, @@ -1301,6 +1295,45 @@ ], "name": "DoNotOverridePrivates" }, + "jsii-calc.DoNotRecognizeAnyAsOptional": { + "assembly": "jsii-calc", + "docs": { + "comment": "jsii#284: do not recognize \"any\" as an optional argument" + }, + "fqn": "jsii-calc.DoNotRecognizeAnyAsOptional", + "initializer": { + "initializer": true + }, + "kind": "class", + "methods": [ + { + "name": "method", + "parameters": [ + { + "name": "_requiredAny", + "type": { + "primitive": "any" + } + }, + { + "name": "_optionalAny", + "type": { + "optional": true, + "primitive": "any" + } + }, + { + "name": "_optionalString", + "type": { + "optional": true, + "primitive": "string" + } + } + ] + } + ], + "name": "DoNotRecognizeAnyAsOptional" + }, "jsii-calc.DoubleTrouble": { "assembly": "jsii-calc", "fqn": "jsii-calc.DoubleTrouble", @@ -3062,7 +3095,6 @@ { "name": "value", "returns": { - "optional": true, "primitive": "any" } } @@ -3412,5 +3444,5 @@ } }, "version": "0.7.8", - "fingerprint": "Xn7Rk17rqR3AaMx3+ssxT0GR1sCWwz0OGC+C8QuLI3A=" + "fingerprint": "2BaszImarh4WChl9DFUcygfTpEfXU17fHQT2wgEptfM=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AllTypes.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AllTypes.cs index 489e96e84c..2e6f227a3f 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AllTypes.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/AllTypes.cs @@ -32,20 +32,27 @@ public virtual double EnumPropertyValue get => GetInstanceProperty(); } - [JsiiProperty("anyArrayProperty", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"any\",\"optional\":true}}}")] + [JsiiProperty("anyArrayProperty", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"any\"}}}")] public virtual object[] AnyArrayProperty { get => GetInstanceProperty(); set => SetInstanceProperty(value); } - [JsiiProperty("anyMapProperty", "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"primitive\":\"any\",\"optional\":true}}}")] + [JsiiProperty("anyMapProperty", "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"primitive\":\"any\"}}}")] public virtual IDictionary AnyMapProperty { get => GetInstanceProperty>(); set => SetInstanceProperty(value); } + [JsiiProperty("anyProperty", "{\"primitive\":\"any\"}")] + public virtual object AnyProperty + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + [JsiiProperty("arrayProperty", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"string\"}}}")] public virtual string[] ArrayProperty { @@ -123,22 +130,22 @@ public virtual object UnionProperty set => SetInstanceProperty(value); } - [JsiiProperty("unknownArrayProperty", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"any\",\"optional\":true}}}")] + [JsiiProperty("unknownArrayProperty", "{\"collection\":{\"kind\":\"array\",\"elementtype\":{\"primitive\":\"any\"}}}")] public virtual object[] UnknownArrayProperty { get => GetInstanceProperty(); set => SetInstanceProperty(value); } - [JsiiProperty("unknownMapProperty", "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"primitive\":\"any\",\"optional\":true}}}")] + [JsiiProperty("unknownMapProperty", "{\"collection\":{\"kind\":\"map\",\"elementtype\":{\"primitive\":\"any\"}}}")] public virtual IDictionary UnknownMapProperty { get => GetInstanceProperty>(); set => SetInstanceProperty(value); } - [JsiiProperty("anyProperty", "{\"primitive\":\"any\",\"optional\":true}")] - public virtual object AnyProperty + [JsiiProperty("unknownProperty", "{\"primitive\":\"any\"}")] + public virtual object UnknownProperty { get => GetInstanceProperty(); set => SetInstanceProperty(value); @@ -151,13 +158,6 @@ public virtual StringEnum OptionalEnumValue set => SetInstanceProperty(value); } - [JsiiProperty("unknownProperty", "{\"primitive\":\"any\",\"optional\":true}")] - public virtual object UnknownProperty - { - get => GetInstanceProperty(); - set => SetInstanceProperty(value); - } - [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.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DoNotRecognizeAnyAsOptional.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DoNotRecognizeAnyAsOptional.cs new file mode 100644 index 0000000000..50e99be977 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/DoNotRecognizeAnyAsOptional.cs @@ -0,0 +1,27 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// jsii#284: do not recognize "any" as an optional argument + [JsiiClass(typeof(DoNotRecognizeAnyAsOptional), "jsii-calc.DoNotRecognizeAnyAsOptional", "[]")] + public class DoNotRecognizeAnyAsOptional : DeputyBase + { + public DoNotRecognizeAnyAsOptional(): base(new DeputyProps(new object[]{})) + { + } + + protected DoNotRecognizeAnyAsOptional(ByRefValue reference): base(reference) + { + } + + protected DoNotRecognizeAnyAsOptional(DeputyProps props): base(props) + { + } + + [JsiiMethod("method", null, "[{\"name\":\"_requiredAny\",\"type\":{\"primitive\":\"any\"}},{\"name\":\"_optionalAny\",\"type\":{\"primitive\":\"any\",\"optional\":true}},{\"name\":\"_optionalString\",\"type\":{\"primitive\":\"string\",\"optional\":true}}]")] + public virtual void Method(object _requiredAny, object _optionalAny, string _optionalString) + { + InvokeInstanceVoidMethod(new object[]{_requiredAny, _optionalAny, _optionalString}); + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UseBundledDependency.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UseBundledDependency.cs index f438961582..7470df65fe 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UseBundledDependency.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UseBundledDependency.cs @@ -17,7 +17,7 @@ protected UseBundledDependency(DeputyProps props): base(props) { } - [JsiiMethod("value", "{\"primitive\":\"any\",\"optional\":true}", "[]")] + [JsiiMethod("value", "{\"primitive\":\"any\"}", "[]")] public virtual object Value() { return InvokeInstanceMethod(new object[]{}); diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java index 614138338f..946461ede3 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java @@ -36,6 +36,7 @@ protected Class resolveClass(final String fqn) throws ClassNotFoundException case "jsii-calc.DerivedClassHasNoProperties.Derived": return software.amazon.jsii.tests.calculator.DerivedClassHasNoProperties.Derived.class; case "jsii-calc.DerivedStruct": return software.amazon.jsii.tests.calculator.DerivedStruct.class; case "jsii-calc.DoNotOverridePrivates": return software.amazon.jsii.tests.calculator.DoNotOverridePrivates.class; + case "jsii-calc.DoNotRecognizeAnyAsOptional": return software.amazon.jsii.tests.calculator.DoNotRecognizeAnyAsOptional.class; case "jsii-calc.DoubleTrouble": return software.amazon.jsii.tests.calculator.DoubleTrouble.class; case "jsii-calc.GiveMeStructs": return software.amazon.jsii.tests.calculator.GiveMeStructs.class; case "jsii-calc.IFriendlier": return software.amazon.jsii.tests.calculator.IFriendlier.class; 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 c6e710a699..2b1d0fec93 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 @@ -39,6 +39,14 @@ public void setAnyMapProperty(final java.util.Map getArrayProperty() { return this.jsiiGet("arrayProperty", java.util.List.class); } @@ -155,13 +163,12 @@ public void setUnknownMapProperty(final java.util.Map` :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any or ``undefined`` + :rtype: any .. py:method:: hello() -> string @@ -399,12 +399,17 @@ AllTypes .. py:attribute:: anyArrayProperty - :type: (any or ``undefined``)[] + :type: any[] .. py:attribute:: anyMapProperty - :type: string => (any or ``undefined``) + :type: string => any + + + .. py:attribute:: anyProperty + + :type: any .. py:attribute:: arrayProperty @@ -464,17 +469,17 @@ AllTypes .. py:attribute:: unknownArrayProperty - :type: (any or ``undefined``)[] + :type: any[] .. py:attribute:: unknownMapProperty - :type: string => (any or ``undefined``) + :type: string => any - .. py:attribute:: anyProperty + .. py:attribute:: unknownProperty - :type: any or ``undefined`` + :type: any .. py:attribute:: optionalEnumValue @@ -482,11 +487,6 @@ AllTypes :type: :py:class:`~jsii-calc.StringEnum`\ or ``undefined`` - .. py:attribute:: unknownProperty - - :type: any or ``undefined`` - - AllTypesEnum (enum) ^^^^^^^^^^^^^^^^^^^ @@ -723,7 +723,7 @@ BinaryOperation *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any or ``undefined`` + :rtype: any .. py:method:: toString() -> string @@ -878,7 +878,7 @@ Calculator *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any or ``undefined`` + :rtype: any .. py:method:: toString() -> string @@ -1327,6 +1327,47 @@ DoNotOverridePrivates :rtype: string +DoNotRecognizeAnyAsOptional +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. py:class:: DoNotRecognizeAnyAsOptional() + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.DoNotRecognizeAnyAsOptional; + + .. code-tab:: javascript + + const { DoNotRecognizeAnyAsOptional } = require('jsii-calc'); + + .. code-tab:: typescript + + import { DoNotRecognizeAnyAsOptional } from 'jsii-calc'; + + + + jsii#284: do not recognize "any" as an optional argument + + + + .. py:method:: method(_requiredAny, [_optionalAny, [_optionalString]]) + + :param _requiredAny: + :type _requiredAny: any + :param _optionalAny: + :type _optionalAny: any or ``undefined`` + :param _optionalString: + :type _optionalString: string or ``undefined`` + + DoubleTrouble ^^^^^^^^^^^^^ @@ -2504,7 +2545,7 @@ Multiply *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any or ``undefined`` + :rtype: any .. py:method:: hello() -> string @@ -2661,7 +2702,7 @@ Negate *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any or ``undefined`` + :rtype: any .. py:attribute:: operand @@ -3024,7 +3065,7 @@ Power *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any or ``undefined`` + :rtype: any .. py:method:: toString() -> string @@ -3362,7 +3403,7 @@ Sum *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any or ``undefined`` + :rtype: any .. py:method:: toString() -> string @@ -3605,7 +3646,7 @@ UnaryOperation *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any or ``undefined`` + :rtype: any .. py:method:: toString() -> string @@ -3698,7 +3739,7 @@ UseBundledDependency .. py:method:: value() -> any - :rtype: any or ``undefined`` + :rtype: any UseCalcBase @@ -4026,7 +4067,7 @@ CompositeOperation *Inherited from* :py:meth:`@scope/jsii-calc-base.Base <@scope/jsii-calc-base.Base.typeName>` :return: the name of the class (to verify native type names are created for derived classes). - :rtype: any or ``undefined`` + :rtype: any diff --git a/packages/jsii/lib/assembler.ts b/packages/jsii/lib/assembler.ts index d9847e6792..30d422d079 100644 --- a/packages/jsii/lib/assembler.ts +++ b/packages/jsii/lib/assembler.ts @@ -812,7 +812,7 @@ export class Assembler implements Emitter { this._diagnostic(declaration, ts.DiagnosticCategory.Error, `Only string index maps are supported`); - elementtype = { primitive: spec.PrimitiveType.Any, optional: true }; + elementtype = { primitive: spec.PrimitiveType.Any }; } return { collection: { @@ -830,7 +830,7 @@ export class Assembler implements Emitter { } // tslint:disable-next-line:no-bitwise if (type.flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) { - return { primitive: spec.PrimitiveType.Any, optional: true }; + return { primitive: spec.PrimitiveType.Any }; } } else if (type.symbol.valueDeclaration && isUnder(type.symbol.valueDeclaration.getSourceFile().fileName, this.stdlib)) { switch (type.symbol.name) {