Blob Blame History Raw
### Eclipse Workspace Patch 1.0
#P org.eclipse.jdt.core
Index: compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java,v
retrieving revision 1.25
diff -u -r1.25 IntConstant.java
--- compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java	28 Mar 2006 20:33:18 -0000	1.25
+++ compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java	2 Feb 2009 15:15:01 -0000
@@ -13,7 +13,8 @@
 public class IntConstant extends Constant {
 	
 	int value;
-	
+
+	private static final IntConstant MIN_VALUE = new IntConstant(Integer.MIN_VALUE);
 	private static final IntConstant MINUS_FOUR = new IntConstant(-4);
 	private static final IntConstant MINUS_THREE = new IntConstant(-3);
 	private static final IntConstant MINUS_TWO = new IntConstant(-2);
@@ -33,6 +34,7 @@
 	public static Constant fromValue(int value) {
 
 		switch (value) {
+			case Integer.MIN_VALUE : return IntConstant.MIN_VALUE;
 			case -4 : return IntConstant.MINUS_FOUR;
 			case -3 : return IntConstant.MINUS_THREE;
 			case -2 : return IntConstant.MINUS_TWO;
Index: compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java,v
retrieving revision 1.23
diff -u -r1.23 LongConstant.java
--- compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java	28 Mar 2006 20:33:18 -0000	1.23
+++ compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java	2 Feb 2009 15:15:01 -0000
@@ -12,12 +12,15 @@
 
 public class LongConstant extends Constant {
 private static final LongConstant ZERO = new LongConstant(0L);
+private static final LongConstant MIN_VALUE = new LongConstant(Long.MIN_VALUE); 
 
 private long value;
 
 public static Constant fromValue(long value) {
 	if (value == 0L) {
 		return ZERO;
+	} else if (value == Long.MIN_VALUE) {
+		return MIN_VALUE;
 	}
 	return new LongConstant(value);
 }
Index: compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java,v
retrieving revision 1.25
diff -u -r1.25 LongLiteral.java
--- compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java	6 Mar 2007 02:38:48 -0000	1.25
+++ compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java	2 Feb 2009 15:15:01 -0000
@@ -17,7 +17,6 @@
 import org.eclipse.jdt.internal.compiler.parser.ScannerHelper;
 
 public class LongLiteral extends NumberLiteral {
-	static final Constant FORMAT_ERROR = DoubleConstant.fromValue(1.0/0.0); // NaN;	
 		
 public LongLiteral(char[] token, int s,int e) {
 	super(token, s,e);
@@ -52,7 +51,7 @@
 				
 		int digitValue ;
 		if ((digitValue = ScannerHelper.digit(source[j++],radix)) < 0 ) {
-			constant = FORMAT_ERROR; return ;
+			return /*constant stays null*/ ;
 		}
 		if (digitValue >= 8)
 			nbDigit = 4;
@@ -65,7 +64,7 @@
 		computedValue = digitValue ;
 		while (j<length) {
 			if ((digitValue = ScannerHelper.digit(source[j++],radix)) < 0) {
-				constant = FORMAT_ERROR; return ;
+				return /*constant stays null*/ ;
 			}
 			if ((nbDigit += shift) > 64)
 				return /*constant stays null*/ ;
@@ -137,19 +136,6 @@
 			(source[18] == '8') &&
 			(((this.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) == 0));
 }
-public TypeBinding resolveType(BlockScope scope) {
-	// the format may be incorrect while the scanner could detect
-	// such error only on painfull tests...easier and faster here
-
-	TypeBinding tb = super.resolveType(scope);
-	if (constant == FORMAT_ERROR) {
-		constant = Constant.NotAConstant;
-		scope.problemReporter().constantOutOfFormat(this);
-		this.resolvedType = null;
-		return null;
-	}
-	return tb;
-}
 public void traverse(ASTVisitor visitor, BlockScope scope) {
 	visitor.visit(this, scope);
 	visitor.endVisit(this, scope);
Index: compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java,v
retrieving revision 1.12
diff -u -r1.12 LongLiteralMinValue.java
--- compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java	6 Mar 2007 02:38:48 -0000	1.12
+++ compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java	2 Feb 2009 15:15:01 -0000
@@ -15,11 +15,10 @@
 public class LongLiteralMinValue extends LongLiteral {
 
 	final static char[] CharValue = new char[]{'-', '9','2','2','3','3','7','2','0','3','6','8','5','4','7','7','5','8','0','8','L'};
-	final static Constant MIN_VALUE = LongConstant.fromValue(Long.MIN_VALUE) ; 
 
 public LongLiteralMinValue(){
 	super(CharValue,0,0);
-	constant = MIN_VALUE;
+	constant = LongConstant.fromValue(Long.MIN_VALUE);
 }
 public void computeConstant() {
 
Index: compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java,v
retrieving revision 1.10
diff -u -r1.10 IntLiteralMinValue.java
--- compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java	28 Mar 2006 20:29:57 -0000	1.10
+++ compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java	2 Feb 2009 15:15:01 -0000
@@ -15,11 +15,10 @@
 public class IntLiteralMinValue extends IntLiteral {
 
 	final static char[] CharValue = new char[]{'-','2','1','4','7','4','8','3','6','4','8'};
-	final static Constant MIN_VALUE = IntConstant.fromValue(Integer.MIN_VALUE) ; 
 
 public IntLiteralMinValue() {
-	super(CharValue,0,0,Integer.MIN_VALUE);
-	constant = MIN_VALUE;
+	super(CharValue, 0,0, Integer.MIN_VALUE);
+	constant = IntConstant.fromValue(Integer.MIN_VALUE);
 }
 public void computeConstant(){
 	
Index: compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java,v
retrieving revision 1.23
diff -u -r1.23 IntLiteral.java
--- compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java	28 Oct 2006 04:11:27 -0000	1.23
+++ compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java	2 Feb 2009 15:15:01 -0000
@@ -22,7 +22,6 @@
 	public static final IntLiteral
 		One = new IntLiteral(new char[]{'1'},0,0,1);//used for ++ and -- 
 
-	static final Constant FORMAT_ERROR = DoubleConstant.fromValue(1.0/0.0); // NaN;
 public IntLiteral(char[] token, int s, int e) {
 	super(token, s,e);
 }
@@ -71,7 +70,7 @@
 		while (j<length)
 		{	int digitValue ;
 			if ((digitValue = ScannerHelper.digit(source[j++],radix))	< 0 ) 	
-			{	constant = FORMAT_ERROR; return ;}
+			{	return /*constant stays null*/ ;}
 			computedValue = (computedValue<<shift) | digitValue ;
 			if (computedValue > MAX) return /*constant stays null*/ ;}}
 	else
@@ -79,7 +78,7 @@
 		for (int i = 0 ; i < length;i++)
 		{	int digitValue ;
 			if ((digitValue = ScannerHelper.digit(source[i],10))	< 0 ) 
-			{	constant = FORMAT_ERROR; return ;}
+			{	return /*constant stays null*/ ; }
 			computedValue = 10*computedValue + digitValue;
 			if (computedValue > MAX) return /*constant stays null*/ ; }}
 
@@ -122,19 +121,6 @@
 			(source[9] == '8') &&
 			(((this.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) == 0));
 }
-public TypeBinding resolveType(BlockScope scope) {
-	// the format may be incorrect while the scanner could detect
-	// such an error only on painfull tests...easier and faster here
-
-	TypeBinding tb = super.resolveType(scope);
-	if (constant == FORMAT_ERROR) {
-		constant = Constant.NotAConstant;
-		scope.problemReporter().constantOutOfFormat(this);
-		this.resolvedType = null;
-		return null;
-	}
-	return tb;
-}
 public StringBuffer printExpression(int indent, StringBuffer output){
 
 	if (source == null) {