public TypeMirror getOperatorKind(TypeMirror leftMirror, TypeMirror rightMirror , TokenType.BinaryOperator operator){

        if(leftMirror == null || rightMirror == null)
            return null;

        TypeKind leftKind = leftMirror.getKind();
        TypeKind rightKind = rightMirror.getKind();

        if(isString(leftMirror))
            return leftMirror;
        if(isString(rightMirror))
            return rightMirror;

        if(either(leftKind, rightKind, TypeKind.BOOLEAN) ) {
            if(operator != null) {
                messageUtils.error(Option.<Element>absent(), "Cannot perform perform the operation '%s' with a boolean type. (%s %s %s)", operator.toString(), leftMirror, operator.toString(), rightMirror);
            }
            return null;
        }

        if(leftKind.isPrimitive() && rightKind.isPrimitive()) {
            if (typeUtils.isSameType(leftMirror, rightMirror))
                return typeUtils.getPrimitiveType(leftKind);

            if (either(leftKind, rightKind, TypeKind.DOUBLE))
                return typeUtils.getPrimitiveType(TypeKind.DOUBLE);

            if (either(leftKind, rightKind, TypeKind.FLOAT))
                return typeUtils.getPrimitiveType(TypeKind.FLOAT);

            if (either(leftKind, rightKind, TypeKind.LONG))
                return typeUtils.getPrimitiveType(TypeKind.LONG);

            if (
                either(leftKind, rightKind, TypeKind.INT) ||
                either(leftKind, rightKind, TypeKind.CHAR) ||
                either(leftKind, rightKind, TypeKind.SHORT) ||
                either(leftKind, rightKind, TypeKind.BYTE)
            ) {
                return typeUtils.getPrimitiveType(TypeKind.INT);
            }
        }
        TypeMirror intMirror = typeUtils.getPrimitiveType(TypeKind.INT);
        if(both(assignable(intMirror, leftMirror), assignable(intMirror, rightMirror)))
            return intMirror;

        TypeMirror longMirror = typeUtils.getPrimitiveType(TypeKind.LONG);
        if(both(assignable(longMirror, leftMirror), assignable(longMirror, rightMirror)))
            return longMirror;

        TypeMirror floatMirror = typeUtils.getPrimitiveType(TypeKind.FLOAT);
        if(both(assignable(floatMirror, leftMirror), assignable(floatMirror, rightMirror)))
            return floatMirror;

        TypeMirror doubleMirror = typeUtils.getPrimitiveType(TypeKind.DOUBLE);
        if(both(assignable(doubleMirror, leftMirror), assignable(doubleMirror, rightMirror)))
            return doubleMirror;

        return null;
    }
public TypeMirror getOperatorKind ( TypeMirror leftMirror , TypeMirror rightMirror , TokenType . BinaryOperator operator ) { if ( leftMirror == null || rightMirror == null ) return null ; TypeKind leftKind = leftMirror . getKind ( ) ; TypeKind rightKind = rightMirror . getKind ( ) ; if ( isString ( leftMirror ) ) return leftMirror ; if ( isString ( rightMirror ) ) return rightMirror ; if ( either ( leftKind , rightKind , TypeKind . BOOLEAN ) ) { if ( operator != null ) { messageUtils . error ( Option . < Element > absent ( ) , "Cannot perform perform the operation '%s' with a boolean type. (%s %s %s)" , operator . toString ( ) , leftMirror , operator . toString ( ) , rightMirror ) ; } return null ; } if ( leftKind . isPrimitive ( ) && rightKind . isPrimitive ( ) ) { if ( typeUtils . isSameType ( leftMirror , rightMirror ) ) return typeUtils . getPrimitiveType ( leftKind ) ; if ( either ( leftKind , rightKind , TypeKind . DOUBLE ) ) return typeUtils . getPrimitiveType ( TypeKind . DOUBLE ) ; if ( either ( leftKind , rightKind , TypeKind . FLOAT ) ) return typeUtils . getPrimitiveType ( TypeKind . FLOAT ) ; if ( either ( leftKind , rightKind , TypeKind . LONG ) ) return typeUtils . getPrimitiveType ( TypeKind . LONG ) ; if ( either ( leftKind , rightKind , TypeKind . INT ) || either ( leftKind , rightKind , TypeKind . CHAR ) || either ( leftKind , rightKind , TypeKind . SHORT ) || either ( leftKind , rightKind , TypeKind . BYTE ) ) { return typeUtils . getPrimitiveType ( TypeKind . INT ) ; } } TypeMirror intMirror = typeUtils . getPrimitiveType ( TypeKind . INT ) ; if ( both ( assignable ( intMirror , leftMirror ) , assignable ( intMirror , rightMirror ) ) ) return intMirror ; TypeMirror longMirror = typeUtils . getPrimitiveType ( TypeKind . LONG ) ; if ( both ( assignable ( longMirror , leftMirror ) , assignable ( longMirror , rightMirror ) ) ) return longMirror ; TypeMirror floatMirror = typeUtils . getPrimitiveType ( TypeKind . FLOAT ) ; if ( both ( assignable ( floatMirror , leftMirror ) , assignable ( floatMirror , rightMirror ) ) ) return floatMirror ; TypeMirror doubleMirror = typeUtils . getPrimitiveType ( TypeKind . DOUBLE ) ; if ( both ( assignable ( doubleMirror , leftMirror ) , assignable ( doubleMirror , rightMirror ) ) ) return doubleMirror ; return null ; }
rules for this method are found here

http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.6.2

If any operand is of a reference type, it is subjected to unboxing conversion (§5.1.8).
Widening primitive conversion (§5.1.2) is applied to convert either or both operands as specified by the following rules:
If either operand is of type double, the other is converted to double.
Otherwise, if either operand is of type float, the other is converted to float.
Otherwise, if either operand is of type long, the other is converted to long.
Otherwise, both operands are converted to type int.

test this hardcore..

@param leftMirror
@param rightMirror
@param operator
@return