-
Notifications
You must be signed in to change notification settings - Fork 139
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
Make StringLiteral.getLiteralValue thread safe #3521
Make StringLiteral.getLiteralValue thread safe #3521
Conversation
As this PR adds API it would be good to get a review from someone else too. @mpalat |
@jukzi : I will take a look. @SarikaSinha had moved out of Eclipse Team "officially" sometime back although she contributes at her "free" time occasionally. So wouldn't bother her unless its really required and hence removed her name from the review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martinlippert - As mentioned in the review comment in the AST, would not prefer this change. Since its just a couple of places - StringLiteral and CharacterLiteral, creating a new scanner from this.ast.scanner values would be better than having a convenience method at an API level. In case we need such similar changes later in other places, we can think of a convenience method in Scanner class (or a nested sub-class similar to VanguardScanner) - that would not constitute an API change since they are internal classes. So in short, would request to remove the API changes and create new Scanners at the charValue() and StringValue() methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and no new API
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Scanner.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @martinlippert for removing the new addition to API. However, about the addition of methods to Scanner, given @szarnekow feedback as well, I believe it's best to inline for now rather than adding methods to Scanner.
Yepp, no problem. Last commit reverted, back at inline scanner creation now. |
@martinlippert : could you please squash all 5 commits to a single one with appropriate commit message? |
79c594c
to
d0f145d
Compare
Done |
@mpalat : could you pleas update your review? Thanks. |
|
…ance StringLiteral.getLiteralValue and CharacterLiteral.charValue need to use their own local scanner instances in order to avoid issues when used concurrently Fixes eclipse-jdt#3424
d0f145d
to
658375e
Compare
Fixes #3424 + slightly improved tests from #3509
The exact same issue happens for CharacterLiteral.charValue, for which I added a test case and a fix as well.