File tree Expand file tree Collapse file tree
base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/basic
org.codehaus.groovy25/src/org/apache/groovy/ast/tools
org.codehaus.groovy30/src/org/apache/groovy/ast/tools
org.codehaus.groovy40/src/org/apache/groovy/ast/tools Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1069,6 +1069,23 @@ public void testStaticProperty14() {
10691069 "----------\n " );
10701070 }
10711071
1072+ @ Test // GROOVY-10159
1073+ public void testStaticProperty15 () {
1074+ //@formatter:off
1075+ String [] sources = {
1076+ "Main.groovy" ,
1077+ "public class Main {\n " +
1078+ " static final String foo = 1 + 1\n " +
1079+ " static main(args) {\n " +
1080+ " print(foo);\n " +
1081+ " }\n " +
1082+ "}\n " ,
1083+ };
1084+ //@formatter:on
1085+
1086+ runConformTest (sources , "2" );
1087+ }
1088+
10721089 @ Test
10731090 public void testClash_GRE1076 () {
10741091 //@formatter:off
Original file line number Diff line number Diff line change @@ -82,6 +82,9 @@ public static ConstantExpression transformBinaryConstantExpression(BinaryExpress
8282 Expression left = transformInlineConstants (be .getLeftExpression (), targetType );
8383 Expression right = transformInlineConstants (be .getRightExpression (), targetType );
8484 if (left instanceof ConstantExpression && right instanceof ConstantExpression ) {
85+ // GRECLIPSE add -- GROOVY-10159
86+ if (((ConstantExpression ) left ).getValue () instanceof String )
87+ // GRECLIPSE end
8588 return configure (be , new ConstantExpression ((String ) ((ConstantExpression ) left ).getValue () +
8689 ((ConstantExpression ) right ).getValue ()));
8790 }
Original file line number Diff line number Diff line change @@ -77,6 +77,9 @@ public static ConstantExpression transformBinaryConstantExpression(final BinaryE
7777 Expression left = transformInlineConstants (be .getLeftExpression (), targetType );
7878 Expression right = transformInlineConstants (be .getRightExpression (), targetType );
7979 if (left instanceof ConstantExpression && right instanceof ConstantExpression ) {
80+ // GRECLIPSE add -- GROOVY-10159
81+ if (((ConstantExpression ) left ).getValue () instanceof String )
82+ // GRECLIPSE end
8083 return configure (be , new ConstantExpression ((String ) ((ConstantExpression ) left ).getValue () + ((ConstantExpression ) right ).getValue ()));
8184 }
8285 }
Original file line number Diff line number Diff line change @@ -76,6 +76,9 @@ public static ConstantExpression transformBinaryConstantExpression(final BinaryE
7676 Expression left = transformInlineConstants (be .getLeftExpression (), targetType );
7777 Expression right = transformInlineConstants (be .getRightExpression (), targetType );
7878 if (left instanceof ConstantExpression && right instanceof ConstantExpression ) {
79+ // GRECLIPSE add -- GROOVY-10159
80+ if (((ConstantExpression ) left ).getValue () instanceof String )
81+ // GRECLIPSE end
7982 return configure (be , new ConstantExpression ((String ) ((ConstantExpression ) left ).getValue () + ((ConstantExpression ) right ).getValue ()));
8083 }
8184 }
You can’t perform that action at this time.
0 commit comments