File tree 4 files changed +26
-0
lines changed
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
base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/basic
4 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1069,6 +1069,23 @@ public void testStaticProperty14() {
1069
1069
"----------\n " );
1070
1070
}
1071
1071
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
+
1072
1089
@ Test
1073
1090
public void testClash_GRE1076 () {
1074
1091
//@formatter:off
Original file line number Diff line number Diff line change @@ -82,6 +82,9 @@ public static ConstantExpression transformBinaryConstantExpression(BinaryExpress
82
82
Expression left = transformInlineConstants (be .getLeftExpression (), targetType );
83
83
Expression right = transformInlineConstants (be .getRightExpression (), targetType );
84
84
if (left instanceof ConstantExpression && right instanceof ConstantExpression ) {
85
+ // GRECLIPSE add -- GROOVY-10159
86
+ if (((ConstantExpression ) left ).getValue () instanceof String )
87
+ // GRECLIPSE end
85
88
return configure (be , new ConstantExpression ((String ) ((ConstantExpression ) left ).getValue () +
86
89
((ConstantExpression ) right ).getValue ()));
87
90
}
Original file line number Diff line number Diff line change @@ -77,6 +77,9 @@ public static ConstantExpression transformBinaryConstantExpression(final BinaryE
77
77
Expression left = transformInlineConstants (be .getLeftExpression (), targetType );
78
78
Expression right = transformInlineConstants (be .getRightExpression (), targetType );
79
79
if (left instanceof ConstantExpression && right instanceof ConstantExpression ) {
80
+ // GRECLIPSE add -- GROOVY-10159
81
+ if (((ConstantExpression ) left ).getValue () instanceof String )
82
+ // GRECLIPSE end
80
83
return configure (be , new ConstantExpression ((String ) ((ConstantExpression ) left ).getValue () + ((ConstantExpression ) right ).getValue ()));
81
84
}
82
85
}
Original file line number Diff line number Diff line change @@ -76,6 +76,9 @@ public static ConstantExpression transformBinaryConstantExpression(final BinaryE
76
76
Expression left = transformInlineConstants (be .getLeftExpression (), targetType );
77
77
Expression right = transformInlineConstants (be .getRightExpression (), targetType );
78
78
if (left instanceof ConstantExpression && right instanceof ConstantExpression ) {
79
+ // GRECLIPSE add -- GROOVY-10159
80
+ if (((ConstantExpression ) left ).getValue () instanceof String )
81
+ // GRECLIPSE end
79
82
return configure (be , new ConstantExpression ((String ) ((ConstantExpression ) left ).getValue () + ((ConstantExpression ) right ).getValue ()));
80
83
}
81
84
}
You can’t perform that action at this time.
0 commit comments