Calls within nested DSL functions will resolve an implicit receiver from anywhere up the hierarchy, enabling bad calls like this one:
CreateBucketRequest {
bucket = "foo"
grantRead = "bar"
createBucketConfiguration {
grantRead = "baz" // Should be prohibited
}
}
In the above example, setting grantRead from within createBucketConfiguration should be prohibited because grantRead is a member of CreateBucketRequest.Builder, not CreateBucketConfiguration.Builder.
This change introduces a new DSL marker annotation @SdkDsl which is applied to every codegenned structure builder. Code like the above example now fails to compile.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue \
Resolves #428
Description of changes
Calls within nested DSL functions will resolve an implicit receiver from anywhere up the hierarchy, enabling bad calls like this one:
In the above example, setting
grantRead
from withincreateBucketConfiguration
should be prohibited becausegrantRead
is a member ofCreateBucketRequest.Builder
, notCreateBucketConfiguration.Builder
.This change introduces a new DSL marker annotation
@SdkDsl
which is applied to every codegenned structure builder. Code like the above example now fails to compile.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.