}
private boolean isErasedUnionOrIntersection(ProducedType producedType) {
TypeDeclaration typeDeclaration = producedType.getDeclaration();
if(typeDeclaration instanceof UnionType){
UnionType ut = (UnionType) typeDeclaration;
java.util.List<ProducedType> caseTypes = ut.getCaseTypes();
// special case for optional types
if(caseTypes.size() == 2){
if(isNull(caseTypes.get(0))){
return isErasedUnionOrIntersection(caseTypes.get(1));
}else if(isNull(caseTypes.get(1))){
return isErasedUnionOrIntersection(caseTypes.get(0));
}
}
// it is erased
return true;
}
if(typeDeclaration instanceof IntersectionType){
IntersectionType ut = (IntersectionType) typeDeclaration;
java.util.List<ProducedType> satisfiedTypes = ut.getSatisfiedTypes();
// special case for non-optional types
if(satisfiedTypes.size() == 2){
if(isObject(satisfiedTypes.get(0))){
return isErasedUnionOrIntersection(satisfiedTypes.get(1));
}else if(isObject(satisfiedTypes.get(1))){