Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 124424 Details for
Bug 261510
[compiler] Deadlock in static initializer of JDT classes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Better patch
261510.txt (text/plain), 83.39 KB, created by
Philipe Mulet
on 2009-02-02 10:12:35 EST
(
hide
)
Description:
Better patch
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2009-02-02 10:12:35 EST
Size:
83.39 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/CharLiteral.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CharLiteral.java,v >retrieving revision 1.19 >diff -u -r1.19 CharLiteral.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/CharLiteral.java 27 Jun 2008 16:03:56 -0000 1.19 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/CharLiteral.java 2 Feb 2009 15:12:01 -0000 >@@ -17,23 +17,25 @@ > import org.eclipse.jdt.internal.compiler.parser.ScannerHelper; > > public class CharLiteral extends NumberLiteral { >+ > char value; >+ > public CharLiteral(char[] token, int s, int e) { > super(token, s, e); > computeValue(); > } >+ > public void computeConstant() { > //The source is a char[3] first and last char are ' > //This is true for both regular char AND unicode char > //BUT not for escape char like '\b' which are char[4].... >- > this.constant = CharConstant.fromValue(this.value); > } >+ > private void computeValue() { > //The source is a char[3] first and last char are ' > //This is true for both regular char AND unicode char > //BUT not for escape char like '\b' which are char[4].... >- > if ((this.value = this.source[1]) != '\\') > return; > char digit; >@@ -76,6 +78,7 @@ > break; > } > } >+ > /** > * CharLiteral code generation > * >@@ -90,9 +93,11 @@ > } > codeStream.recordPositionsFrom(pc, this.sourceStart); > } >+ > public TypeBinding literalType(BlockScope scope) { > return TypeBinding.CHAR; > } >+ > public void traverse(ASTVisitor visitor, BlockScope blockScope) { > visitor.visit(this, blockScope); > visitor.endVisit(this, blockScope); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/TrueLiteral.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TrueLiteral.java,v >retrieving revision 1.17 >diff -u -r1.17 TrueLiteral.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/TrueLiteral.java 27 Jun 2008 16:03:55 -0000 1.17 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/TrueLiteral.java 2 Feb 2009 15:12:01 -0000 >@@ -18,7 +18,9 @@ > import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; > > public class TrueLiteral extends MagicLiteral { >+ > static final char[] source = {'t' , 'r' , 'u' , 'e'}; >+ > public TrueLiteral(int s , int e) { > super(s,e); > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/FalseLiteral.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FalseLiteral.java,v >retrieving revision 1.17 >diff -u -r1.17 FalseLiteral.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/FalseLiteral.java 27 Jun 2008 16:03:55 -0000 1.17 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/FalseLiteral.java 2 Feb 2009 15:12:01 -0000 >@@ -18,7 +18,9 @@ > import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; > > public class FalseLiteral extends MagicLiteral { >+ > static final char[] source = {'f', 'a', 'l', 's', 'e'}; >+ > public FalseLiteral(int s , int e) { > super(s,e); > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/FloatLiteral.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FloatLiteral.java,v >retrieving revision 1.19 >diff -u -r1.19 FloatLiteral.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/FloatLiteral.java 27 Jun 2008 16:03:55 -0000 1.19 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/FloatLiteral.java 2 Feb 2009 15:12:01 -0000 >@@ -18,98 +18,102 @@ > import org.eclipse.jdt.internal.compiler.util.FloatUtil; > > public class FloatLiteral extends NumberLiteral { >+ > float value; >- final static float Float_MIN_VALUE = Float.intBitsToFloat(1); // work-around VAJ problem 1F6IGUU >- public FloatLiteral(char[] token, int s, int e) { >- super(token, s, e); >- } >- public void computeConstant() { >- Float computedValue; >+ >+public FloatLiteral(char[] token, int s, int e) { >+ super(token, s, e); >+} >+ >+public void computeConstant() { >+ Float computedValue; >+ try { >+ computedValue = Float.valueOf(String.valueOf(this.source)); >+ } catch (NumberFormatException e) { >+ // hex floating point literal >+ // being rejected by 1.4 libraries where Float.valueOf(...) doesn't handle hex decimal floats > try { >- computedValue = Float.valueOf(String.valueOf(this.source)); >- } catch (NumberFormatException e) { >- // hex floating point literal >- // being rejected by 1.4 libraries where Float.valueOf(...) doesn't handle hex decimal floats >- try { >- float v = FloatUtil.valueOfHexFloatLiteral(this.source); >- if (v == Float.POSITIVE_INFINITY) { >- // error: the number is too large to represent >- return; >- } >- if (Float.isNaN(v)) { >- // error: the number is too small to represent >- return; >- } >- this.value = v; >- this.constant = FloatConstant.fromValue(v); >- } catch (NumberFormatException e1) { >- // if the computation of the constant fails >+ float v = FloatUtil.valueOfHexFloatLiteral(this.source); >+ if (v == Float.POSITIVE_INFINITY) { >+ // error: the number is too large to represent >+ return; > } >- return; >- } >- >- final float floatValue = computedValue.floatValue(); >- if (floatValue > Float.MAX_VALUE) { >- // error: the number is too large to represent >- return; >- } >- if (floatValue < Float.MIN_VALUE) { >- // see 1F6IGUU >- // a true 0 only has '0' and '.' in mantissa >- // 1.0e-5000d is non-zero, but underflows to 0 >- boolean isHexaDecimal = false; >- label : for (int i = 0; i < this.source.length; i++) { //it is welled formated so just test against '0' and potential . D d >- switch (this.source[i]) { >- case '0' : >- case '.' : >- break; >- case 'x' : >- case 'X' : >- isHexaDecimal = true; >- break; >- case 'e' : >- case 'E' : >- case 'f' : >- case 'F' : >- case 'd' : >- case 'D' : >- if (isHexaDecimal) { >- return; >- } >- // starting the exponent - mantissa is all zero >- // no exponent - mantissa is all zero >- break label; >- case 'p' : >- case 'P' : >- break label; >- default : >- // error: the number is too small to represent >- return; >- } >+ if (Float.isNaN(v)) { >+ // error: the number is too small to represent >+ return; > } >+ this.value = v; >+ this.constant = FloatConstant.fromValue(v); >+ } catch (NumberFormatException e1) { >+ // if the computation of the constant fails > } >- this.value = floatValue; >- this.constant = FloatConstant.fromValue(this.value); >+ return; > } >- /** >- * Code generation for float literal >- * >- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope >- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream >- * @param valueRequired boolean >- */ >- public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { >- int pc = codeStream.position; >- if (valueRequired) { >- codeStream.generateConstant(this.constant, this.implicitConversion); >- } >- codeStream.recordPositionsFrom(pc, this.sourceStart); >+ final float floatValue = computedValue.floatValue(); >+ if (floatValue > Float.MAX_VALUE) { >+ // error: the number is too large to represent >+ return; > } >- public TypeBinding literalType(BlockScope scope) { >- return TypeBinding.FLOAT; >+ if (floatValue < Float.MIN_VALUE) { >+ // see 1F6IGUU >+ // a true 0 only has '0' and '.' in mantissa >+ // 1.0e-5000d is non-zero, but underflows to 0 >+ boolean isHexaDecimal = false; >+ label : for (int i = 0; i < this.source.length; i++) { //it is welled formated so just test against '0' and potential . D d >+ switch (this.source[i]) { >+ case '0' : >+ case '.' : >+ break; >+ case 'x' : >+ case 'X' : >+ isHexaDecimal = true; >+ break; >+ case 'e' : >+ case 'E' : >+ case 'f' : >+ case 'F' : >+ case 'd' : >+ case 'D' : >+ if (isHexaDecimal) { >+ return; >+ } >+ // starting the exponent - mantissa is all zero >+ // no exponent - mantissa is all zero >+ break label; >+ case 'p' : >+ case 'P' : >+ break label; >+ default : >+ // error: the number is too small to represent >+ return; >+ } >+ } > } >- public void traverse(ASTVisitor visitor, BlockScope scope) { >- visitor.visit(this, scope); >- visitor.endVisit(this, scope); >+ this.value = floatValue; >+ this.constant = FloatConstant.fromValue(this.value); >+} >+ >+/** >+ * Code generation for float literal >+ * >+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope >+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream >+ * @param valueRequired boolean >+ */ >+public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { >+ int pc = codeStream.position; >+ if (valueRequired) { >+ codeStream.generateConstant(this.constant, this.implicitConversion); > } >+ codeStream.recordPositionsFrom(pc, this.sourceStart); >+} >+ >+public TypeBinding literalType(BlockScope scope) { >+ return TypeBinding.FLOAT; >+} >+ >+public void traverse(ASTVisitor visitor, BlockScope scope) { >+ visitor.visit(this, scope); >+ visitor.endVisit(this, scope); >+} > } >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.26 >diff -u -r1.26 LongLiteral.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java 27 Jun 2008 16:03:56 -0000 1.26 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java 2 Feb 2009 15:12:01 -0000 >@@ -17,16 +17,15 @@ > 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); > } >+ > public void computeConstant() { > //the overflow (when radix=10) is tested using the fact that > //the value should always grow during its computation > int length = this.source.length - 1; //minus one because the last char is 'l' or 'L' >- > long computedValue ; > if (this.source[0] == '0') { > if (length == 1) { >@@ -46,13 +45,13 @@ > if ( j == length) { > //watch for 0000000000000L > this.constant = LongConstant.fromValue(0L); >- return ; >+ return; > } > } > > int digitValue ; > if ((digitValue = ScannerHelper.digit(this.source[j++],radix)) < 0 ) { >- this.constant = FORMAT_ERROR; return ; >+ return; /*constant stays null*/ > } > if (digitValue >= 8) > nbDigit = 4; >@@ -65,10 +64,10 @@ > computedValue = digitValue ; > while (j<length) { > if ((digitValue = ScannerHelper.digit(this.source[j++],radix)) < 0) { >- this.constant = FORMAT_ERROR; return ; >+ return; /*constant stays null*/ > } > if ((nbDigit += shift) > 64) >- return /*constant stays null*/ ; >+ return; /*constant stays null*/ > computedValue = (computedValue<<shift) | digitValue ; > } > } else { >@@ -81,17 +80,18 @@ > if ((digitValue = ScannerHelper.digit(this.source[i], 10)) < 0 ) return /*constant stays null*/; > previous = computedValue; > if (computedValue > limit) >- return /*constant stays null*/; >+ return; /*constant stays null*/ > computedValue *= 10; > if ((computedValue + digitValue) > Long.MAX_VALUE) >- return /*constant stays null*/; >+ return; /*constant stays null*/ > computedValue += digitValue; > if (previous > computedValue) >- return /*constant stays null*/; >+ return; /*constant stays null*/ > } > } > this.constant = LongConstant.fromValue(computedValue); > } >+ > /** > * Code generation for long literal > * >@@ -106,15 +106,16 @@ > } > codeStream.recordPositionsFrom(pc, this.sourceStart); > } >+ > public TypeBinding literalType(BlockScope scope) { > return TypeBinding.LONG; > } >+ > public final boolean mayRepresentMIN_VALUE(){ > //a special autorized int literral is 9223372036854775808L > //which is ONE over the limit. This special case > //only is used in combinaison with - to denote > //the minimal value of int -9223372036854775808L >- > return ((this.source.length == 20) && > (this.source[0] == '9') && > (this.source[1] == '2') && >@@ -137,19 +138,7 @@ > (this.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 (this.constant == FORMAT_ERROR) { >- this.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/UnaryExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java,v >retrieving revision 1.51 >diff -u -r1.51 UnaryExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java 27 Jun 2008 16:03:56 -0000 1.51 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java 2 Feb 2009 15:12:01 -0000 >@@ -206,7 +206,6 @@ > } > > public TypeBinding resolveType(BlockScope scope) { >- > boolean expressionIsCast; > if ((expressionIsCast = this.expression instanceof CastExpression) == true) this.expression.bits |= DisableUnnecessaryCastCheck; // will check later on > TypeBinding expressionType = this.expression.resolveType(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.13 >diff -u -r1.13 LongLiteralMinValue.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java 27 Jun 2008 16:03:55 -0000 1.13 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java 2 Feb 2009 15:12:01 -0000 >@@ -15,13 +15,11 @@ > 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); >- this.constant = MIN_VALUE; >+ this.constant = LongConstant.fromValue(Long.MIN_VALUE); > } > public void computeConstant() { >- > /*precomputed at creation time*/} > } >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.24 >diff -u -r1.24 IntLiteral.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java 27 Jun 2008 16:03:56 -0000 1.24 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java 2 Feb 2009 15:12:01 -0000 >@@ -17,22 +17,22 @@ > import org.eclipse.jdt.internal.compiler.parser.ScannerHelper; > > public class IntLiteral extends NumberLiteral { >+ > public int value; > >- 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 static final IntLiteral One = new IntLiteral(new char[]{'1'},0,0,1);//used for ++ and -- >+ > public IntLiteral(char[] token, int s, int e) { > super(token, s,e); > } >+ > public IntLiteral(char[] token, int s,int e, int value) { > this(token, s,e); > this.value = value; > } >+ > public IntLiteral(int intValue) { > //special optimized constructor : the cst is the argument >- > //value that should not be used > // tokens = null ; > // sourceStart = 0; >@@ -40,52 +40,62 @@ > super(null,0,0); > this.constant = IntConstant.fromValue(intValue); > this.value = intValue; >- > } >+ > public void computeConstant() { > //a special constant is use for the potential Integer.MAX_VALUE+1 > //which is legal if used with a - as prefix....cool.... > //notice that Integer.MIN_VALUE == -2147483648 >- > long MAX = Integer.MAX_VALUE; >- if (this == One) { this.constant = IntConstant.fromValue(1); return ;} >- >+ if (this == One) { >+ this.constant = IntConstant.fromValue(1); >+ return ; >+ } > int length = this.source.length; > long computedValue = 0L; >- if (this.source[0] == '0') >- { MAX = 0xFFFFFFFFL ; //a long in order to be positive ! >- if (length == 1) { this.constant = IntConstant.fromValue(0); return ;} >+ if (this.source[0] == '0') { >+ MAX = 0xFFFFFFFFL ; //a long in order to be positive ! >+ if (length == 1) { >+ this.constant = IntConstant.fromValue(0); return ; >+ } > final int shift,radix; > int j ; >- if ( (this.source[1] == 'x') || (this.source[1] == 'X') ) >- { shift = 4 ; j = 2; radix = 16;} >- else >- { shift = 3 ; j = 1; radix = 8;} >- while (this.source[j]=='0') >- { j++; //jump over redondant zero >- if (j == length) >- { //watch for 000000000000000000 >+ if ((this.source[1] == 'x') || (this.source[1] == 'X')) { >+ shift = 4 ; j = 2; radix = 16; >+ } else { >+ shift = 3 ; j = 1; radix = 8; >+ } >+ while (this.source[j]=='0') { >+ j++; //jump over redondant zero >+ if (j == length) { >+ //watch for 000000000000000000 > this.constant = IntConstant.fromValue(this.value = (int)computedValue); >- return ;}} >- >- while (j<length) >- { int digitValue ; >- if ((digitValue = ScannerHelper.digit(this.source[j++],radix)) < 0 ) >- { this.constant = FORMAT_ERROR; return ;} >+ return; >+ } >+ } >+ while (j<length) { >+ int digitValue ; >+ if ((digitValue = ScannerHelper.digit(this.source[j++],radix)) < 0 ) { >+ return; /*constant stays null*/ >+ } > computedValue = (computedValue<<shift) | digitValue ; >- if (computedValue > MAX) return /*constant stays null*/ ;}} >- else >- { //-----------regular case : radix = 10----------- >- for (int i = 0 ; i < length;i++) >- { int digitValue ; >- if ((digitValue = ScannerHelper.digit(this.source[i],10)) < 0 ) >- { this.constant = FORMAT_ERROR; return ;} >+ if (computedValue > MAX) return; /*constant stays null*/ >+ } >+ } else { >+ //-----------regular case : radix = 10----------- >+ for (int i = 0 ; i < length;i++) { >+ int digitValue ; >+ if ((digitValue = ScannerHelper.digit(this.source[i],10)) < 0 ) { >+ return; /*constant stays null*/ >+ } > computedValue = 10*computedValue + digitValue; >- if (computedValue > MAX) return /*constant stays null*/ ; }} >- >+ if (computedValue > MAX) return /*constant stays null*/ ; >+ } >+ } > this.constant = IntConstant.fromValue(this.value = (int)computedValue); > > } >+ > /** > * Code generation for int literal > * >@@ -100,15 +110,16 @@ > } > codeStream.recordPositionsFrom(pc, this.sourceStart); > } >+ > public TypeBinding literalType(BlockScope scope) { > return TypeBinding.INT; > } >+ > public final boolean mayRepresentMIN_VALUE(){ > //a special autorized int literral is 2147483648 > //which is ONE over the limit. This special case > //only is used in combinaison with - to denote > //the minimal value of int -2147483648 >- > return ((this.source.length == 10) && > (this.source[0] == '2') && > (this.source[1] == '1') && >@@ -122,21 +133,8 @@ > (this.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 (this.constant == FORMAT_ERROR) { >- this.constant = Constant.NotAConstant; >- scope.problemReporter().constantOutOfFormat(this); >- this.resolvedType = null; >- return null; >- } >- return tb; >-} >-public StringBuffer printExpression(int indent, StringBuffer output){ > >+public StringBuffer printExpression(int indent, StringBuffer output){ > if (this.source == null) { > /* special optimized IntLiteral that are created by the compiler */ > return output.append(String.valueOf(this.value)); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/DoubleLiteral.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoubleLiteral.java,v >retrieving revision 1.19 >diff -u -r1.19 DoubleLiteral.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/DoubleLiteral.java 27 Jun 2008 16:03:55 -0000 1.19 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/DoubleLiteral.java 2 Feb 2009 15:12:01 -0000 >@@ -17,97 +17,102 @@ > import org.eclipse.jdt.internal.compiler.util.FloatUtil; > > public class DoubleLiteral extends NumberLiteral { >+ > double value; >- public DoubleLiteral(char[] token, int s, int e) { >- super(token, s, e); >- } >- public void computeConstant() { >- Double computedValue; >+ >+public DoubleLiteral(char[] token, int s, int e) { >+ super(token, s, e); >+} >+ >+public void computeConstant() { >+ Double computedValue; >+ try { >+ computedValue = Double.valueOf(String.valueOf(this.source)); >+ } catch (NumberFormatException e) { >+ // hex floating point literal >+ // being rejected by 1.4 libraries where Double.valueOf(...) doesn't handle hex decimal floats > try { >- computedValue = Double.valueOf(String.valueOf(this.source)); >- } catch (NumberFormatException e) { >- // hex floating point literal >- // being rejected by 1.4 libraries where Double.valueOf(...) doesn't handle hex decimal floats >- try { >- double v = FloatUtil.valueOfHexDoubleLiteral(this.source); >- if (v == Double.POSITIVE_INFINITY) { >- // error: the number is too large to represent >- return; >- } >- if (Double.isNaN(v)) { >- // error: the number is too small to represent >- return; >- } >- this.value = v; >- this.constant = DoubleConstant.fromValue(v); >- } catch (NumberFormatException e1) { >- // if the computation of the constant fails >+ double v = FloatUtil.valueOfHexDoubleLiteral(this.source); >+ if (v == Double.POSITIVE_INFINITY) { >+ // error: the number is too large to represent >+ return; > } >- return; >- } >- >- final double doubleValue = computedValue.doubleValue(); >- if (doubleValue > Double.MAX_VALUE) { >- // error: the number is too large to represent >- return; >- } >- if (doubleValue < Double.MIN_VALUE) { >- // see 1F6IGUU >- // a true 0 only has '0' and '.' in mantissa >- // 1.0e-5000d is non-zero, but underflows to 0 >- boolean isHexaDecimal = false; >- label : for (int i = 0; i < this.source.length; i++) { //it is welled formated so just test against '0' and potential . D d >- switch (this.source[i]) { >- case '0' : >- case '.' : >- break; >- case 'x' : >- case 'X' : >- isHexaDecimal = true; >- break; >- case 'e' : >- case 'E' : >- case 'f' : >- case 'F' : >- case 'd' : >- case 'D' : >- if (isHexaDecimal) { >- return; >- } >- // starting the exponent - mantissa is all zero >- // no exponent - mantissa is all zero >- break label; >- case 'p' : >- case 'P' : >- break label; >- default : >- // error: the number is too small to represent >- return; >- } >+ if (Double.isNaN(v)) { >+ // error: the number is too small to represent >+ return; > } >+ this.value = v; >+ this.constant = DoubleConstant.fromValue(v); >+ } catch (NumberFormatException e1) { >+ // if the computation of the constant fails > } >- this.value = doubleValue; >- this.constant = DoubleConstant.fromValue(this.value); >+ return; > } >- /** >- * Code generation for the double literak >- * >- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope >- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream >- * @param valueRequired boolean >- */ >- public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { >- int pc = codeStream.position; >- if (valueRequired) { >- codeStream.generateConstant(this.constant, this.implicitConversion); >- } >- codeStream.recordPositionsFrom(pc, this.sourceStart); >+ final double doubleValue = computedValue.doubleValue(); >+ if (doubleValue > Double.MAX_VALUE) { >+ // error: the number is too large to represent >+ return; > } >- public TypeBinding literalType(BlockScope scope) { >- return TypeBinding.DOUBLE; >+ if (doubleValue < Double.MIN_VALUE) { >+ // see 1F6IGUU >+ // a true 0 only has '0' and '.' in mantissa >+ // 1.0e-5000d is non-zero, but underflows to 0 >+ boolean isHexaDecimal = false; >+ label : for (int i = 0; i < this.source.length; i++) { //it is welled formated so just test against '0' and potential . D d >+ switch (this.source[i]) { >+ case '0' : >+ case '.' : >+ break; >+ case 'x' : >+ case 'X' : >+ isHexaDecimal = true; >+ break; >+ case 'e' : >+ case 'E' : >+ case 'f' : >+ case 'F' : >+ case 'd' : >+ case 'D' : >+ if (isHexaDecimal) { >+ return; >+ } >+ // starting the exponent - mantissa is all zero >+ // no exponent - mantissa is all zero >+ break label; >+ case 'p' : >+ case 'P' : >+ break label; >+ default : >+ // error: the number is too small to represent >+ return; >+ } >+ } > } >- public void traverse(ASTVisitor visitor, BlockScope scope) { >- visitor.visit(this, scope); >- visitor.endVisit(this, scope); >+ this.value = doubleValue; >+ this.constant = DoubleConstant.fromValue(this.value); >+} >+ >+/** >+ * Code generation for the double literak >+ * >+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope >+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream >+ * @param valueRequired boolean >+ */ >+public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { >+ int pc = codeStream.position; >+ if (valueRequired) { >+ codeStream.generateConstant(this.constant, this.implicitConversion); > } >+ codeStream.recordPositionsFrom(pc, this.sourceStart); >+} >+ >+public TypeBinding literalType(BlockScope scope) { >+ return TypeBinding.DOUBLE; >+} >+ >+public void traverse(ASTVisitor visitor, BlockScope scope) { >+ visitor.visit(this, scope); >+ visitor.endVisit(this, scope); >+} > } >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.11 >diff -u -r1.11 IntLiteralMinValue.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java 27 Jun 2008 16:03:55 -0000 1.11 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java 2 Feb 2009 15:12:01 -0000 >@@ -15,13 +15,12 @@ > 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); >- this.constant = MIN_VALUE; >+ this.constant = IntConstant.fromValue(Integer.MIN_VALUE); > } >-public void computeConstant(){ > >+public void computeConstant(){ > /*precomputed at creation time*/ } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/NumberLiteral.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NumberLiteral.java,v >retrieving revision 1.12 >diff -u -r1.12 NumberLiteral.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/NumberLiteral.java 27 Jun 2008 16:03:55 -0000 1.12 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/NumberLiteral.java 2 Feb 2009 15:12:01 -0000 >@@ -15,7 +15,6 @@ > char[] source; > > public NumberLiteral(char[] token, int s, int e) { >- > this(s,e) ; > this.source = token ; > } >@@ -25,12 +24,10 @@ > } > > public boolean isValidJavaStatement(){ >- > return false ; > } > > public char[] source(){ >- > return this.source; > } > } >Index: compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java,v >retrieving revision 1.13 >diff -u -r1.13 ReferenceContext.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java 28 Mar 2006 20:33:19 -0000 1.13 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java 2 Feb 2009 15:12:01 -0000 >@@ -9,6 +9,7 @@ > * IBM Corporation - initial API and implementation > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.impl; >+ > /* > * Implementors are valid compilation contexts from which we can > * escape in case of error: >@@ -19,8 +20,12 @@ > import org.eclipse.jdt.internal.compiler.CompilationResult; > > public interface ReferenceContext { >+ > void abort(int abortLevel, CategorizedProblem problem); >+ > CompilationResult compilationResult(); >+ > boolean hasErrors(); >+ > void tagAsHavingErrors(); > } >Index: compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java,v >retrieving revision 1.24 >diff -u -r1.24 ShortConstant.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java 27 Jun 2008 16:04:14 -0000 1.24 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java 2 Feb 2009 15:12:01 -0000 >@@ -11,43 +11,56 @@ > package org.eclipse.jdt.internal.compiler.impl; > > public class ShortConstant extends Constant { >-private short value; >+ >+ private short value; > >-public static Constant fromValue(short value) { >- return new ShortConstant(value); >-} >-private ShortConstant(short value) { >- this.value = value; >-} >-public byte byteValue() { >- return (byte) this.value; >-} >-public char charValue() { >- return (char) this.value; >-} >-public double doubleValue() { >- return this.value; // implicit cast to return type >-} >-public float floatValue() { >- return this.value; // implicit cast to return type >-} >-public int intValue() { >- return this.value; // implicit cast to return type >-} >-public long longValue() { >- return this.value; // implicit cast to return type >-} >-public short shortValue() { >- return this.value; >-} >-public String stringValue() { >- //spec 15.17.11 >- return String.valueOf(this.value); >-} >-public String toString(){ >+ public static Constant fromValue(short value) { >+ return new ShortConstant(value); >+ } > >- return "(short)" + this.value ; } //$NON-NLS-1$ >-public int typeID() { >- return T_short; >-} >+ private ShortConstant(short value) { >+ this.value = value; >+ } >+ >+ public byte byteValue() { >+ return (byte) this.value; >+ } >+ >+ public char charValue() { >+ return (char) this.value; >+ } >+ >+ public double doubleValue() { >+ return this.value; // implicit cast to return type >+ } >+ >+ public float floatValue() { >+ return this.value; // implicit cast to return type >+ } >+ >+ public int intValue() { >+ return this.value; // implicit cast to return type >+ } >+ >+ public long longValue() { >+ return this.value; // implicit cast to return type >+ } >+ >+ public short shortValue() { >+ return this.value; >+ } >+ >+ public String stringValue() { >+ // spec 15.17.11 >+ return String.valueOf(this.value); >+ } >+ >+ public String toString() { >+ >+ return "(short)" + this.value; //$NON-NLS-1$ >+ } >+ >+ public int typeID() { >+ return T_short; >+ } > } >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.24 >diff -u -r1.24 LongConstant.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java 27 Jun 2008 16:04:13 -0000 1.24 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java 2 Feb 2009 15:12:01 -0000 >@@ -11,47 +11,63 @@ > package org.eclipse.jdt.internal.compiler.impl; > > public class LongConstant extends Constant { >-private static final LongConstant ZERO = new LongConstant(0L); > >-private long value; >+ 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); > } >+ > private LongConstant(long value) { > this.value = value; > } >+ > public byte byteValue() { > return (byte) this.value; > } >+ > public char charValue() { > return (char) this.value; > } >+ > public double doubleValue() { > return this.value; // implicit cast to return type > } >+ > public float floatValue() { > return this.value; // implicit cast to return type > } >+ > public int intValue() { > return (int) this.value; > } >+ > public long longValue() { > return this.value; > } >+ > public short shortValue() { > return (short) this.value; > } >+ > public String stringValue() { > //spec 15.17.11 > return String.valueOf(this.value); > } >+ > public String toString(){ > >- return "(long)" + this.value ; } //$NON-NLS-1$ >+ return "(long)" + this.value ; //$NON-NLS-1$ >+} >+ > public int typeID() { > return T_long; > } >Index: compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java,v >retrieving revision 1.30 >diff -u -r1.30 BooleanConstant.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java 27 Jun 2008 16:04:13 -0000 1.30 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java 2 Feb 2009 15:12:01 -0000 >@@ -12,32 +12,33 @@ > > public class BooleanConstant extends Constant { > >-private boolean value; >+ private boolean value; > >-private static final BooleanConstant TRUE = new BooleanConstant(true); >-private static final BooleanConstant FALSE = new BooleanConstant(false); >+ private static final BooleanConstant TRUE = new BooleanConstant(true); >+ private static final BooleanConstant FALSE = new BooleanConstant(false); > >-public static BooleanConstant fromValue(boolean value) { >- return value ? BooleanConstant.TRUE : BooleanConstant.FALSE; >-} >-private BooleanConstant(boolean value) { >- this.value = value; >-} >- >-public boolean booleanValue() { >- return this.value; >-} >- >-public String stringValue() { >- //spec 15.17.11 >- return String.valueOf(this.value); >-} >- >-public String toString(){ >- return "(boolean)" + this.value ; //$NON-NLS-1$ >-} >- >-public int typeID() { >- return T_boolean; >-} >+ public static BooleanConstant fromValue(boolean value) { >+ return value ? BooleanConstant.TRUE : BooleanConstant.FALSE; >+ } >+ >+ private BooleanConstant(boolean value) { >+ this.value = value; >+ } >+ >+ public boolean booleanValue() { >+ return this.value; >+ } >+ >+ public String stringValue() { >+ // spec 15.17.11 >+ return String.valueOf(this.value); >+ } >+ >+ public String toString() { >+ return "(boolean)" + this.value; //$NON-NLS-1$ >+ } >+ >+ public int typeID() { >+ return T_boolean; >+ } > } >Index: compiler/org/eclipse/jdt/internal/compiler/impl/StringConstant.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/StringConstant.java,v >retrieving revision 1.24 >diff -u -r1.24 StringConstant.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/StringConstant.java 27 Jun 2008 16:04:13 -0000 1.24 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/StringConstant.java 2 Feb 2009 15:12:01 -0000 >@@ -11,36 +11,32 @@ > package org.eclipse.jdt.internal.compiler.impl; > > public class StringConstant extends Constant { >-private String value; > >+ private String value; > >-public static Constant fromValue(String value) { >- return new StringConstant(value); >-} >- >-private StringConstant(String value) { >- this.value = value ; >-} >- >-public String stringValue() { >- //spec 15.17.11 >- >- //the next line do not go into the toString() send....! >- return this.value ; >- >- /* >- String s = value.toString() ; >- if (s == null) >- return "null"; >- else >- return s; >- */ >- >-} >-public String toString(){ >- >- return "(String)\"" + this.value +"\""; } //$NON-NLS-2$ //$NON-NLS-1$ >-public int typeID() { >- return T_JavaLangString; >-} >+ public static Constant fromValue(String value) { >+ return new StringConstant(value); >+ } >+ >+ private StringConstant(String value) { >+ this.value = value; >+ } >+ >+ public String stringValue() { >+ // spec 15.17.11 >+ >+ // the next line do not go into the toString() send....! >+ return this.value; >+ /* >+ * String s = value.toString() ; if (s == null) return "null"; else return s; >+ */ >+ } >+ >+ public String toString() { >+ return "(String)\"" + this.value + "\""; //$NON-NLS-2$ //$NON-NLS-1$ >+ } >+ >+ public int typeID() { >+ return T_JavaLangString; >+ } > } >Index: compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java,v >retrieving revision 1.35 >diff -u -r1.35 Constant.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java 3 Sep 2008 11:37:25 -0000 1.35 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java 2 Feb 2009 15:12:01 -0000 >@@ -18,14 +18,12 @@ > public abstract class Constant implements TypeIds, OperatorIds { > > public static final Constant NotAConstant = DoubleConstant.fromValue(Double.NaN); >- >+ > public boolean booleanValue() { >- > throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "boolean" })); //$NON-NLS-1$ > } > > public byte byteValue() { >- > throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "byte" })); //$NON-NLS-1$ > } > >@@ -195,17 +193,14 @@ > case (T_int<<4)+T_int : return this; > > } >- > return NotAConstant; > } > > public char charValue() { >- > throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "char" })); //$NON-NLS-1$ > } > > public static final Constant computeConstantOperation(Constant cst, int id, int operator) { >- > switch (operator) { > case NOT : > return BooleanConstant.fromValue(!cst.booleanValue()); >@@ -245,7 +240,6 @@ > } > > public static final Constant computeConstantOperation(Constant left, int leftId, int operator, Constant right, int rightId) { >- > switch (operator) { > case AND : return computeConstantOperationAND (left,leftId,right,rightId); > case AND_AND : return computeConstantOperationAND_AND (left,leftId,right,rightId); >@@ -264,13 +258,11 @@ > case RIGHT_SHIFT: return computeConstantOperationRIGHT_SHIFT(left,leftId,right,rightId); > case UNSIGNED_RIGHT_SHIFT: return computeConstantOperationUNSIGNED_RIGHT_SHIFT(left,leftId,right,rightId); > case XOR : return computeConstantOperationXOR (left,leftId,right,rightId); >- > default : return NotAConstant; > } > } > > public static final Constant computeConstantOperationAND(Constant left, int leftId, Constant right, int rightId) { >- > switch (leftId){ > case T_boolean : return BooleanConstant.fromValue(left.booleanValue() & right.booleanValue()); > case T_char : >@@ -281,7 +273,7 @@ > case T_int: return IntConstant.fromValue(left.charValue() & right.intValue()); > case T_long: return LongConstant.fromValue(left.charValue() & right.longValue()); > } >- break; >+ break; > case T_byte : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.byteValue() & right.charValue()); >@@ -290,7 +282,7 @@ > case T_int: return IntConstant.fromValue(left.byteValue() & right.intValue()); > case T_long: return LongConstant.fromValue(left.byteValue() & right.longValue()); > } >- break; >+ break; > case T_short : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.shortValue() & right.charValue()); >@@ -299,7 +291,7 @@ > case T_int: return IntConstant.fromValue(left.shortValue() & right.intValue()); > case T_long: return LongConstant.fromValue(left.shortValue() & right.longValue()); > } >- break; >+ break; > case T_int : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.intValue() & right.charValue()); >@@ -308,7 +300,7 @@ > case T_int: return IntConstant.fromValue(left.intValue() & right.intValue()); > case T_long: return LongConstant.fromValue(left.intValue() & right.longValue()); > } >- break; >+ break; > case T_long : > switch (rightId){ > case T_char : return LongConstant.fromValue(left.longValue() & right.charValue()); >@@ -317,19 +309,16 @@ > case T_int: return LongConstant.fromValue(left.longValue() & right.intValue()); > case T_long: return LongConstant.fromValue(left.longValue() & right.longValue()); > } >- } >- >+ } > return NotAConstant; > } > > public static final Constant computeConstantOperationAND_AND(Constant left, int leftId, Constant right, int rightId) { >- > return BooleanConstant.fromValue(left.booleanValue() && right.booleanValue()); > } > > public static final Constant computeConstantOperationDIVIDE(Constant left, int leftId, Constant right, int rightId) { > // division by zero must be handled outside this method (error reporting) >- > switch (leftId){ > case T_char : > switch (rightId){ >@@ -341,7 +330,7 @@ > case T_int: return IntConstant.fromValue(left.charValue() / right.intValue()); > case T_long: return LongConstant.fromValue(left.charValue() / right.longValue()); > } >- break; >+ break; > case T_float : > switch (rightId){ > case T_char : return FloatConstant.fromValue(left.floatValue() / right.charValue()); >@@ -352,7 +341,7 @@ > case T_int: return FloatConstant.fromValue(left.floatValue() / right.intValue()); > case T_long: return FloatConstant.fromValue(left.floatValue() / right.longValue()); > } >- break; >+ break; > case T_double : > switch (rightId){ > case T_char : return DoubleConstant.fromValue(left.doubleValue() / right.charValue()); >@@ -363,7 +352,7 @@ > case T_int: return DoubleConstant.fromValue(left.doubleValue() / right.intValue()); > case T_long: return DoubleConstant.fromValue(left.doubleValue() / right.longValue()); > } >- break; >+ break; > case T_byte : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.byteValue() / right.charValue()); >@@ -374,7 +363,7 @@ > case T_int: return IntConstant.fromValue(left.byteValue() / right.intValue()); > case T_long: return LongConstant.fromValue(left.byteValue() / right.longValue()); > } >- break; >+ break; > case T_short : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.shortValue() / right.charValue()); >@@ -385,7 +374,7 @@ > case T_int: return IntConstant.fromValue(left.shortValue() / right.intValue()); > case T_long: return LongConstant.fromValue(left.shortValue() / right.longValue()); > } >- break; >+ break; > case T_int : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.intValue() / right.charValue()); >@@ -396,7 +385,7 @@ > case T_int: return IntConstant.fromValue(left.intValue() / right.intValue()); > case T_long: return LongConstant.fromValue(left.intValue() / right.longValue()); > } >- break; >+ break; > case T_long : > switch (rightId){ > case T_char : return LongConstant.fromValue(left.longValue() / right.charValue()); >@@ -407,20 +396,17 @@ > case T_int: return LongConstant.fromValue(left.longValue() / right.intValue()); > case T_long: return LongConstant.fromValue(left.longValue() / right.longValue()); > } >- >- } >- >+ } > return NotAConstant; > } > > public static final Constant computeConstantOperationEQUAL_EQUAL(Constant left, int leftId, Constant right, int rightId) { >- > switch (leftId){ > case T_boolean : > if (rightId == T_boolean) { > return BooleanConstant.fromValue(left.booleanValue() == right.booleanValue()); > } >- break; >+ break; > case T_char : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.charValue() == right.charValue()); >@@ -430,7 +416,7 @@ > case T_short: return BooleanConstant.fromValue(left.charValue() == right.shortValue()); > case T_int: return BooleanConstant.fromValue(left.charValue() == right.intValue()); > case T_long: return BooleanConstant.fromValue(left.charValue() == right.longValue());} >- break; >+ break; > case T_float : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.floatValue() == right.charValue()); >@@ -441,7 +427,7 @@ > case T_int: return BooleanConstant.fromValue(left.floatValue() == right.intValue()); > case T_long: return BooleanConstant.fromValue(left.floatValue() == right.longValue()); > } >- break; >+ break; > case T_double : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.doubleValue() == right.charValue()); >@@ -452,7 +438,7 @@ > case T_int: return BooleanConstant.fromValue(left.doubleValue() == right.intValue()); > case T_long: return BooleanConstant.fromValue(left.doubleValue() == right.longValue()); > } >- break; >+ break; > case T_byte : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.byteValue() == right.charValue()); >@@ -463,7 +449,7 @@ > case T_int: return BooleanConstant.fromValue(left.byteValue() == right.intValue()); > case T_long: return BooleanConstant.fromValue(left.byteValue() == right.longValue()); > } >- break; >+ break; > case T_short : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.shortValue() == right.charValue()); >@@ -474,7 +460,7 @@ > case T_int: return BooleanConstant.fromValue(left.shortValue() == right.intValue()); > case T_long: return BooleanConstant.fromValue(left.shortValue() == right.longValue()); > } >- break; >+ break; > case T_int : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.intValue() == right.charValue()); >@@ -485,7 +471,7 @@ > case T_int: return BooleanConstant.fromValue(left.intValue() == right.intValue()); > case T_long: return BooleanConstant.fromValue(left.intValue() == right.longValue()); > } >- break; >+ break; > case T_long : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.longValue() == right.charValue()); >@@ -496,14 +482,14 @@ > case T_int: return BooleanConstant.fromValue(left.longValue() == right.intValue()); > case T_long: return BooleanConstant.fromValue(left.longValue() == right.longValue()); > } >- break; >+ break; > case T_JavaLangString : > if (rightId == T_JavaLangString) { > //String are interned in th compiler==>thus if two string constant > //get to be compared, it is an equal on the vale which is done > return BooleanConstant.fromValue(((StringConstant)left).hasSameValue(right)); > } >- break; >+ break; > case T_null : > if (rightId == T_JavaLangString) { > return BooleanConstant.fromValue(false); >@@ -512,13 +498,11 @@ > return BooleanConstant.fromValue(true); > } > } >- } >- >+ } > return BooleanConstant.fromValue(false); > } > > public static final Constant computeConstantOperationGREATER(Constant left, int leftId, Constant right, int rightId) { >- > switch (leftId){ > case T_char : > switch (rightId){ >@@ -530,7 +514,7 @@ > case T_int: return BooleanConstant.fromValue(left.charValue() > right.intValue()); > case T_long: return BooleanConstant.fromValue(left.charValue() > right.longValue()); > } >- break; >+ break; > case T_float : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.floatValue() > right.charValue()); >@@ -541,7 +525,7 @@ > case T_int: return BooleanConstant.fromValue(left.floatValue() > right.intValue()); > case T_long: return BooleanConstant.fromValue(left.floatValue() > right.longValue()); > } >- break; >+ break; > case T_double : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.doubleValue() > right.charValue()); >@@ -552,7 +536,7 @@ > case T_int: return BooleanConstant.fromValue(left.doubleValue() > right.intValue()); > case T_long: return BooleanConstant.fromValue(left.doubleValue() > right.longValue()); > } >- break; >+ break; > case T_byte : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.byteValue() > right.charValue()); >@@ -563,7 +547,7 @@ > case T_int: return BooleanConstant.fromValue(left.byteValue() > right.intValue()); > case T_long: return BooleanConstant.fromValue(left.byteValue() > right.longValue()); > } >- break; >+ break; > case T_short : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.shortValue() > right.charValue()); >@@ -574,7 +558,7 @@ > case T_int: return BooleanConstant.fromValue(left.shortValue() > right.intValue()); > case T_long: return BooleanConstant.fromValue(left.shortValue() > right.longValue()); > } >- break; >+ break; > case T_int : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.intValue() > right.charValue()); >@@ -585,7 +569,7 @@ > case T_int: return BooleanConstant.fromValue(left.intValue() > right.intValue()); > case T_long: return BooleanConstant.fromValue(left.intValue() > right.longValue()); > } >- break; >+ break; > case T_long : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.longValue() > right.charValue()); >@@ -597,13 +581,11 @@ > case T_long: return BooleanConstant.fromValue(left.longValue() > right.longValue()); > } > >- } >- >+ } > return NotAConstant; > } > > public static final Constant computeConstantOperationGREATER_EQUAL(Constant left, int leftId, Constant right, int rightId) { >- > switch (leftId){ > case T_char : > switch (rightId){ >@@ -615,7 +597,7 @@ > case T_int: return BooleanConstant.fromValue(left.charValue() >= right.intValue()); > case T_long: return BooleanConstant.fromValue(left.charValue() >= right.longValue()); > } >- break; >+ break; > case T_float : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.floatValue() >= right.charValue()); >@@ -626,7 +608,7 @@ > case T_int: return BooleanConstant.fromValue(left.floatValue() >= right.intValue()); > case T_long: return BooleanConstant.fromValue(left.floatValue() >= right.longValue()); > } >- break; >+ break; > case T_double : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.doubleValue() >= right.charValue()); >@@ -637,7 +619,7 @@ > case T_int: return BooleanConstant.fromValue(left.doubleValue() >= right.intValue()); > case T_long: return BooleanConstant.fromValue(left.doubleValue() >= right.longValue()); > } >- break; >+ break; > case T_byte : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.byteValue() >= right.charValue()); >@@ -648,7 +630,7 @@ > case T_int: return BooleanConstant.fromValue(left.byteValue() >= right.intValue()); > case T_long: return BooleanConstant.fromValue(left.byteValue() >= right.longValue()); > } >- break; >+ break; > case T_short : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.shortValue() >= right.charValue()); >@@ -659,7 +641,7 @@ > case T_int: return BooleanConstant.fromValue(left.shortValue() >= right.intValue()); > case T_long: return BooleanConstant.fromValue(left.shortValue() >= right.longValue()); > } >- break; >+ break; > case T_int : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.intValue() >= right.charValue()); >@@ -670,7 +652,7 @@ > case T_int: return BooleanConstant.fromValue(left.intValue() >= right.intValue()); > case T_long: return BooleanConstant.fromValue(left.intValue() >= right.longValue()); > } >- break; >+ break; > case T_long : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.longValue() >= right.charValue()); >@@ -681,14 +663,11 @@ > case T_int: return BooleanConstant.fromValue(left.longValue() >= right.intValue()); > case T_long: return BooleanConstant.fromValue(left.longValue() >= right.longValue()); > } >- >- } >- >+ } > return NotAConstant; > } > > public static final Constant computeConstantOperationLEFT_SHIFT(Constant left, int leftId, Constant right, int rightId) { >- > switch (leftId){ > case T_char : > switch (rightId){ >@@ -698,7 +677,7 @@ > case T_int: return IntConstant.fromValue(left.charValue() << right.intValue()); > case T_long: return IntConstant.fromValue(left.charValue() << right.longValue()); > } >- break; >+ break; > case T_byte : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.byteValue() << right.charValue()); >@@ -707,7 +686,7 @@ > case T_int: return IntConstant.fromValue(left.byteValue() << right.intValue()); > case T_long: return IntConstant.fromValue(left.byteValue() << right.longValue()); > } >- break; >+ break; > case T_short : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.shortValue() << right.charValue()); >@@ -716,7 +695,7 @@ > case T_int: return IntConstant.fromValue(left.shortValue() << right.intValue()); > case T_long: return IntConstant.fromValue(left.shortValue() << right.longValue()); > } >- break; >+ break; > case T_int : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.intValue() << right.charValue()); >@@ -725,7 +704,7 @@ > case T_int: return IntConstant.fromValue(left.intValue() << right.intValue()); > case T_long: return IntConstant.fromValue(left.intValue() << right.longValue()); > } >- break; >+ break; > case T_long : > switch (rightId){ > case T_char : return LongConstant.fromValue(left.longValue() << right.charValue()); >@@ -734,14 +713,11 @@ > case T_int: return LongConstant.fromValue(left.longValue() << right.intValue()); > case T_long: return LongConstant.fromValue(left.longValue() << right.longValue()); > } >- >- } >- >+ } > return NotAConstant; > } > > public static final Constant computeConstantOperationLESS(Constant left, int leftId, Constant right, int rightId) { >- > switch (leftId){ > case T_char : > switch (rightId){ >@@ -753,7 +729,7 @@ > case T_int: return BooleanConstant.fromValue(left.charValue() < right.intValue()); > case T_long: return BooleanConstant.fromValue(left.charValue() < right.longValue()); > } >- break; >+ break; > case T_float : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.floatValue() < right.charValue()); >@@ -764,7 +740,7 @@ > case T_int: return BooleanConstant.fromValue(left.floatValue() < right.intValue()); > case T_long: return BooleanConstant.fromValue(left.floatValue() < right.longValue()); > } >- break; >+ break; > case T_double : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.doubleValue() < right.charValue()); >@@ -775,7 +751,7 @@ > case T_int: return BooleanConstant.fromValue(left.doubleValue() < right.intValue()); > case T_long: return BooleanConstant.fromValue(left.doubleValue() < right.longValue()); > } >- break; >+ break; > case T_byte : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.byteValue() < right.charValue()); >@@ -786,7 +762,7 @@ > case T_int: return BooleanConstant.fromValue(left.byteValue() < right.intValue()); > case T_long: return BooleanConstant.fromValue(left.byteValue() < right.longValue()); > } >- break; >+ break; > case T_short : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.shortValue() < right.charValue()); >@@ -797,7 +773,7 @@ > case T_int: return BooleanConstant.fromValue(left.shortValue() < right.intValue()); > case T_long: return BooleanConstant.fromValue(left.shortValue() < right.longValue()); > } >- break; >+ break; > case T_int : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.intValue() < right.charValue()); >@@ -808,7 +784,7 @@ > case T_int: return BooleanConstant.fromValue(left.intValue() < right.intValue()); > case T_long: return BooleanConstant.fromValue(left.intValue() < right.longValue()); > } >- break; >+ break; > case T_long : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.longValue() < right.charValue()); >@@ -819,14 +795,11 @@ > case T_int: return BooleanConstant.fromValue(left.longValue() < right.intValue()); > case T_long: return BooleanConstant.fromValue(left.longValue() < right.longValue()); > } >- >- } >- >+ } > return NotAConstant; > } > > public static final Constant computeConstantOperationLESS_EQUAL(Constant left, int leftId, Constant right, int rightId) { >- > switch (leftId){ > case T_char : > switch (rightId){ >@@ -838,7 +811,7 @@ > case T_int: return BooleanConstant.fromValue(left.charValue() <= right.intValue()); > case T_long: return BooleanConstant.fromValue(left.charValue() <= right.longValue()); > } >- break; >+ break; > case T_float : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.floatValue() <= right.charValue()); >@@ -849,7 +822,7 @@ > case T_int: return BooleanConstant.fromValue(left.floatValue() <= right.intValue()); > case T_long: return BooleanConstant.fromValue(left.floatValue() <= right.longValue()); > } >- break; >+ break; > case T_double : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.doubleValue() <= right.charValue()); >@@ -860,7 +833,7 @@ > case T_int: return BooleanConstant.fromValue(left.doubleValue() <= right.intValue()); > case T_long: return BooleanConstant.fromValue(left.doubleValue() <= right.longValue()); > } >- break; >+ break; > case T_byte : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.byteValue() <= right.charValue()); >@@ -871,7 +844,7 @@ > case T_int: return BooleanConstant.fromValue(left.byteValue() <= right.intValue()); > case T_long: return BooleanConstant.fromValue(left.byteValue() <= right.longValue()); > } >- break; >+ break; > case T_short : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.shortValue() <= right.charValue()); >@@ -893,7 +866,7 @@ > case T_int: return BooleanConstant.fromValue(left.intValue() <= right.intValue()); > case T_long: return BooleanConstant.fromValue(left.intValue() <= right.longValue()); > } >- break; >+ break; > case T_long : > switch (rightId){ > case T_char : return BooleanConstant.fromValue(left.longValue() <= right.charValue()); >@@ -904,13 +877,11 @@ > case T_int: return BooleanConstant.fromValue(left.longValue() <= right.intValue()); > case T_long: return BooleanConstant.fromValue(left.longValue() <= right.longValue()); > } >- } >- >+ } > return NotAConstant; > } > > public static final Constant computeConstantOperationMINUS(Constant left, int leftId, Constant right, int rightId) { >- > switch (leftId){ > case T_char : > switch (rightId){ >@@ -922,7 +893,7 @@ > case T_int: return IntConstant.fromValue(left.charValue() - right.intValue()); > case T_long: return LongConstant.fromValue(left.charValue() - right.longValue()); > } >- break; >+ break; > case T_float : > switch (rightId){ > case T_char : return FloatConstant.fromValue(left.floatValue() - right.charValue()); >@@ -933,7 +904,7 @@ > case T_int: return FloatConstant.fromValue(left.floatValue() - right.intValue()); > case T_long: return FloatConstant.fromValue(left.floatValue() - right.longValue()); > } >- break; >+ break; > case T_double : > switch (rightId){ > case T_char : return DoubleConstant.fromValue(left.doubleValue() - right.charValue()); >@@ -944,7 +915,7 @@ > case T_int: return DoubleConstant.fromValue(left.doubleValue() - right.intValue()); > case T_long: return DoubleConstant.fromValue(left.doubleValue() - right.longValue()); > } >- break; >+ break; > case T_byte : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.byteValue() - right.charValue()); >@@ -955,7 +926,7 @@ > case T_int: return IntConstant.fromValue(left.byteValue() - right.intValue()); > case T_long: return LongConstant.fromValue(left.byteValue() - right.longValue()); > } >- break; >+ break; > case T_short : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.shortValue() - right.charValue()); >@@ -966,7 +937,7 @@ > case T_int: return IntConstant.fromValue(left.shortValue() - right.intValue()); > case T_long: return LongConstant.fromValue(left.shortValue() - right.longValue()); > } >- break; >+ break; > case T_int : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.intValue() - right.charValue()); >@@ -977,7 +948,7 @@ > case T_int: return IntConstant.fromValue(left.intValue() - right.intValue()); > case T_long: return LongConstant.fromValue(left.intValue() - right.longValue()); > } >- break; >+ break; > case T_long : > switch (rightId){ > case T_char : return LongConstant.fromValue(left.longValue() - right.charValue()); >@@ -988,14 +959,11 @@ > case T_int: return LongConstant.fromValue(left.longValue() - right.intValue()); > case T_long: return LongConstant.fromValue(left.longValue() - right.longValue()); > } >- >- } >- >+ } > return NotAConstant; > } > > public static final Constant computeConstantOperationMULTIPLY(Constant left, int leftId, Constant right, int rightId) { >- > switch (leftId){ > case T_char : > switch (rightId){ >@@ -1007,7 +975,7 @@ > case T_int: return IntConstant.fromValue(left.charValue() * right.intValue()); > case T_long: return LongConstant.fromValue(left.charValue() * right.longValue()); > } >- break; >+ break; > case T_float : > switch (rightId){ > case T_char : return FloatConstant.fromValue(left.floatValue() * right.charValue()); >@@ -1018,7 +986,7 @@ > case T_int: return FloatConstant.fromValue(left.floatValue() * right.intValue()); > case T_long: return FloatConstant.fromValue(left.floatValue() * right.longValue()); > } >- break; >+ break; > case T_double : > switch (rightId){ > case T_char : return DoubleConstant.fromValue(left.doubleValue() * right.charValue()); >@@ -1029,7 +997,7 @@ > case T_int: return DoubleConstant.fromValue(left.doubleValue() * right.intValue()); > case T_long: return DoubleConstant.fromValue(left.doubleValue() * right.longValue()); > } >- break; >+ break; > case T_byte : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.byteValue() * right.charValue()); >@@ -1040,7 +1008,7 @@ > case T_int: return IntConstant.fromValue(left.byteValue() * right.intValue()); > case T_long: return LongConstant.fromValue(left.byteValue() * right.longValue()); > } >- break; >+ break; > case T_short : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.shortValue() * right.charValue()); >@@ -1051,7 +1019,7 @@ > case T_int: return IntConstant.fromValue(left.shortValue() * right.intValue()); > case T_long: return LongConstant.fromValue(left.shortValue() * right.longValue()); > } >- break; >+ break; > case T_int : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.intValue() * right.charValue()); >@@ -1062,7 +1030,7 @@ > case T_int: return IntConstant.fromValue(left.intValue() * right.intValue()); > case T_long: return LongConstant.fromValue(left.intValue() * right.longValue()); > } >- break; >+ break; > case T_long : > switch (rightId){ > case T_char : return LongConstant.fromValue(left.longValue() * right.charValue()); >@@ -1073,13 +1041,11 @@ > case T_int: return LongConstant.fromValue(left.longValue() * right.intValue()); > case T_long: return LongConstant.fromValue(left.longValue() * right.longValue()); > } >- } >- >+ } > return NotAConstant; > } > > public static final Constant computeConstantOperationOR(Constant left, int leftId, Constant right, int rightId) { >- > switch (leftId){ > case T_boolean : return BooleanConstant.fromValue(left.booleanValue() | right.booleanValue()); > case T_char : >@@ -1090,7 +1056,7 @@ > case T_int: return IntConstant.fromValue(left.charValue() | right.intValue()); > case T_long: return LongConstant.fromValue(left.charValue() | right.longValue()); > } >- break; >+ break; > case T_byte : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.byteValue() | right.charValue()); >@@ -1099,7 +1065,7 @@ > case T_int: return IntConstant.fromValue(left.byteValue() | right.intValue()); > case T_long: return LongConstant.fromValue(left.byteValue() | right.longValue()); > } >- break; >+ break; > case T_short : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.shortValue() | right.charValue()); >@@ -1108,7 +1074,7 @@ > case T_int: return IntConstant.fromValue(left.shortValue() | right.intValue()); > case T_long: return LongConstant.fromValue(left.shortValue() | right.longValue()); > } >- break; >+ break; > case T_int : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.intValue() | right.charValue()); >@@ -1117,7 +1083,7 @@ > case T_int: return IntConstant.fromValue(left.intValue() | right.intValue()); > case T_long: return LongConstant.fromValue(left.intValue() | right.longValue()); > } >- break; >+ break; > case T_long : > switch (rightId){ > case T_char : return LongConstant.fromValue(left.longValue() | right.charValue()); >@@ -1126,19 +1092,15 @@ > case T_int: return LongConstant.fromValue(left.longValue() | right.intValue()); > case T_long: return LongConstant.fromValue(left.longValue() | right.longValue()); > } >- >- } >- >+ } > return NotAConstant; > } > > public static final Constant computeConstantOperationOR_OR(Constant left, int leftId, Constant right, int rightId) { >- > return BooleanConstant.fromValue(left.booleanValue() || right.booleanValue()); > } > > public static final Constant computeConstantOperationPLUS(Constant left, int leftId, Constant right, int rightId) { >- > switch (leftId){ > case T_JavaLangObject : > if (rightId == T_JavaLangString) { >@@ -1259,13 +1221,11 @@ > // case T_JavaLangString: return Constant.fromValue(left.stringValue() + right.stringValue()); > // case T_boolean: return Constant.fromValue(left.stringValue() + right.booleanValue()); > // } >- } >- >+ } > return NotAConstant; > } > > public static final Constant computeConstantOperationREMAINDER(Constant left, int leftId, Constant right, int rightId) { >- > switch (leftId){ > case T_char : > switch (rightId){ >@@ -1277,7 +1237,7 @@ > case T_int: return IntConstant.fromValue(left.charValue() % right.intValue()); > case T_long: return LongConstant.fromValue(left.charValue() % right.longValue()); > } >- break; >+ break; > case T_float : > switch (rightId){ > case T_char : return FloatConstant.fromValue(left.floatValue() % right.charValue()); >@@ -1288,7 +1248,7 @@ > case T_int: return FloatConstant.fromValue(left.floatValue() % right.intValue()); > case T_long: return FloatConstant.fromValue(left.floatValue() % right.longValue()); > } >- break; >+ break; > case T_double : > switch (rightId){ > case T_char : return DoubleConstant.fromValue(left.doubleValue() % right.charValue()); >@@ -1299,7 +1259,7 @@ > case T_int: return DoubleConstant.fromValue(left.doubleValue() % right.intValue()); > case T_long: return DoubleConstant.fromValue(left.doubleValue() % right.longValue()); > } >- break; >+ break; > case T_byte : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.byteValue() % right.charValue()); >@@ -1310,7 +1270,7 @@ > case T_int: return IntConstant.fromValue(left.byteValue() % right.intValue()); > case T_long: return LongConstant.fromValue(left.byteValue() % right.longValue()); > } >- break; >+ break; > case T_short : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.shortValue() % right.charValue()); >@@ -1321,7 +1281,7 @@ > case T_int: return IntConstant.fromValue(left.shortValue() % right.intValue()); > case T_long: return LongConstant.fromValue(left.shortValue() % right.longValue()); > } >- break; >+ break; > case T_int : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.intValue() % right.charValue()); >@@ -1332,7 +1292,7 @@ > case T_int: return IntConstant.fromValue(left.intValue() % right.intValue()); > case T_long: return LongConstant.fromValue(left.intValue() % right.longValue()); > } >- break; >+ break; > case T_long : > switch (rightId){ > case T_char : return LongConstant.fromValue(left.longValue() % right.charValue()); >@@ -1343,14 +1303,11 @@ > case T_int: return LongConstant.fromValue(left.longValue() % right.intValue()); > case T_long: return LongConstant.fromValue(left.longValue() % right.longValue()); > } >- >- } >- >+ } > return NotAConstant; > } > > public static final Constant computeConstantOperationRIGHT_SHIFT(Constant left, int leftId, Constant right, int rightId) { >- > switch (leftId){ > case T_char : > switch (rightId){ >@@ -1360,7 +1317,7 @@ > case T_int: return IntConstant.fromValue(left.charValue() >> right.intValue()); > case T_long: return IntConstant.fromValue(left.charValue() >> right.longValue()); > } >- break; >+ break; > case T_byte : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.byteValue() >> right.charValue()); >@@ -1369,7 +1326,7 @@ > case T_int: return IntConstant.fromValue(left.byteValue() >> right.intValue()); > case T_long: return IntConstant.fromValue(left.byteValue() >> right.longValue()); > } >- break; >+ break; > case T_short : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.shortValue() >> right.charValue()); >@@ -1378,7 +1335,7 @@ > case T_int: return IntConstant.fromValue(left.shortValue() >> right.intValue()); > case T_long: return IntConstant.fromValue(left.shortValue() >> right.longValue()); > } >- break; >+ break; > case T_int : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.intValue() >> right.charValue()); >@@ -1387,7 +1344,7 @@ > case T_int: return IntConstant.fromValue(left.intValue() >> right.intValue()); > case T_long: return IntConstant.fromValue(left.intValue() >> right.longValue()); > } >- break; >+ break; > case T_long : > switch (rightId){ > case T_char : return LongConstant.fromValue(left.longValue() >> right.charValue()); >@@ -1396,14 +1353,11 @@ > case T_int: return LongConstant.fromValue(left.longValue() >> right.intValue()); > case T_long: return LongConstant.fromValue(left.longValue() >> right.longValue()); > } >- >- } >- >+ } > return NotAConstant; > } > > public static final Constant computeConstantOperationUNSIGNED_RIGHT_SHIFT(Constant left, int leftId, Constant right, int rightId) { >- > switch (leftId){ > case T_char : > switch (rightId){ >@@ -1413,7 +1367,7 @@ > case T_int: return IntConstant.fromValue(left.charValue() >>> right.intValue()); > case T_long: return IntConstant.fromValue(left.charValue() >>> right.longValue()); > } >- break; >+ break; > case T_byte : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.byteValue() >>> right.charValue()); >@@ -1422,7 +1376,7 @@ > case T_int: return IntConstant.fromValue(left.byteValue() >>> right.intValue()); > case T_long: return IntConstant.fromValue(left.byteValue() >>> right.longValue()); > } >- break; >+ break; > case T_short : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.shortValue() >>> right.charValue()); >@@ -1431,7 +1385,7 @@ > case T_int: return IntConstant.fromValue(left.shortValue() >>> right.intValue()); > case T_long: return IntConstant.fromValue(left.shortValue() >>> right.longValue()); > } >- break; >+ break; > case T_int : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.intValue() >>> right.charValue()); >@@ -1440,7 +1394,7 @@ > case T_int: return IntConstant.fromValue(left.intValue() >>> right.intValue()); > case T_long: return IntConstant.fromValue(left.intValue() >>> right.longValue()); > } >- break; >+ break; > case T_long : > switch (rightId){ > case T_char : return LongConstant.fromValue(left.longValue() >>> right.charValue()); >@@ -1449,14 +1403,11 @@ > case T_int: return LongConstant.fromValue(left.longValue() >>> right.intValue()); > case T_long: return LongConstant.fromValue(left.longValue() >>> right.longValue()); > } >- >- } >- >+ } > return NotAConstant; > } > > public static final Constant computeConstantOperationXOR(Constant left, int leftId, Constant right, int rightId) { >- > switch (leftId){ > case T_boolean : return BooleanConstant.fromValue(left.booleanValue() ^ right.booleanValue()); > case T_char : >@@ -1467,7 +1418,7 @@ > case T_int: return IntConstant.fromValue(left.charValue() ^ right.intValue()); > case T_long: return LongConstant.fromValue(left.charValue() ^ right.longValue()); > } >- break; >+ break; > case T_byte : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.byteValue() ^ right.charValue()); >@@ -1476,7 +1427,7 @@ > case T_int: return IntConstant.fromValue(left.byteValue() ^ right.intValue()); > case T_long: return LongConstant.fromValue(left.byteValue() ^ right.longValue()); > } >- break; >+ break; > case T_short : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.shortValue() ^ right.charValue()); >@@ -1485,7 +1436,7 @@ > case T_int: return IntConstant.fromValue(left.shortValue() ^ right.intValue()); > case T_long: return LongConstant.fromValue(left.shortValue() ^ right.longValue()); > } >- break; >+ break; > case T_int : > switch (rightId){ > case T_char : return IntConstant.fromValue(left.intValue() ^ right.charValue()); >@@ -1494,7 +1445,7 @@ > case T_int: return IntConstant.fromValue(left.intValue() ^ right.intValue()); > case T_long: return LongConstant.fromValue(left.intValue() ^ right.longValue()); > } >- break; >+ break; > case T_long : > switch (rightId){ > case T_char : return LongConstant.fromValue(left.longValue() ^ right.charValue()); >@@ -1503,20 +1454,18 @@ > case T_int: return LongConstant.fromValue(left.longValue() ^ right.intValue()); > case T_long: return LongConstant.fromValue(left.longValue() ^ right.longValue()); > } >- } >- >+ } > return NotAConstant; > } > > public double doubleValue() { >- > throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "double" })); //$NON-NLS-1$ > } > > public float floatValue() { >- > throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "float" })); //$NON-NLS-1$ > } >+ > /** > * Returns true if both constants have the same type and the same actual value > * @param otherConstant >@@ -1554,27 +1503,22 @@ > } > > public int intValue() { >- > throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "int" })); //$NON-NLS-1$ > } > > public long longValue() { >- > throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "long" })); //$NON-NLS-1$ > } > > public short shortValue() { >- > throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotConvertedTo, new String[] { typeName(), "short" })); //$NON-NLS-1$ > } > > public String stringValue() { >- > throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotConvertedTo, new String[] { typeName(), "String" })); //$NON-NLS-1$ > } > > public String toString(){ >- > if (this == NotAConstant) return "(Constant) NotAConstant"; //$NON-NLS-1$ > return super.toString(); } > >Index: compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java,v >retrieving revision 1.24 >diff -u -r1.24 ByteConstant.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java 27 Jun 2008 16:04:13 -0000 1.24 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java 2 Feb 2009 15:12:01 -0000 >@@ -11,43 +11,55 @@ > package org.eclipse.jdt.internal.compiler.impl; > > public class ByteConstant extends Constant { >+ > private byte value; > >-public static Constant fromValue(byte value) { >- return new ByteConstant(value); >-} >-private ByteConstant(byte value) { >- this.value = value; >-} >-public byte byteValue() { >- return this.value; >-} >-public char charValue() { >- return (char) this.value; >-} >-public double doubleValue() { >- return this.value; // implicit cast to return type >-} >-public float floatValue() { >- return this.value; // implicit cast to return type >-} >-public int intValue() { >- return this.value; // implicit cast to return type >-} >-public long longValue() { >- return this.value; // implicit cast to return type >-} >-public short shortValue() { >- return this.value; // implicit cast to return type >-} >-public String stringValue() { >- //spec 15.17.11 >- return String.valueOf(this.value) ; >-} >-public String toString(){ >+ public static Constant fromValue(byte value) { >+ return new ByteConstant(value); >+ } > >- return "(byte)" + this.value ; } //$NON-NLS-1$ >-public int typeID() { >- return T_byte; >-} >+ private ByteConstant(byte value) { >+ this.value = value; >+ } >+ >+ public byte byteValue() { >+ return this.value; >+ } >+ >+ public char charValue() { >+ return (char) this.value; >+ } >+ >+ public double doubleValue() { >+ return this.value; // implicit cast to return type >+ } >+ >+ public float floatValue() { >+ return this.value; // implicit cast to return type >+ } >+ >+ public int intValue() { >+ return this.value; // implicit cast to return type >+ } >+ >+ public long longValue() { >+ return this.value; // implicit cast to return type >+ } >+ >+ public short shortValue() { >+ return this.value; // implicit cast to return type >+ } >+ >+ public String stringValue() { >+ // spec 15.17.11 >+ return String.valueOf(this.value); >+ } >+ >+ public String toString() { >+ return "(byte)" + this.value; //$NON-NLS-1$ >+ } >+ >+ public int typeID() { >+ return T_byte; >+ } > } >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.26 >diff -u -r1.26 IntConstant.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java 27 Jun 2008 16:04:13 -0000 1.26 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java 2 Feb 2009 15:12:01 -0000 >@@ -14,6 +14,7 @@ > > 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); >@@ -31,8 +32,8 @@ > private static final IntConstant TEN = new IntConstant(10); > > 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/CharConstant.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java,v >retrieving revision 1.23 >diff -u -r1.23 CharConstant.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java 27 Jun 2008 16:04:14 -0000 1.23 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java 2 Feb 2009 15:12:01 -0000 >@@ -21,35 +21,44 @@ > private CharConstant(char value) { > this.value = value; > } >+ > public byte byteValue() { > return (byte) this.value; > } >+ > public char charValue() { > return this.value; > } >+ > public double doubleValue() { > return this.value; // implicit cast to return type > } >+ > public float floatValue() { > return this.value; // implicit cast to return type > } >+ > public int intValue() { > return this.value; // implicit cast to return type > } >+ > public long longValue() { > return this.value; // implicit cast to return type > } >+ > public short shortValue() { > return (short) this.value; > } >+ > public String stringValue() { >- //spec 15.17.11 >+ // spec 15.17.11 > return String.valueOf(this.value); > } >- public String toString(){ > >+ public String toString() { > return "(char)" + this.value; //$NON-NLS-1$ > } >+ > public int typeID() { > return T_char; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 261510
:
122943
|
124410
| 124424 |
124425