-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8254073: Tokenizer improvements (revised) #525
Conversation
/test |
👋 Welcome back jlaskey! A progress list of the required criteria for merging this PR into |
@JimLaskey The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Could not create test job |
Webrevs
|
/test |
Could not create test job |
int code = 0; | ||
|
||
for (int i = 0; i < 4; i++) { | ||
int digit = Character.digit(buffer[index], 16); |
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.
This looks suspicious - what if index ends up being bigger than (or equal to) buffer.length
?
Maybe we need a test for incomplete unicode sequences at the end of the tokenizer input - e.g. \u123
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.
You are correct. Will revise.
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.
Added change to
int digit = index < length ? Character.digit(buffer[index], 16) : -1;
Also added new test.
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.
Looks good - I've added optional suggestions for the test
|
||
public class JavaLexerTest2 { | ||
static final TestTuple[] TESTS = { | ||
new TestTuple("0bL", LONGLITERAL, true), |
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.
Stylistic (optional) comment - we could have a common TestTuple superclass and two subclasses called Success and Failure, so that, by looking at the TESTS array it will be apparent what the behavior should be
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.
Done
String expected; | ||
boolean willFail; | ||
|
||
TestTuple(String input, TokenKind kind, String expected, boolean willFail) { |
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.
Is anything using this?
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.
It does now.
|
||
import static com.sun.tools.javac.parser.Tokens.TokenKind.*; | ||
|
||
public class JavaLexerTest2 { |
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.
Should we merge JavaLexerTest and this one? After all you have all the required infra in here?
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.
Done.
@JimLaskey This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
/test |
Could not create test job |
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.
Looks good
/integrate |
@JimLaskey Since your change was applied there have been 10 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 4f9a1ff. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This is a full revision of #435 which contained two 'out by one' bugs and was reverted.
This revision contains the changes of that pull request plus:
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/525/head:pull/525
$ git checkout pull/525