-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClassCastException when trying to get an element from IVpcNetwork.getPrivateSubnets() #1981
Comments
I am unable to reproduce this on the latest release. What version are you using? I believe this has been resolved by aws/jsii#321 |
Could it be that I need to upgrade the toolkit? I upgraded my Maven dependencies but I'm realizing that I might need to upgrade the toolkit itself. That would definitely be a good thing to put in documentation if so because I don't know how right now. (I tried |
Ok, I was using the wrong command. The upgrade is just |
Sadly, upgrading did not resolve this. I am now using 0.25.3 and I get the same exception at runtime (using most up-to-date toolkit of same version). |
Similarly, when I've tried to use the following as a workaround, I still get the ClassCastException when trying to operate on this List of IVpcSubnets.
returns this error:
Without a workaround this blocks me from deploying. |
I bet this error is around returning the right type by the JSII kernel. |
Yes, fairly sure, since the actual class type is going to be |
Hmm that does not seem to be it. Could you run with the environment variable |
Ah no, it IS that. It's just that this pull request: aws/jsii#346 just didn't fix the case where the return type is an array. |
Posting the element of the array (or for loop maybe? I guess) and after. After that it seems to show it returning an array of Constructs.
|
Serialize and deserialize types according to their declared static type, and add validation on the runtime types matching the declared types. This is in contrast to previously, when we mostly only used the runtime types to determine what to do, and harly any validation was done. The runtime types used to be able to freely disagree with the declared types, and we put a lot of burden on the JSII runtimes at the other end of the wire. Fix tests that used to exercise the API with invalid arguments. Fixes aws/aws-cdk#1981.
Serialize and deserialize types according to their declared static type, and add validation on the runtime types matching the declared types. This is in contrast to previously, when we mostly only used the runtime types to determine what to do, and harly any validation was done. The runtime types used to be able to freely disagree with the declared types, and we put a lot of burden on the JSII runtimes at the other end of the wire. Fix tests that used to exercise the API with invalid arguments. Remove Proxy objects since they only existed to prevent accidentally overwriting certain keys via the jsii interface, and Symbols serve the same purpose (but simpler). Fixes aws/aws-cdk#1981.
Serialize and deserialize types according to their declared static type, and add validation on the runtime types matching the declared types. This is in contrast to previously, when we mostly only used the runtime types to determine what to do, and harly any validation was done. The runtime types used to be able to freely disagree with the declared types, and we put a lot of burden on the JSII runtimes at the other end of the wire. Fix tests that used to exercise the API with invalid arguments. Remove Proxy objects since they only existed to prevent accidentally overwriting certain keys via the jsii interface, and Symbols serve the same purpose (but simpler). Fixes aws/aws-cdk#1981.
When trying to get the first private subnet in a IVpcNetwork, it returns a ClassCastException.
The relevant code:
Runtime exception (
cdk deploy
):The text was updated successfully, but these errors were encountered: