public TypeMirror binaryNumericPromotion(TypeMirror type1, TypeMirror type2) {
    TypeKind t1 = type1.getKind();
    TypeKind t2 = type2.getKind();
    if (t1 == TypeKind.DECLARED) {
      t1 = javacTypes.unboxedType(type1).getKind();
    }
    if (t2 == TypeKind.DECLARED) {
      t2 = javacTypes.unboxedType(type2).getKind();
    }
    if (t1 == TypeKind.DOUBLE || t2 == TypeKind.DOUBLE) {
      return getDouble();
    } else if (t1 == TypeKind.FLOAT || t2 == TypeKind.FLOAT) {
      return getFloat();
    } else if (t1 == TypeKind.LONG || t2 == TypeKind.LONG) {
      return getLong();
    } else {
      return getInt();
    }
  }
public TypeMirror binaryNumericPromotion ( TypeMirror type1 , TypeMirror type2 ) { TypeKind t1 = type1 . getKind ( ) ; TypeKind t2 = type2 . getKind ( ) ; if ( t1 == TypeKind . DECLARED ) { t1 = javacTypes . unboxedType ( type1 ) . getKind ( ) ; } if ( t2 == TypeKind . DECLARED ) { t2 = javacTypes . unboxedType ( type2 ) . getKind ( ) ; } if ( t1 == TypeKind . DOUBLE || t2 == TypeKind . DOUBLE ) { return getDouble ( ) ; } else if ( t1 == TypeKind . FLOAT || t2 == TypeKind . FLOAT ) { return getFloat ( ) ; } else if ( t1 == TypeKind . LONG || t2 == TypeKind . LONG ) { return getLong ( ) ; } else { return getInt ( ) ; } }
If either type is a double TypeMirror, a double TypeMirror is returned.
Otherwise, if either type is a float TypeMirror, a float TypeMirror is returned.
Otherwise, if either type is a long TypeMirror, a long TypeMirror is returned.
Otherwise, an int TypeMirror is returned. See jls-5.6.2.
@param type1 a numeric type
@param type2 a numeric type
@return the result of binary numeric promotion applied to type1 and type2