Bug 271680 - [compiler] Stack overflow pasting in Java editor
Summary: [compiler] Stack overflow pasting in Java editor
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M7   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-08 14:50 EDT by John Arthorne CLA
Modified: 2009-04-28 05:47 EDT (History)
2 users (show)

See Also:


Attachments
Log file (613.62 KB, text/plain)
2009-04-08 14:51 EDT, John Arthorne CLA
no flags Details
Proposed patch (22.63 KB, patch)
2009-04-16 09:30 EDT, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2009-04-08 14:50:21 EDT
I20090401

I accidentally pasted 8000 lines of text into the end of a Java editor. This resulted in a stack overflow error. At that point doing anything at all resulted in more stack overflows, even trying to close the editor produced a stack overflow. Obviously I did something silly here (meant to paste into a text file instead of a Java file), but it seems like it should recover from this case better.

The exact case I did was paste the MANIFEST.MF from org.eclipse.ui.workbench into a trivial Java class, after the final brace to end the class declaration.
Comment 1 John Arthorne CLA 2009-04-08 14:51:10 EDT
Created attachment 131324 [details]
Log file
Comment 2 Olivier Thomann CLA 2009-04-08 14:55:36 EDT
The stackoverflow is in the recovery.
Comment 3 David Audel CLA 2009-04-09 05:30:07 EDT
I do not reproduce the problem but i am not sure to understand your test case.

You wrote that you pasted 8000 lines of text and you wrote that the pasted file is the MANIFEST.MF from org.eclipse.ui.workbench. But this file contains around 100 lines and not 8000. What is exactly your test case ?
Comment 4 John Arthorne CLA 2009-04-09 08:09:21 EDT
Go to eclipse/plugins/ in your eclipse install, and open the org.eclipse.ui.workbench...jar file. The MANIFEST.MF in there is much larger due to the signature block.
Comment 5 David Audel CLA 2009-04-09 08:42:48 EDT
I reproduced the stackoverflow with this MANIFEST.MF.
Comment 6 David Audel CLA 2009-04-16 09:30:18 EDT
Created attachment 132076 [details]
Proposed patch

The diet recovery create a deep hierarchy of enclosing types

...
class SHA1 {
  class SHA1 {
    class SHA1 {
      class SHA1 {
      ...
}
...

This recovery is valid but cause the Stack overflow.

So this fix limit the depth of recovered types to 256. If this threshold is reached then deeper member types will be ignored by the recovery.
Comment 7 David Audel CLA 2009-04-16 09:34:06 EDT
Released for 3.5M7.

Test added
  DietRecoveryTest#test125()
Comment 8 Srikanth Sankaran CLA 2009-04-28 05:47:31 EDT
Verified for 3.5M7 using I20090426-2000