You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.lang.ClassCastException: software.amazon.awscdk.services.lambda.LambdaRuntime cannot be cast to software.amazon.awscdk.services.lambda.InlinableJavascriptLambdaRuntime
#504
Closed
eranation opened this issue
Aug 3, 2018
· 1 comment
· Fixed by #505
I was trying to create a new Lambda construct, it compiles well but when running cdk synth I'm getting this error:
Exception in thread "main" java.lang.ExceptionInInitializerError
at ...MyStack.<init>(MyStack.java:25)
at ..MyApp.<init>(MyApp.java:11)
at ..MyApp.main(MyApp.java:15)
Caused by: java.lang.ClassCastException: software.amazon.awscdk.services.lambda.LambdaRuntime cannot be cast to software.amazon.awscdk.services.lambda.InlinableJavascriptLambdaRuntime
at software.amazon.awscdk.services.lambda.LambdaRuntime.<clinit>(LambdaRuntime.java:11)
... 3 more
The code is simply
Lambda lambda = new Lambda("MyLambda",
LambdaProps.builder()
.withCode(LambdaCode.file(...))
.withHandler(...).withRuntime(LambdaRuntime.JAVA8)
.build()
The text was updated successfully, but these errors were encountered:
TypeScript uses inference to determine if a cast to an interface is legal but
strongly-typed languages like Java require that the down-casted class will
explicitly implement the interface.
The JavaRuntime class has static members that are down-casted from JavaRuntime
to a set of interfaces, to allow strong-typing of properties for various Lambda
use cases. These down-casts fail in e.g. Java because JavaRuntime doesn't implement
these interfaces explicitly.
We should add a compile-time check in jsii for such a use case.
Fixes#504
…#505)
TypeScript uses inference to determine if a cast to an interface is legal but
strongly-typed languages like Java require that the down-casted class will
explicitly implement the interface.
The JavaRuntime class has static members that are down-casted from JavaRuntime
to a set of interfaces, to allow strong-typing of properties for various Lambda
use cases. These down-casts fail in e.g. Java because JavaRuntime doesn't implement
these interfaces explicitly.
We should add a compile-time check in jsii for such a use case.
Fixes#504
I was trying to create a new Lambda construct, it compiles well but when running cdk synth I'm getting this error:
The code is simply
The text was updated successfully, but these errors were encountered: