Bug 41680 - Unnecessary cast wrongly reported
Summary: Unnecessary cast wrongly reported
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-19 08:41 EDT by Olivier Thomann CLA
Modified: 2003-10-08 07:30 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.