jsii-pacmak 1.122.0 → 1.124.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/targets/dotnet/nameutils.js +8 -0
- package/lib/targets/java.js +48 -20
- package/lib/util.d.ts +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +3 -3
- package/package.json +10 -10
|
@@ -77,6 +77,14 @@ class DotNetNameUtils {
|
|
|
77
77
|
throw new Error(`Invalid parameter name: ${original}`);
|
|
78
78
|
}
|
|
79
79
|
const name = (0, codemaker_1.toCamelCase)(original);
|
|
80
|
+
if (!name) {
|
|
81
|
+
// toCamelCase will return an empty string from a string like `_(_+)`. Confirm that
|
|
82
|
+
// that is what is happening, then return the original string.
|
|
83
|
+
if (original.match(/^__+$/)) {
|
|
84
|
+
return original;
|
|
85
|
+
}
|
|
86
|
+
throw new Error(`toCamelCase returns an empty string from: ${JSON.stringify(original)}`);
|
|
87
|
+
}
|
|
80
88
|
return this.escapeParameterName(name);
|
|
81
89
|
}
|
|
82
90
|
capitalizeWord(original) {
|
package/lib/targets/java.js
CHANGED
|
@@ -355,8 +355,22 @@ class JavaGenerator extends generator_1.Generator {
|
|
|
355
355
|
return propertyName;
|
|
356
356
|
}
|
|
357
357
|
if (propertyName === '_') {
|
|
358
|
-
// Slightly different pattern for this one
|
|
359
|
-
|
|
358
|
+
// Slightly different pattern for this one. We used to generate `__` here
|
|
359
|
+
// but it's somewhat likely that people will use `_, __, ___` as multiple
|
|
360
|
+
// indifferent arguments, so we pick a different name.
|
|
361
|
+
//
|
|
362
|
+
// Ideally we would look at the alternative argument names and pick
|
|
363
|
+
// something guaranteed to be unique, but unfortunately the code isn't
|
|
364
|
+
// quite structured that way so we'll pick something unlikely to collide
|
|
365
|
+
// instead.
|
|
366
|
+
//
|
|
367
|
+
// Changing from `__` -> `_under` would be a breaking change if applied to
|
|
368
|
+
// public property names, but most likely this will be used for function
|
|
369
|
+
// parameters (unfortunately the code has been structured in such a way
|
|
370
|
+
// that property and parameter names are strongly tied together, in a way
|
|
371
|
+
// that would take more time to unwind than I care to invest right now),
|
|
372
|
+
// where it doesn't matter.
|
|
373
|
+
return '_under_';
|
|
360
374
|
}
|
|
361
375
|
if (JavaGenerator.RESERVED_KEYWORDS.includes(propertyName)) {
|
|
362
376
|
return `${propertyName}Value`;
|
|
@@ -454,9 +468,9 @@ class JavaGenerator extends generator_1.Generator {
|
|
|
454
468
|
throw new Error('Cannot have generic type arguments to a constructor');
|
|
455
469
|
}
|
|
456
470
|
// NOTE: even though a constructor is technically final and we COULD render covariant types, historically we didn't and I'm not changing it.
|
|
457
|
-
this.code.openBlock(`${initializerAccessLevel} ${cls.name}(${this.renderParameters(method.parameters, types, '
|
|
471
|
+
this.code.openBlock(`${initializerAccessLevel} ${cls.name}(${this.renderParameters(method.parameters, types, 'exact-types')})`);
|
|
458
472
|
this.code.line('super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);');
|
|
459
|
-
this.emitUnionParameterValidation(method.parameters);
|
|
473
|
+
this.emitUnionParameterValidation(method.parameters, 'exact-types');
|
|
460
474
|
this.code.line(`software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this${this.renderMethodCallArguments(method)});`);
|
|
461
475
|
this.code.closeBlock();
|
|
462
476
|
}
|
|
@@ -583,7 +597,7 @@ class JavaGenerator extends generator_1.Generator {
|
|
|
583
597
|
});
|
|
584
598
|
this.emitStabilityAnnotations(method);
|
|
585
599
|
const types = this.convertTypes(method.parameters);
|
|
586
|
-
this.code.line(`${typeVarDeclarations(types)}${displayStatic(returnType)} ${methodName}(${this.renderParameters(method.parameters, types, '
|
|
600
|
+
this.code.line(`${typeVarDeclarations(types)}${displayStatic(returnType)} ${methodName}(${this.renderParameters(method.parameters, types, 'exact-types')});`);
|
|
587
601
|
}
|
|
588
602
|
onInterfaceMethodOverload(ifc, overload, _originalMethod) {
|
|
589
603
|
this.onInterfaceMethod(ifc, overload);
|
|
@@ -1066,7 +1080,7 @@ class JavaGenerator extends generator_1.Generator {
|
|
|
1066
1080
|
name: 'value',
|
|
1067
1081
|
type: this.filterType(prop, type),
|
|
1068
1082
|
},
|
|
1069
|
-
]);
|
|
1083
|
+
], 'exact-types');
|
|
1070
1084
|
}
|
|
1071
1085
|
if (prop.static) {
|
|
1072
1086
|
statement += `software.amazon.jsii.JsiiObject.jsiiStaticSet(${displayStatic(javaClass)}.class, `;
|
|
@@ -1120,7 +1134,8 @@ class JavaGenerator extends generator_1.Generator {
|
|
|
1120
1134
|
const async = !!method.async;
|
|
1121
1135
|
const methodName = JavaGenerator.safeJavaMethodName(method.name);
|
|
1122
1136
|
const types = this.convertTypes(method.parameters);
|
|
1123
|
-
const
|
|
1137
|
+
const covariance = covarianceFromOverridability(overridabilityFromMethod(method));
|
|
1138
|
+
const signature = `${typeVarDeclarations(types)}${displayStatic(returnType)} ${methodName}(${this.renderParameters(method.parameters, types, covariance)})`;
|
|
1124
1139
|
this.code.line();
|
|
1125
1140
|
this.addJavaDocs(method, {
|
|
1126
1141
|
api: 'member',
|
|
@@ -1138,7 +1153,7 @@ class JavaGenerator extends generator_1.Generator {
|
|
|
1138
1153
|
}
|
|
1139
1154
|
else {
|
|
1140
1155
|
this.code.openBlock(`${modifiers.join(' ')} ${signature}`);
|
|
1141
|
-
this.emitUnionParameterValidation(method.parameters);
|
|
1156
|
+
this.emitUnionParameterValidation(method.parameters, covariance);
|
|
1142
1157
|
this.code.line(this.renderMethodCall(cls, method, async));
|
|
1143
1158
|
this.code.closeBlock();
|
|
1144
1159
|
}
|
|
@@ -1148,7 +1163,7 @@ class JavaGenerator extends generator_1.Generator {
|
|
|
1148
1163
|
*
|
|
1149
1164
|
* @param parameters the list of parameters received by the function.
|
|
1150
1165
|
*/
|
|
1151
|
-
emitUnionParameterValidation(parameters) {
|
|
1166
|
+
emitUnionParameterValidation(parameters, covariance) {
|
|
1152
1167
|
if (!this.runtimeTypeChecking) {
|
|
1153
1168
|
// We were configured not to emit those, so bail out now.
|
|
1154
1169
|
return;
|
|
@@ -1162,7 +1177,7 @@ class JavaGenerator extends generator_1.Generator {
|
|
|
1162
1177
|
if (param.variadic) {
|
|
1163
1178
|
const javaType = this.toSingleJavaType(param.type);
|
|
1164
1179
|
const asListName = `__${param.name}__asList`;
|
|
1165
|
-
this.code.line(`final java.util.List<${displayStatic(javaType)}> ${asListName} = java.util.Arrays.asList(${param.name});`);
|
|
1180
|
+
this.code.line(`final java.util.List<${displayStatic(javaType, covariance)}> ${asListName} = java.util.Arrays.asList(${param.name});`);
|
|
1166
1181
|
validate.call(this, asListName, `.append("${param.name}")`, {
|
|
1167
1182
|
collection: {
|
|
1168
1183
|
kind: spec.CollectionKind.Array,
|
|
@@ -1171,7 +1186,7 @@ class JavaGenerator extends generator_1.Generator {
|
|
|
1171
1186
|
}, param.name, true);
|
|
1172
1187
|
}
|
|
1173
1188
|
else {
|
|
1174
|
-
validate.call(this, param.name, `.append("${param.name}")`, param.type, param.name);
|
|
1189
|
+
validate.call(this, param.name, `.append("${param.name}")`, param.type, param.name, false);
|
|
1175
1190
|
}
|
|
1176
1191
|
}
|
|
1177
1192
|
this.code.closeBlock();
|
|
@@ -1190,7 +1205,7 @@ class JavaGenerator extends generator_1.Generator {
|
|
|
1190
1205
|
}
|
|
1191
1206
|
}
|
|
1192
1207
|
}
|
|
1193
|
-
function validateArray(value, descr, elementType, parameterName, isRawArray
|
|
1208
|
+
function validateArray(value, descr, elementType, parameterName, isRawArray) {
|
|
1194
1209
|
const suffix = (0, crypto_1.createHash)('sha256')
|
|
1195
1210
|
.update(descr)
|
|
1196
1211
|
.digest('hex')
|
|
@@ -1202,7 +1217,7 @@ class JavaGenerator extends generator_1.Generator {
|
|
|
1202
1217
|
this.code.line(`final ${displayStatic(eltType)} ${valName} = ${value}.get(${idxName});`);
|
|
1203
1218
|
validate.call(this, valName, isRawArray
|
|
1204
1219
|
? `${descr}.append("[").append(${idxName}).append("]")`
|
|
1205
|
-
: `${descr}.append(".get(").append(${idxName}).append(")")`, elementType, parameterName);
|
|
1220
|
+
: `${descr}.append(".get(").append(${idxName}).append(")")`, elementType, parameterName, false);
|
|
1206
1221
|
this.code.closeBlock();
|
|
1207
1222
|
}
|
|
1208
1223
|
function validateMap(value, descr, elementType, parameterName) {
|
|
@@ -1225,8 +1240,12 @@ class JavaGenerator extends generator_1.Generator {
|
|
|
1225
1240
|
const varName = `__item_${suffix}`;
|
|
1226
1241
|
const valName = `__val_${suffix}`;
|
|
1227
1242
|
const javaElemType = this.toSingleJavaType(elementType);
|
|
1228
|
-
|
|
1229
|
-
|
|
1243
|
+
const entryType = mkStatic('java.util.Map.Entry', [
|
|
1244
|
+
mkStatic('java.lang.String'),
|
|
1245
|
+
javaElemType,
|
|
1246
|
+
]);
|
|
1247
|
+
this.code.openBlock(`for (final ${displayStatic(entryType, covariance)} ${varName}: ${value}.entrySet())`);
|
|
1248
|
+
this.code.line(`final ${displayStatic(javaElemType, covariance)} ${valName} = ${varName}.getValue();`);
|
|
1230
1249
|
validate.call(this, valName, `${descr}.append(".get(\\"").append((${varName}.getKey())).append("\\")")`, elementType, parameterName);
|
|
1231
1250
|
this.code.closeBlock();
|
|
1232
1251
|
}
|
|
@@ -2161,15 +2180,11 @@ class JavaGenerator extends generator_1.Generator {
|
|
|
2161
2180
|
return forceSingleType(this.toDecoratedJavaTypes(p));
|
|
2162
2181
|
});
|
|
2163
2182
|
}
|
|
2164
|
-
renderParameters(parameters, types,
|
|
2183
|
+
renderParameters(parameters, types, cov) {
|
|
2165
2184
|
parameters = parameters ?? [];
|
|
2166
2185
|
if (parameters.length !== types.length) {
|
|
2167
2186
|
throw new Error(`Arrays not same length: ${parameters.length} !== ${types.length}`);
|
|
2168
2187
|
}
|
|
2169
|
-
// We can render covariant parameters only for methods that aren't overridable... so only for static methods currently.
|
|
2170
|
-
// (There are some more places where we could do this, like properties and constructors, but historically we didn't
|
|
2171
|
-
// and I don't want to mess with this too much because the risk/reward isn't there.)
|
|
2172
|
-
const cov = overridable === 'final' ? 'covariant' : undefined;
|
|
2173
2188
|
const params = [];
|
|
2174
2189
|
for (const [p, type] of (0, util_1.zip)(parameters, types)) {
|
|
2175
2190
|
params.push(`final ${displayType(type, cov)}${p.variadic ? '...' : ''} ${JavaGenerator.safeJavaPropertyName(p.name)}`);
|
|
@@ -2859,6 +2874,7 @@ async function resolveMavenVersions(directory) {
|
|
|
2859
2874
|
const versionsPluginVersion = '2.20.1';
|
|
2860
2875
|
await (0, util_1.subprocess)('mvn', [
|
|
2861
2876
|
`org.codehaus.mojo:versions-maven-plugin:${versionsPluginVersion}:resolve-ranges`,
|
|
2877
|
+
'--settings=user.xml',
|
|
2862
2878
|
], {
|
|
2863
2879
|
cwd: directory,
|
|
2864
2880
|
retry: { maxAttempts: 1 },
|
|
@@ -2894,4 +2910,16 @@ function needsDefaultImpl(x) {
|
|
|
2894
2910
|
x.definingType.fqn === x.parentType.fqn) &&
|
|
2895
2911
|
!isBuiltinMethod);
|
|
2896
2912
|
}
|
|
2913
|
+
/**
|
|
2914
|
+
* Return the appropriate covariance rendering for the overridability of a given method
|
|
2915
|
+
*/
|
|
2916
|
+
function covarianceFromOverridability(overridable) {
|
|
2917
|
+
// We can render covariant parameters only for methods that aren't overridable... so only for static methods currently.
|
|
2918
|
+
// (There are some more places where we could do this, like properties and constructors, but historically we didn't
|
|
2919
|
+
// and I don't want to mess with this too much because the risk/reward isn't there.)
|
|
2920
|
+
return overridable === 'final' ? 'covariant' : 'exact-types';
|
|
2921
|
+
}
|
|
2922
|
+
function overridabilityFromMethod(method) {
|
|
2923
|
+
return method.static ? 'final' : 'overridable';
|
|
2924
|
+
}
|
|
2897
2925
|
//# sourceMappingURL=java.js.map
|
package/lib/util.d.ts
CHANGED
|
@@ -131,6 +131,6 @@ export declare function setExtend<A>(xs: Set<A>, els: Iterable<A>): void;
|
|
|
131
131
|
export declare function filterAsync<A>(xs: A[], pred: (x: A) => Promise<boolean>): Promise<A[]>;
|
|
132
132
|
export declare function wait(ms: number): Promise<void>;
|
|
133
133
|
export declare function flatten<A>(xs: readonly A[][]): A[];
|
|
134
|
-
export declare function zip<A, B>(xs: A[], ys: B[]): Array<[A, B]>;
|
|
134
|
+
export declare function zip<A, B>(xs: readonly A[], ys: readonly B[]): Array<[A, B]>;
|
|
135
135
|
export declare function setAdd<T>(setA: Set<T>, setB: Iterable<T>): void;
|
|
136
136
|
//# sourceMappingURL=util.d.ts.map
|
package/lib/version.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The short version number for this jsii-pacmak release (e.g: `X.Y.Z`) */
|
|
2
2
|
export declare const VERSION: string;
|
|
3
3
|
/** The qualified version number for this jsii-pacmak release (e.g: `X.Y.Z (build #######)`) */
|
|
4
|
-
export declare const VERSION_DESC = "1.
|
|
4
|
+
export declare const VERSION_DESC = "1.124.0 (build 987897b)";
|
|
5
5
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/version.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Generated at 2025-12-
|
|
2
|
+
// Generated at 2025-12-30T12:06:47Z by generate.sh
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.VERSION_DESC = exports.VERSION = void 0;
|
|
5
5
|
/** The short version number for this jsii-pacmak release (e.g: `X.Y.Z`) */
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
7
|
-
exports.VERSION = '1.
|
|
7
|
+
exports.VERSION = '1.124.0';
|
|
8
8
|
/** The qualified version number for this jsii-pacmak release (e.g: `X.Y.Z (build #######)`) */
|
|
9
|
-
exports.VERSION_DESC = '1.
|
|
9
|
+
exports.VERSION_DESC = '1.124.0 (build 987897b)';
|
|
10
10
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsii-pacmak",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.124.0",
|
|
4
4
|
"description": "A code generation framework for jsii backend languages",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,24 +37,24 @@
|
|
|
37
37
|
"package": "package-js"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@jsii/check-node": "1.
|
|
41
|
-
"@jsii/spec": "1.
|
|
40
|
+
"@jsii/check-node": "1.124.0",
|
|
41
|
+
"@jsii/spec": "1.124.0",
|
|
42
42
|
"clone": "^2.1.2",
|
|
43
|
-
"codemaker": "^1.
|
|
43
|
+
"codemaker": "^1.124.0",
|
|
44
44
|
"commonmark": "^0.31.2",
|
|
45
45
|
"escape-string-regexp": "^4.0.0",
|
|
46
46
|
"fs-extra": "^10.1.0",
|
|
47
|
-
"jsii-reflect": "^1.
|
|
47
|
+
"jsii-reflect": "^1.124.0",
|
|
48
48
|
"semver": "^7.7.2",
|
|
49
49
|
"spdx-license-list": "^6.10.0",
|
|
50
50
|
"xmlbuilder": "^15.1.1",
|
|
51
51
|
"yargs": "^17.7.2"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@jsii/dotnet-runtime": "^1.
|
|
55
|
-
"@jsii/go-runtime": "^1.
|
|
56
|
-
"@jsii/java-runtime": "^1.
|
|
57
|
-
"@scope/jsii-calc-lib": "^1.
|
|
54
|
+
"@jsii/dotnet-runtime": "^1.124.0",
|
|
55
|
+
"@jsii/go-runtime": "^1.124.0",
|
|
56
|
+
"@jsii/java-runtime": "^1.124.0",
|
|
57
|
+
"@scope/jsii-calc-lib": "^1.124.0",
|
|
58
58
|
"@types/clone": "^2.1.4",
|
|
59
59
|
"@types/commonmark": "^0.27.10",
|
|
60
60
|
"@types/diff": "^5.2.3",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@types/yargs": "^17.0.33",
|
|
64
64
|
"diff": "^5.2.0",
|
|
65
65
|
"jsii": "^5.9.10",
|
|
66
|
-
"jsii-build-tools": "^1.
|
|
66
|
+
"jsii-build-tools": "^1.124.0",
|
|
67
67
|
"jsii-calc": "^3.20.120",
|
|
68
68
|
"jsii-rosetta": "~5.9.10",
|
|
69
69
|
"pyright": "^1.1.403"
|