This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | [JShell] out of bounds during code completion | ||
---|---|---|---|
Product: | java | Reporter: | Jaroslav Tulach <jtulach> |
Component: | JShell | Assignee: | Svata Dedic <sdedic> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | dbalek |
Priority: | P2 | ||
Version: | 8.2 | ||
Hardware: | PC | ||
OS: | Linux | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | Possible fix |
Description
Jaroslav Tulach
2016-09-07 07:57:53 UTC
If we could start the server, it would form nice JavaOne demo. I have fixed the issue in jshell_support_jdk9 branch. The implementation used caret position to navigate or offset within the parsing API Snapshot - in the case the snapshot contains an embedding of only part of the source, deltas / lengths screw up. Please review the attached diff. Created attachment 161971 [details]
Possible fix
I have added helper methods to translate caret position to pos in the embedding; IMHO they should be protected for other BaseTask subclasses, but it's not the right time to do API changes if the patch could make it to 8.2 release
The proposed fix looks OK except of the spec.version.base change from 1.7.0 to 1.6.0. I would also consider making the helper methods protected right now even though it requires an API change. Moving to an appropriate component Should be already fixed by rewriting the parsing/embedding creation. |