Bug 41395 - StackOverflowError when pasting code
Summary: StackOverflowError when pasting code
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 38098 57067 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-08-11 12:13 EDT by Veronika Irvine CLA
Modified: 2004-05-18 11:04 EDT (History)
2 users (show)

See Also:


Attachments
java file (4.25 KB, text/plain)
2003-08-11 13:06 EDT, Veronika Irvine CLA
no flags Details
Veronika's preferences (59.64 KB, text/plain)
2003-08-11 13:08 EDT, Veronika Irvine CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Veronika Irvine CLA 2003-08-11 12:13:10 EDT
Eclipse 3.0 build 200307300800

I was pasting some code into an inner class (a listener) when I got the 
following stack overflow error.  The code I was pasting in did not have the 
correct number of closing "}".


!ENTRY org.eclipse.ui 4 0 Aug 11, 2003 10:31:03.460
!MESSAGE java.lang.StackOverflowError
!STACK 0
java.lang.StackOverflowError
	at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.<init>
(SourceTypeBinding.java:46)
	at org.eclipse.jdt.internal.compiler.lookup.NestedTypeBinding.<init>
(NestedTypeBinding.java:23)
	at org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding.<init>
(LocalTypeBinding.java:24)
	at org.eclipse.jdt.internal.compiler.lookup.ClassScope.buildLocalType
(ClassScope.java:143)
	at 
org.eclipse.jdt.internal.compiler.lookup.ClassScope.buildAnonymousTypeBinding
(ClassScope.java:33)
	at org.eclipse.jdt.internal.compiler.lookup.BlockScope.addAnonymousType
(BlockScope.java:77)
	at 
org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.resolveType
(QualifiedAllocationExpression.java:362)
	at org.eclipse.jdt.internal.compiler.ast.Expression.resolve
(Expression.java:433)
	at 
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatemen
ts(AbstractMethodDeclaration.java:363)
	at 
org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements
(MethodDeclaration.java:135)
	at 
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve
(AbstractMethodDeclaration.java:353)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(TypeDeclaration.java:848)
	at 
org.eclipse.jdt.internal.compiler.ast.AnonymousLocalTypeDeclaration.resolve
(AnonymousLocalTypeDeclaration.java:124)
	at 
org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.resolveType
(QualifiedAllocationExpression.java:363)
	at org.eclipse.jdt.internal.compiler.ast.Expression.resolve
(Expression.java:433)
	at 
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatemen
ts(AbstractMethodDeclaration.java:363)
	at 
org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements
(MethodDeclaration.java:135)
	at 
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve
(AbstractMethodDeclaration.java:353)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(TypeDeclaration.java:848)
	at 
org.eclipse.jdt.internal.compiler.ast.AnonymousLocalTypeDeclaration.resolve
(AnonymousLocalTypeDeclaration.java:124)
	at 
org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.resolveType
(QualifiedAllocationExpression.java:363)
	at org.eclipse.jdt.internal.compiler.ast.Expression.resolve
(Expression.java:433)
	at 
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatemen
ts(AbstractMethodDeclaration.java:363)
	at 
org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements
(MethodDeclaration.java:135)
	at 
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve
(AbstractMethodDeclaration.java:353)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(TypeDeclaration.java:848)
	at 
org.eclipse.jdt.internal.compiler.ast.AnonymousLocalTypeDeclaration.resolve
(AnonymousLocalTypeDeclaration.java:124)
	at 
org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.resolveType
(QualifiedAllocationExpression.java:363)
	at org.eclipse.jdt.internal.compiler.ast.Expression.resolve
(Expression.java:433)
...
Comment 1 Olivier Thomann CLA 2003-08-11 12:14:58 EDT
Could you please provide the whole test case?
Thanks.
Comment 2 Veronika Irvine CLA 2003-08-11 12:49:03 EDT
I will have to try and recreate it the steps.  After the StackOverflow error, 
eclipse was not behaving correctly and had to be restarted.  
Comment 3 Veronika Irvine CLA 2003-08-11 13:04:58 EDT
I had the class Browser.java (see attached).  I selected the following:

--start selection here
				webSite.addEventListener
(OleWebBrowser.ProgressChange, new OleListener() {
		public void handleEvent(OleEvent event) -- end selection here 
(before "}")

Then, I hit Ctrl+X, CTRL+Z, CTRL+S a few times and the error happened.  I 
can't make it happen every time but if I play with the CTRL+X, CTRL+Z, CTRL+S, 
eventually it happens.

I will also attach my preferences.
Comment 4 Veronika Irvine CLA 2003-08-11 13:06:28 EDT
Created attachment 5714 [details]
java file

Browser.java
Comment 5 Veronika Irvine CLA 2003-08-11 13:08:04 EDT
Created attachment 5715 [details]
Veronika's preferences

Veronika's preferences
Comment 6 Olivier Thomann CLA 2003-08-26 10:49:55 EDT
I think this has something to do with the recovery.
Comment 7 Philipe Mulet CLA 2004-04-08 08:55:47 EDT
Need to be backported to 2.1 once addressed.
Comment 8 David Audel CLA 2004-04-08 09:10:09 EDT
Simple test case
1) create X.java
package p;
public class X{
  public void foo() {
    new Y() {
      public void bar() {
        switch (zzz){
          case 1 :
          };
        }
        new Z() {
          public void to<cursor>to() {			
        }
      });
    });
  }
}
2) do ctrl + space at cursor location
Comment 9 David Audel CLA 2004-04-08 10:52:02 EDT
Inside RecoveredType
[public RecoveredElement add(TypeDeclaration memberTypeDeclaration, int 
bracketBalanceValue) {
   ...
   return lastMethod.add(typeDeclaration, bracketBalanceValue);
   ...
}]
must be
[public RecoveredElement add(TypeDeclaration memberTypeDeclaration, int 
bracketBalanceValue) {
   ...
   return lastMethod.add(memberTypeDeclaration, bracketBalanceValue);
   ...
}]

Fixed and regression test added (CompletionParserTest2#test0138()) in 3.0
Comment 10 David Audel CLA 2004-04-08 10:54:32 EDT
*** Bug 57067 has been marked as a duplicate of this bug. ***
Comment 11 David Audel CLA 2004-04-08 10:56:45 EDT
*** Bug 38098 has been marked as a duplicate of this bug. ***
Comment 12 David Audel CLA 2004-04-08 13:16:47 EDT
Backported and regression test added (CompletionParserTest2#test0130()) in 2.1
Comment 13 Olivier Thomann CLA 2004-05-18 11:04:29 EDT
Verified in 200405180816