| Summary: | ArrayIndexOutOfBoundsException in TokenManager | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Dmitry Katsubo <dma_k> | ||||||
| Component: | Core | Assignee: | Stephan Herrmann <stephan.herrmann> | ||||||
| Status: | CLOSED WORKSFORME | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | jarthana, noopur_gupta, stephan.herrmann | ||||||
| Version: | 4.7.1 | ||||||||
| Target Milestone: | 4.16 M3 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 272213 [details]
Screenshot
Recovery is a very complicated piece of the eclipse compiler and it's all automated. I am not sure we can do much about it. Anyway, I also see another problem with this code: When I copy+paste this into package explorer, two types getting created - com.test.ControllerImpl and snippet.ControllerImpl. Noopur, do you know what's causing this? (In reply to Jay Arthanareeswaran from comment #2) > Anyway, I also see another problem with this code: When I copy+paste this > into package explorer, two types getting created - com.test.ControllerImpl > and snippet.ControllerImpl. > > Noopur, do you know what's causing this? That's due to two package declarations in the code. PasteAction can be used to paste multiple CUs in one go which are identified by the beginning of a new package declaration. (In reply to Jay Arthanareeswaran from comment #2) > Recovery is a very complicated piece of the eclipse compiler and it's all > automated. I am not sure we can do much about it. If we think this is a relevant use case, then we could add one or more rules to the grammar expecting package declarations in bogus locations so that parsing can hand-craft a dedicated error message and discard the package declaration in AST. I say "relevant" because this approach certainly doesn't scale for all kinds of broken inputs. (In reply to Noopur Gupta from comment #3) > That's due to two package declarations in the code. PasteAction can be used > to paste multiple CUs in one go which are identified by the beginning of a > new package declaration. Shouldn't they both go to the same package in that case? Just curious. (In reply to Jay Arthanareeswaran from comment #5) > (In reply to Noopur Gupta from comment #3) > > That's due to two package declarations in the code. PasteAction can be used > > to paste multiple CUs in one go which are identified by the beginning of a > > new package declaration. > > Shouldn't they both go to the same package in that case? Just curious. I will have to debug it to find that out. Relevant code: PasteAction.TextPaster.parseCUs(IJavaProject javaProject, String text). (In reply to Noopur Gupta from comment #6) > (In reply to Jay Arthanareeswaran from comment #5) > > (In reply to Noopur Gupta from comment #3) > > > That's due to two package declarations in the code. PasteAction can be used > > > to paste multiple CUs in one go which are identified by the beginning of a > > > new package declaration. > > > > Shouldn't they both go to the same package in that case? Just curious. > > I will have to debug it to find that out. Relevant code: > PasteAction.TextPaster.parseCUs(IJavaProject javaProject, String text). Moved this discussion out to a separate bug 529691. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. Exception no longer occurs. Syntax errors are reported based on best-effort by definition. Hence WONTFIX looks OK to me. I confirm that error recovery works better now. (In reply to Dmitry Katsubo from comment #10) > I confirm that error recovery works better now. thanks for confirming. |
Created attachment 272212 [details] Eclipse log Given Java snippet: package com.test; public class ControllerImpl { package com.test; public ControllerImpl() { } } causes ArrayIndexOutOfBoundsException in TokenManager. Every line in source is marked as erroneous and it is not possible to see what exactly caused the problem. Expected that Eclipse can recover from syntax error in line "package com.test;"