/**
  * <strong>5.1.4 Widening and Narrowing Primitive Conversion</strong>
  *
  * <p>The following conversion combines both widening and narrowing primitive conversions:
  *
  * <p>byte to char
  *
  * <p>First, the byte is converted to an int via widening primitive conversion (§5.1.2), and then
  * the resulting int is converted to a char by narrowing primitive conversion (§5.1.3).
  *
  * @param from
  * @param to
  * @return
  */
 public static boolean checkWideningAndNarrowingPrimitiveConversion(AClass from, AClass to) {
   return from.getType().getSort() == Type.BYTE && to.getType().getSort() == Type.CHAR;
 }
 /**
  * <strong>5.1.3 Narrowing Primitive Conversion</strong>
  *
  * <p>22 specific conversions on primitive types are called the narrowing primitive conversions:
  *
  * <ul>
  *   <li>short to byte or char
  *   <li>char to byte or short
  *   <li>int to byte, short, or char
  *   <li>long to byte, short, char, or int
  *   <li>float to byte, short, char, int, or long
  *   <li>double to byte, short, char, int, long, or float
  * </ul>
  *
  * @param from
  * @param to
  * @return
  */
 public static boolean checkNarrowingPrimitiveConversion(AClass from, AClass to) {
   int fromSort = from.getType().getSort();
   int toSort = from.getType().getSort();
   if (fromSort == Type.BYTE || fromSort == Type.BOOLEAN || toSort == Type.BOOLEAN) {
     return false;
   }
   switch (fromSort) {
     case Type.CHAR:
       switch (toSort) {
         case Type.BYTE:
         case Type.SHORT:
           return true;
         default:
           return false;
       }
     case Type.SHORT:
       switch (toSort) {
         case Type.CHAR:
         case Type.BYTE:
           return true;
         default:
           return false;
       }
     case Type.INT:
       switch (toSort) {
         case Type.CHAR:
         case Type.BYTE:
         case Type.SHORT:
           return true;
         default:
           return false;
       }
     case Type.FLOAT:
       switch (toSort) {
         case Type.CHAR:
         case Type.BYTE:
         case Type.SHORT:
         case Type.INT:
         case Type.LONG:
           return true;
         default:
           return false;
       }
     case Type.LONG:
       switch (toSort) {
         case Type.CHAR:
         case Type.BYTE:
         case Type.SHORT:
         case Type.INT:
           return true;
         default:
           return false;
       }
     case Type.DOUBLE:
       switch (toSort) {
         case Type.CHAR:
         case Type.BYTE:
         case Type.SHORT:
         case Type.INT:
         case Type.FLOAT:
         case Type.LONG:
           return true;
         default:
           return false;
       }
     default:
       return false;
   }
 }