@@ -1396,28 +1396,28 @@ public static Expression getDefaultValueForPrimitive(ClassNode type) {
1396
1396
if (type != null ) type = type .redirect ();
1397
1397
1398
1398
if (type == ClassHelper .int_TYPE ) {
1399
- return new ConstantExpression (0 );
1399
+ return new ConstantExpression (0 , true );
1400
1400
}
1401
1401
if (type == ClassHelper .long_TYPE ) {
1402
- return new ConstantExpression (0L );
1402
+ return new ConstantExpression (0L , true );
1403
1403
}
1404
1404
if (type == ClassHelper .double_TYPE ) {
1405
- return new ConstantExpression (0.0 );
1405
+ return new ConstantExpression (0.0 , true );
1406
1406
}
1407
1407
if (type == ClassHelper .float_TYPE ) {
1408
- return new ConstantExpression (0.0F );
1408
+ return new ConstantExpression (0.0F , true );
1409
1409
}
1410
1410
if (type == ClassHelper .boolean_TYPE ) {
1411
- return ConstantExpression .FALSE ;
1412
- }
1413
- if (type == ClassHelper .short_TYPE ) {
1414
- return new ConstantExpression ((short ) 0 );
1411
+ return ConstantExpression .PRIM_FALSE ;
1415
1412
}
1416
1413
if (type == ClassHelper .byte_TYPE ) {
1417
- return new ConstantExpression ((byte ) 0 );
1414
+ return new ConstantExpression ((byte ) 0 , true );
1418
1415
}
1419
1416
if (type == ClassHelper .char_TYPE ) {
1420
- return new ConstantExpression ((char ) 0 );
1417
+ return new ConstantExpression ((char ) 0 , true );
1418
+ }
1419
+ if (type == ClassHelper .short_TYPE ) {
1420
+ return new ConstantExpression ((short ) 0 , true );
1421
1421
}
1422
1422
return null ;
1423
1423
}
@@ -2585,7 +2585,7 @@ protected Expression variableExpression(AST node) {
2585
2585
}
2586
2586
2587
2587
protected ConstantExpression literalExpression (AST node , Object value ) {
2588
- ConstantExpression constantExpression = new ConstantExpression (value , value instanceof Boolean );
2588
+ ConstantExpression constantExpression = new ConstantExpression (value , true );
2589
2589
configureAST (constantExpression , node );
2590
2590
return constantExpression ;
2591
2591
}
@@ -3347,7 +3347,7 @@ protected Expression unaryMinusExpression(AST unaryMinusExpr) {
3347
3347
case NUM_DOUBLE :
3348
3348
case NUM_FLOAT :
3349
3349
case NUM_BIG_DECIMAL :
3350
- ConstantExpression constantExpression = new ConstantExpression (Numbers .parseDecimal ("-" + text ));
3350
+ ConstantExpression constantExpression = new ConstantExpression (Numbers .parseDecimal ("-" + text ), true );
3351
3351
configureAST (constantExpression , unaryMinusExpr );
3352
3352
// GRECLIPSE add
3353
3353
setSourceEnd (constantExpression , expression (node ));
@@ -3357,7 +3357,7 @@ protected Expression unaryMinusExpression(AST unaryMinusExpr) {
3357
3357
case NUM_BIG_INT :
3358
3358
case NUM_INT :
3359
3359
case NUM_LONG :
3360
- ConstantExpression constantLongExpression = new ConstantExpression (Numbers .parseInteger ("-" + text ));
3360
+ ConstantExpression constantLongExpression = new ConstantExpression (Numbers .parseInteger ("-" + text ), true );
3361
3361
configureAST (constantLongExpression , unaryMinusExpr );
3362
3362
// GRECLIPSE add
3363
3363
setSourceEnd (constantLongExpression , expression (node ));
@@ -3401,17 +3401,15 @@ protected Expression unaryPlusExpression(AST unaryPlusExpr) {
3401
3401
protected ConstantExpression decimalExpression (AST node ) {
3402
3402
String text = node .getText ();
3403
3403
Object number = Numbers .parseDecimal (text );
3404
- ConstantExpression constantExpression = new ConstantExpression (number ,
3405
- number instanceof Double || number instanceof Float );
3404
+ ConstantExpression constantExpression = new ConstantExpression (number , true );
3406
3405
configureAST (constantExpression , node );
3407
3406
return constantExpression ;
3408
3407
}
3409
3408
3410
3409
protected ConstantExpression integerExpression (AST node ) {
3411
3410
String text = node .getText ();
3412
- Object number = Numbers .parseInteger (node , text );
3413
- boolean keepPrimitive = number instanceof Integer || number instanceof Long ;
3414
- ConstantExpression constantExpression = new ConstantExpression (number , keepPrimitive );
3411
+ Object number = Numbers .parseInteger (text );
3412
+ ConstantExpression constantExpression = new ConstantExpression (number , true );
3415
3413
configureAST (constantExpression , node );
3416
3414
return constantExpression ;
3417
3415
}
@@ -3430,7 +3428,7 @@ protected Expression gstring(AST gstringNode) {
3430
3428
switch (type ) {
3431
3429
3432
3430
case STRING_LITERAL :
3433
- if (isPrevString ) assertNodeType (IDENT , node ); // parser bug
3431
+ if (isPrevString ) assertNodeType (IDENT , node ); // parser bug
3434
3432
isPrevString = true ;
3435
3433
text = node .getText ();
3436
3434
ConstantExpression constantExpression = new ConstantExpression (text );
@@ -3440,7 +3438,7 @@ protected Expression gstring(AST gstringNode) {
3440
3438
break ;
3441
3439
3442
3440
default : {
3443
- if (!isPrevString ) assertNodeType (IDENT , node ); // parser bug
3441
+ if (!isPrevString ) assertNodeType (IDENT , node ); // parser bug
3444
3442
isPrevString = false ;
3445
3443
Expression expression = expression (node );
3446
3444
values .add (expression );
0 commit comments