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/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