-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Java 21 string template syntax #13830
Comments
We typically do add support for preview features (especially useful ones like String templates), I can take this up soon. |
It sounds good. Thank you |
New grammar summary (adapted from here):
Reading:
Attention: mutliline strings delimited with only single Example:
Note the expression within the template:
Edit: it is required for us to support parsing of templated expressions, since line wrapping of single Example:
|
So it a type that has such operator-method And in separate iteration add support of parsing it's content. |
Keep in mind that
|
Checkstyle parser is not type aware https://checkstyle.org/writingchecks.html#Limitations . We rely on compiler to do verification of this. For us it will looks like all objects can have ." or .""". |
So that leaves option 2: let the compiler worry about that. |
hello, I just bumped into this issue as well and I wonder what is the status on that or if there is any workaround atm? |
@mikepapadim , please build jar from #13991 and run on your sources to confirm that it works, it will speed up acceptance of such PR. Or simply |
@mikepapadim this might be helpful until we get these PRs merged: #12542 (comment) |
Thank you for the quick replies! I'll give it a go |
Thanks! that did the trick for now |
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words
in place of the last 2 commands above.
Java 21 is out, and it has the new String Templates as a preview feature. I did not really go deeper but if the configuration is having TreeWalker module, with at least one entry, then the build fails with the above-mentioned error, and if it happens inside a Maven build it just fails. It fails at the following line:
String result = STR."\{x} + \{y} = \{x + y}";
If the TreeWalker is not present or empty, it finishes successfuly. Will the Java 21 based preview features be supported in upcoming releases?
The text was updated successfully, but these errors were encountered: