use of org.sonar.java.resolve.Types in project sonar-java by SonarSource.
the class ExplodedGraphWalker method executeTypeCast.
private void executeTypeCast(TypeCastTree typeCast) {
Type type = typeCast.type().symbolType();
if (type.isPrimitive()) {
JavaType expType = (JavaType) typeCast.expression().symbolType();
// create SV to consume factory if any
SymbolicValue castSV = constraintManager.createSymbolicValue(typeCast);
// if exp type is a primitive and subtype of cast type, we can reuse the same symbolic value
if (!expType.isPrimitive() || !new Types().isSubtype(expType, (JavaType) type)) {
ProgramState.Pop unstack = programState.unstackValue(1);
programState = unstack.state;
programState = programState.stackValue(castSV);
}
}
}
Aggregations