XPath 2 expression in String causes error message

已回答

I am using XPath 2 in a java program. Idea complains about the commas here:

String exp = """
(/*[@something]//a,
 /*[@something]//b,
 /*[@something]//c)
""";

The expression is valid and this compiles with gradle (jdk 17).

Alt+Enter offers no way to turn off the error message, that I can see. Oddly, this avoids the error message:

String exp = String.valueOf("""
(/*[@something]//a,
 /*[@something]//b,
 /*[@something]//c)
""");

Do you think this is a bug? Any suggestions on how to make IDEA accept the first string?

0

Hello Kshaw,

I can't reproduce it in IDEA 2024.1, would it be possible for you to kindly provide a minimal sample project for me to reproduce the issue while ensuring that your sensitive code is not included? Thank you!  Please upload it to https://uploads.jetbrains.com/  and paste the upload ID here.

A screenshot of the error is also helpful.

0

请先登录再写评论。