-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Framework: Refs with imposed strong types lead to ClassCastException #619
Copy link
Copy link
Closed
Labels
bugThis issue is a bug.This issue is a bug.
Description
Hello,
I'm trying to create a simple VPC with a single subnet with predefined CIDR using Java:
VpcNetwork vpc = new VpcNetwork(this, "my-vpc",
VpcNetworkProps.builder()
.withCidr("10.0.0.0/16")
.build());
Token vpcId = vpc.getVpcId();
new VpcSubnet(this, "my-vpc-a",
VpcSubnetProps.builder()
.withAvailabilityZone(props.getEnv().getRegion() + "a")
.withVpcId(vpcId)
.withCidrBlock("10.0.1.0/24")
.build()Unfortunately, cdr synth fails with the following error:
Exception in thread "main" java.lang.ClassCastException: software.amazon.awscdk.CloudFormationToken cannot be cast to software.amazon.awscdk.services.ec2.VpcNetworkId
at software.amazon.awscdk.services.ec2.VpcNetwork.getVpcId(VpcNetwork.java:67)
when vpc.getVpcId() is invoked.
It looks like a bug on Jsii but maybe I'm missing something.
CDK Version: 0.8
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.