Issue #14805: Remove support for string templates syntax#15212
Conversation
| STRING_TEMPLATE_CONTENT, EMBEDDED_EXPRESSION_BEGIN, EMBEDDED_EXPRESSION, | ||
| EMBEDDED_EXPRESSION_END, | ||
|
|
There was a problem hiding this comment.
had to leave string templates token in the lexer due to:
[ERROR] GeneratedJavaTokenTypesTest.testTokenNumbering:741 A token's number has changed. Please open 'GeneratedJavaTokenTypesTest' and confirm which token is at fault.
Token numbers must not change or else they will create a conflict with users.
See Issue: https://github.com/checkstyle/checkstyle/issues/505
If we remove string template tokens from the lexer the last two tokens' numbers will change and we have a test that ensures that the tokens' numbers don't change.
accordingly, coverage for javaLnaguageLexer.java will drop
@nrmancuso please help in this how to remove the tokens and pass GeneratedJavaTokenTypesTest.testTokenNumbering ?
There was a problem hiding this comment.
Please do:
- Update coverage numbers to make
mvn clean verifyhappy (generated files are not a big concern on this front, and it is obvious why it is dropping in this case) - Add file filter modules to openjdk21 no-exceptions execution, see link at the top of this file if you want to do it via script
- prefix all string template tokens in the lexer with
DEPRECATED_ - Leave a comment in the lexer about why we did item 3.
Sadly, we consider renumbering of tokens in our API as a breaking change, so we need to keep these tokens unless we can agree that this case is exceptional.
|
What if we put |
3534ec9 to
bdfdf43
Compare
|
I had to use |
bdfdf43 to
003cc3d
Compare
| // are no longer used, but we need to keep them to preserve token numbering, | ||
| // so that we are not breaking change with older versions. | ||
| // We used 'DEPRECATED' as prefix to indicate that they are not used. | ||
| DEPRECATED_STRING_TEMPLATE_BEGIN,DEPRECATED_STRING_TEMPLATE_MID, DEPRECATED_STRING_TEMPLATE_END, |
There was a problem hiding this comment.
__Not__For_usage1__, __Not__For_usage2__
To completely forget why it was added.
No reason in comment. No confusion in future.
I open for better names.
There was a problem hiding this comment.
We can do NOT_FOR_USAGE_1 with comment that these are placeholders to maintain token ordering, we can skip mentioning string templates
003cc3d to
b763422
Compare
Isn't this whole PR a breaking change? We are removing what we once supported. Issue is already labeled as this. I am good to remove all existence of the old tokens and change numbers. I prefer a clean break over leaving crazyness in our code. I think this should be why we shouldn't support any preview features until they get out of the preview state. |
I am good, @romani? |
|
Yes, it is breaking changes. We already did this ones in a past :). Users were upset. Let's not deal with them. Managing API is hard , and we need to do it in hard way. Fortunately this deprecation is easy. |
b763422 to
f5c492a
Compare
|
I am prepared to approve after #15212 (review) is completed, and reports at https://github.com/nrmancuso/checkstyle-diff-report-generator/actions/runs/9864962646 look good. |
|
To be clear, nothing blocks us from making a new issue to remove the placeholder tokens and breaking compatibility, @rnveach feel free to open such an issue and we can continue the discussion there. We need to get this PR across the finish line. |
|
@romani please proceed with review |
f5c492a to
ef5cf61
Compare
|
@mahfouz72 I have added the reports to the PR description, please analyze them and share results for each under each report. |
nrmancuso
left a comment
There was a problem hiding this comment.
Approved conditionally based on report results.
|
Reports and analysis looks good, the stack overflow causes undefined behavior which can manifest on our side or ANTLR’s side. |
interesting statistics, but why is there a huge difference compared to other PR? Does parsing have such high time complexity? |
|
Will we have 10.18.0 this month? I thought it would be postponed for next month due to the release issues
why not? why does it have to be after release? |
Yes, this is our MOST performance sensitive area. |
The last message we got from @romani was he would come back to the release issue in a week (already passed) and he would continue the release. He hasn't said it has been moved to the end of the month.
We want this and other PR to go together or as @nrmancuso says for the other to go first. I don't want to merge this first before the other and then find out a surprise release happened. |
|
Too much activity in projects, I deprioritized release in favor of unblocking activity in project. |
|
It is safe to merge. |
closes #14805
Reports
Projects file: projects-to-test-on.properties
Patch branch: pull-15212
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/pull-15212/2024-07-10-T-00-20-42/part1/index.html
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/pull-15212/2024-07-10-T-00-20-42/part4/index.html
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/pull-15212/2024-07-10-T-00-20-42/part5/index.html
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/pull-15212/2024-07-10-T-00-20-42/part3/index.html
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/pull-15212/2024-07-10-T-00-20-42/part2/index.html
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/pull-15212/2024-07-10-T-00-20-42/part6/index.html
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/pull-15212/2024-07-10-T-00-20-42/sevntu-check-regression_part_1/index.html
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/pull-15212/2024-07-10-T-00-20-42/sevntu-check-regression_part_2/index.html
All previous reports are good. differences are:
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/pull-15212/2024-07-10-T-00-20-42/antlr-report-checkstyle/index.html
Report is good difference are:
I just don't understand this. Is this expected? it is still stackoverflow but the difference in messages is not just line numbers