Fix toBuilder to carry forward the sourceLocation

Most existing toBuilders do this, but these ones were missing that
logic.
This commit is contained in:
Jaykumar Gosar 2021-07-14 13:07:41 -07:00 committed by Jordon Phillips
parent 9b4de14a5c
commit 32fbace531
10 changed files with 14 additions and 8 deletions

View File

@ -101,7 +101,7 @@ public final class AuthorizersTrait extends AbstractTrait implements ToSmithyBui
@Override
public Builder toBuilder() {
return builder().authorizers(authorizers);
return builder().sourceLocation(getSourceLocation()).authorizers(authorizers);
}
@Override

View File

@ -342,6 +342,7 @@ public final class IntegrationTrait extends AbstractTrait implements ToSmithyBui
@Override
public Builder toBuilder() {
return builder()
.sourceLocation(getSourceLocation())
.type(type)
.uri(uri)
.credentials(credentials)

View File

@ -163,6 +163,7 @@ public final class MockIntegrationTrait extends AbstractTrait implements ToSmith
@Override
public Builder toBuilder() {
return builder()
.sourceLocation(getSourceLocation())
.passThroughBehavior(passThroughBehavior)
.contentHandling(contentHandling)
.requestParameters(requestParameters)

View File

@ -76,7 +76,7 @@ public final class CfnResourceTrait extends AbstractTrait
@Override
public SmithyBuilder<CfnResourceTrait> toBuilder() {
return builder().name(name).additionalSchemas(additionalSchemas);
return builder().sourceLocation(getSourceLocation()).name(name).additionalSchemas(additionalSchemas);
}
public static final class Provider extends AbstractTrait.Provider {

View File

@ -76,7 +76,7 @@ public final class CognitoUserPoolsTrait extends AbstractTrait implements ToSmit
@Override
public Builder toBuilder() {
return builder().providerArns(providerArns);
return builder().sourceLocation(getSourceLocation()).providerArns(providerArns);
}
@Override

View File

@ -61,7 +61,7 @@ public final class ClientDiscoveredEndpointTrait extends AbstractTrait
@Override
public SmithyBuilder<ClientDiscoveredEndpointTrait> toBuilder() {
return builder().required(required);
return builder().sourceLocation(getSourceLocation()).required(required);
}
/** Builder for {@link ClientDiscoveredEndpointTrait}. */

View File

@ -91,7 +91,8 @@ public final class ClientEndpointDiscoveryTrait extends AbstractTrait
@Override
public Builder toBuilder() {
return new Builder()
.operation(getOperation())
.sourceLocation(getSourceLocation())
.operation(operation)
.error(error);
}

View File

@ -101,7 +101,7 @@ public final class EndpointTrait extends AbstractTrait implements ToSmithyBuilde
@Override
public Builder toBuilder() {
return new Builder().hostPrefix(hostPrefix.toString());
return new Builder().sourceLocation(getSourceLocation()).hostPrefix(hostPrefix.toString());
}
@Override

View File

@ -89,7 +89,7 @@ public final class HttpTrait extends AbstractTrait implements ToSmithyBuilder<Ht
@Override
public HttpTrait.Builder toBuilder() {
return new Builder().method(method).uri(uri).code(code);
return new Builder().sourceLocation(getSourceLocation()).method(method).uri(uri).code(code);
}
/**

View File

@ -72,7 +72,10 @@ public final class TraitDefinition extends AbstractTrait implements ToSmithyBuil
@Override
public Builder toBuilder() {
Builder builder = builder().selector(selector).structurallyExclusive(structurallyExclusive);
Builder builder = builder()
.sourceLocation(getSourceLocation())
.selector(selector)
.structurallyExclusive(structurallyExclusive);
conflicts.forEach(builder::addConflict);
return builder;
}