public static Type resolveReturnType(final Type baseType, final Type overridingType) {
        if (baseType instanceof Class && overridingType instanceof Class
                && ((Class<?>) baseType).isAssignableFrom((Class<?>) overridingType)) {
            // NOTE: javac generates multiple same methods for multiple inherited generic interfaces
            return overridingType;
        }
        if (baseType instanceof Class && overridingType instanceof ParameterizedType) {
            // NOTE: javac will generate multiple methods with different return types
            // base interface declares generic method, override declares parameterized generic method
            return overridingType;
        }
        if (baseType instanceof Class && overridingType instanceof TypeVariable) {
            // NOTE: javac will generate multiple methods with different return types
            // base interface declares non generic method, override declares generic method
            return overridingType;
        }
        return baseType;
    }
@Test
    public void resolveReturnTypeTest() {
        //case1: baseType and overridingType are booth Class instances
        Class<?> baseType = Number.class;
        Class<?> overridingType = Integer.class;
        Type result = Types.resolveReturnType(baseType, overridingType);
        Assert.assertEquals(result, overridingType);

        //case2: baseType is Class instance, overridingType is ParameterizedType instance
        baseType = Comparable.class;
        ParameterizedType parameterizedType = mock(ParameterizedType.class);
        result = Types.resolveReturnType(baseType, parameterizedType);
        Assert.assertEquals(result, parameterizedType);

        //case3: baseType is Class instance, overridingType is TypeVariable instance
        baseType = Comparable.class;
        TypeVariable typeVariable = mock(TypeVariable.class);
        result = Types.resolveReturnType(baseType, typeVariable);
        Assert.assertEquals(result, typeVariable);

        //case4 :vaseType and overridingType are not matching any conditions
        baseType = String.class;
        overridingType = Integer.class;
        result = Types.resolveReturnType(baseType, overridingType);
        Assert.assertEquals(result, baseType);
    }