Bug 41680

Summary: Unnecessary cast wrongly reported
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: mle
Version: 3.0   
Target Milestone: 3.0 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Olivier Thomann CLA 2003-08-19 08:41:33 EDT
Using 0819, compiling this test case leads to a warning for an unnessesary cast,
but the result of the two expressions is different.

public class Test {

	public static void main(String[] args) {
		final long lgLow32BitMask1 = ~(~(long) 0 << 32);
		final long lgLow32BitMask2 = ~(~0 << 32);
		System.out.println("lgLow32BitMask1: "+lgLow32BitMask1);
		System.out.println("lgLow32BitMask2: "+lgLow32BitMask2);
	}
}
Comment 1 Philipe Mulet CLA 2003-09-02 04:51:12 EDT
Problem is quite subtle, since the unary expression is the first argument of 
the binary (not a cast expression, but a unary of a cast).

Fixed in latest, regression test added.
Comment 2 David Audel CLA 2003-10-08 07:30:03 EDT
Verified.