-
- Downloads
Correctly load client or server specific decorators from classpath (#1592)
The current approach that attempts to downcast never worked; all Rust decorators were being loaded, and the cast was doing nothing, because the generic type parameter is erased at runtime. Attempting to downcast a generic class `C<T>` to `C<U>` where `U: T` is not possible to do in Kotlin (and presumably all JVM-based languages) _at runtime_. Not even when using reified type parameters of inline functions. See https://kotlinlang.org/docs/generics.html#type-erasure for details. This commit thus goes for another approach, suggested in the linked Stack Overflow question [0]: add a method to the loaded classes that signals at runtime the generic type parameter (`ClientCodegenContext` or `ServerCodegenContext`) they can work with, in order to filter them. This commit also simplifies the way the Python server project loads the Python server-specific decorators, by deleting the combined decorator `PythonServerCodegenDecorator`, which was being loaded from the classpath, and instead directly using `CombinedCodegenDecorator` and passing it the Python server-specific decorators in the `extras` parameter. [0]: https://stackoverflow.com/questions/5451734/loading-generic-service-implementations-via-java-util-serviceloader
Showing
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsEndpointDecorator.kt 3 additions, 0 deletions...in/software/amazon/smithy/rustsdk/AwsEndpointDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt 3 additions, 0 deletions...oftware/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsPresigningDecorator.kt 3 additions, 0 deletions.../software/amazon/smithy/rustsdk/AwsPresigningDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsReadmeDecorator.kt 4 additions, 0 deletions...tlin/software/amazon/smithy/rustsdk/AwsReadmeDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/CrateLicenseDecorator.kt 4 additions, 0 deletions...n/software/amazon/smithy/rustsdk/CrateLicenseDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/CredentialProviders.kt 4 additions, 0 deletions...lin/software/amazon/smithy/rustsdk/CredentialProviders.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/HttpRequestChecksumDecorator.kt 4 additions, 0 deletions...are/amazon/smithy/rustsdk/HttpRequestChecksumDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/HttpResponseChecksumDecorator.kt 4 additions, 0 deletions...re/amazon/smithy/rustsdk/HttpResponseChecksumDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/IntegrationTestDependencies.kt 4 additions, 0 deletions...ware/amazon/smithy/rustsdk/IntegrationTestDependencies.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/RegionDecorator.kt 3 additions, 0 deletions.../kotlin/software/amazon/smithy/rustsdk/RegionDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/RetryPolicyDecorator.kt 4 additions, 0 deletions...in/software/amazon/smithy/rustsdk/RetryPolicyDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SdkConfigDecorator.kt 4 additions, 0 deletions...tlin/software/amazon/smithy/rustsdk/SdkConfigDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/ServiceConfigDecorator.kt 4 additions, 0 deletions.../software/amazon/smithy/rustsdk/ServiceConfigDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SigV4SigningDecorator.kt 3 additions, 0 deletions...n/software/amazon/smithy/rustsdk/SigV4SigningDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/UserAgentDecorator.kt 4 additions, 0 deletions...tlin/software/amazon/smithy/rustsdk/UserAgentDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/apigateway/ApiGatewayDecorator.kt 3 additions, 0 deletions...mithy/rustsdk/customize/apigateway/ApiGatewayDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/auth/DisabledAuthDecorator.kt 4 additions, 0 deletions...on/smithy/rustsdk/customize/auth/DisabledAuthDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/ec2/Ec2Decorator.kt 4 additions, 0 deletions...tware/amazon/smithy/rustsdk/customize/ec2/Ec2Decorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/glacier/GlacierDecorator.kt 3 additions, 0 deletions...azon/smithy/rustsdk/customize/glacier/GlacierDecorator.kt
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/route53/Route53Decorator.kt 4 additions, 0 deletions...azon/smithy/rustsdk/customize/route53/Route53Decorator.kt
Loading
Please register or sign in to comment