File tree 3 files changed +12
-0
lines changed
antlr4/org/springframework/data/jpa/repository/query
java/org/springframework/data/jpa/repository/query
test/java/org/springframework/data/jpa/repository/query
3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,7 @@ constructor_item
204
204
| scalar_expression
205
205
| aggregate_expression
206
206
| identification_variable
207
+ | literal
207
208
;
208
209
209
210
aggregate_expression
@@ -620,6 +621,7 @@ constructor_name
620
621
621
622
literal
622
623
: STRINGLITERAL
624
+ | JAVASTRINGLITERAL
623
625
| INTLITERAL
624
626
| FLOATLITERAL
625
627
| LONGLITERAL
@@ -855,6 +857,7 @@ NOT_EQUAL : '<>' | '!=' ;
855
857
CHARACTER : ' \' ' (~ (' \' ' | ' \\ ' )) ' \' ' ;
856
858
IDENTIFICATION_VARIABLE : (' a' .. ' z' | ' A' .. ' Z' | ' \u0080 ' .. ' \ufffe ' | ' $' | ' _' ) (' a' .. ' z' | ' A' .. ' Z' | ' \u0080 ' .. ' \ufffe ' | ' 0' .. ' 9' | ' $' | ' _' )* ;
857
859
STRINGLITERAL : ' \' ' (~ (' \' ' | ' \\ ' ))* ' \' ' ;
860
+ JAVASTRINGLITERAL : ' "' ( (' \\ ' [btnfr" ']) | ~('" ' ))* ' " ';
858
861
FLOATLITERAL : ('0' .. '9')* '.' ('0' .. '9')+ (E ('0' .. '9')+)* (F|D)?;
859
862
INTLITERAL : ('0' .. '9')+ ;
860
863
LONGLITERAL : ('0' .. '9')+L ;
Original file line number Diff line number Diff line change @@ -723,6 +723,8 @@ public List<JpaQueryParsingToken> visitConstructor_item(JpqlParser.Constructor_i
723
723
tokens .addAll (visit (ctx .aggregate_expression ()));
724
724
} else if (ctx .identification_variable () != null ) {
725
725
tokens .addAll (visit (ctx .identification_variable ()));
726
+ } else if (ctx .literal () != null ) {
727
+ tokens .addAll (visit (ctx .literal ()));
726
728
}
727
729
728
730
return tokens ;
@@ -2153,6 +2155,8 @@ public List<JpaQueryParsingToken> visitLiteral(JpqlParser.LiteralContext ctx) {
2153
2155
2154
2156
if (ctx .STRINGLITERAL () != null ) {
2155
2157
tokens .add (new JpaQueryParsingToken (ctx .STRINGLITERAL ()));
2158
+ } else if (ctx .JAVASTRINGLITERAL () != null ) {
2159
+ tokens .add (new JpaQueryParsingToken (ctx .JAVASTRINGLITERAL ()));
2156
2160
} else if (ctx .INTLITERAL () != null ) {
2157
2161
tokens .add (new JpaQueryParsingToken (ctx .INTLITERAL ()));
2158
2162
} else if (ctx .FLOATLITERAL () != null ) {
Original file line number Diff line number Diff line change @@ -66,4 +66,9 @@ void numericLiterals() {
66
66
assertQuery ("SELECT s FROM Stat s WHERE s.ratio > 3.14e32D" );
67
67
}
68
68
69
+ @ Test // GH-3308
70
+ void newWithStrings () {
71
+ assertQuery ("select new com.example.demo.SampleObject(se.id, se.sampleValue, \" java\" ) from SampleEntity se" );
72
+ }
73
+
69
74
}
You can’t perform that action at this time.
0 commit comments