Bug 101001 - [compiler] compiler could warn for right shift out of bounds
Summary: [compiler] compiler could warn for right shift out of bounds
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-20 22:11 EDT by Olivier Thomann CLA
Modified: 2016-01-14 12:59 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2005-06-20 22:11:14 EDT
Test case:
class ASTNode {
	public final static long Bit38L = 0x2000000000L;
}
public class X {
	public static final long Autoboxing = ASTNode.Bit38L;
	
	public static void main(String[] args) {
		int i = args.length;
		switch(i) {
			case (int) Autoboxing >>> 32 :
				System.out.println("Autoboxing");
				break;
			default:
				System.out.println("Default");
		}
	}
}

jikes reports a warning for the expression (int) Autoboxing >>> 32.

Issued 1 semantic warning compiling "d:/tests_sources/X.java":

     9.                 final int IntAutoBoxing = (int) Autoboxing >>> 32;
                                                                       ^^
*** Semantic Caution: The shift count of 32 is >= the 32-bit width of the type.

The result will always be 0 whatever the value of the constant Autoboxing. So
this is highly possible that this is a user bug.