Skip to content

Commit 58724d7

Browse files
shdukerhernandez35
authored andcommitted
Fix ResourceGenerator to handle resources with more than 10 properties
Java's Map.of(...) only supports overloads up to 10 key-value pairs. Since resources can have more than 10 properties the Map.ofEntries(...) factory method must be used in instead to prevent compilation errors.
1 parent ec5fcfb commit 58724d7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

codegen/codegen-core/src/main/java/software/amazon/smithy/java/codegen/generators/ResourceGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ public void run() {
153153
writer.putContext("props", properties);
154154
writer.write(
155155
"""
156-
private static final ${map:T}<${string:T}, ${sdkSchema:T}> $$IDENTIFIERS = ${map:T}.of(${#ids}${key:S}, ${value:L}${^key.last},
156+
private static final ${map:T}<${string:T}, ${sdkSchema:T}> $$IDENTIFIERS = ${map:T}.ofEntries(${#ids}Map.entry(${key:S}, ${value:L})${^key.last},
157157
${/key.last}${/ids});
158-
private static final ${map:T}<${string:T}, ${sdkSchema:T}> $$PROPERTIES = ${map:T}.of(${#props}${key:S}, ${value:L}${^key.last},
158+
private static final ${map:T}<${string:T}, ${sdkSchema:T}> $$PROPERTIES = ${map:T}.ofEntries(${#props}Map.entry(${key:S}, ${value:L})${^key.last},
159159
${/key.last}${/props});
160160
""");
161161
writer.popState();

0 commit comments

Comments
 (0)