Maybe Data is Lost in result of type conversion (MDL)

Description:

This message is reported when significant bits may be lost as a result of conversion from large integer type to a smaller integer type. Such conversions are always explicitly specified by programmer, and MDL tries to reduce number of reported messages caused by data truncation.

Example:

The example below shows suspicious cases detected by MDL.

public void foo(int x, long y) { 
    byte b = (byte) (x >> 23);    
    short s = (int) (x & 0xffff00);
    char c = (char) ((x & 0xffff) << 1);
    int x = (int) (y >>> 1);     
}
In the following example, no warning messages are produced.
public void foo(int x, long y) { 
    short s = (short)x;
    char  c = (char)x;
    byte  b = (byte)y;
    b = (byte)(x & 0x7f);
    b = (byte)c;
    c = (x & 0xffff);
    x = (int)(y >>> 33);
}