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 @Override
public Builder toBuilder() { public Builder toBuilder() {
return builder().authorizers(authorizers); return builder().sourceLocation(getSourceLocation()).authorizers(authorizers);
} }
@Override @Override

View File

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

View File

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

View File

@ -76,7 +76,7 @@ public final class CfnResourceTrait extends AbstractTrait
@Override @Override
public SmithyBuilder<CfnResourceTrait> toBuilder() { 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 { public static final class Provider extends AbstractTrait.Provider {

View File

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

View File

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

View File

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

View File

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

View File

@ -89,7 +89,7 @@ public final class HttpTrait extends AbstractTrait implements ToSmithyBuilder<Ht
@Override @Override
public HttpTrait.Builder toBuilder() { 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 @Override
public Builder toBuilder() { public Builder toBuilder() {
Builder builder = builder().selector(selector).structurallyExclusive(structurallyExclusive); Builder builder = builder()
.sourceLocation(getSourceLocation())
.selector(selector)
.structurallyExclusive(structurallyExclusive);
conflicts.forEach(builder::addConflict); conflicts.forEach(builder::addConflict);
return builder; return builder;
} }