Bug 32957 - StackOverFlowError renaming class
Summary: StackOverFlowError renaming class
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 RC2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-25 09:32 EST by Jerome Lanneluc CLA
Modified: 2003-02-26 10:28 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jerome Lanneluc CLA 2003-02-25 09:32:54 EST
Build 2.1RC1

Attempting to rename SearchTests (in org.eclipse.jdt.tests.core) to 
OldSearchTests, I got the following StackOverFlowError:

Caused by: java.lang.StackOverflowError
        at java.lang.Exception.<init>(Exception.java:41)
        at java.lang.RuntimeException.<init>(RuntimeException.java:43)
        at java.lang.IndexOutOfBoundsException.<init>
(IndexOutOfBoundsException.java:37)
        at java.lang.ArrayIndexOutOfBoundsException.<init>
(ArrayIndexOutOfBoundsException.java:46)
        at 
org.eclipse.jdt.internal.compiler.parser.Scanner.getNextCharAsJavaIdentifierPart
(Scanner.java:729)
        at 
org.eclipse.jdt.internal.compiler.parser.Scanner.scanIdentifierOrKeyword
(Scanner.java:2244)
        at org.eclipse.jdt.internal.compiler.parser.Scanner.getNextToken
(Scanner.java:1353)
        at org.eclipse.jdt.core.dom.SimpleName.setIdentifier
(SimpleName.java:119)
        at org.eclipse.jdt.core.dom.AST.newSimpleName(AST.java:631)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1619)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:837)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1638)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:837)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1638)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:837)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1638)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:837)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1638)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:837)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1638)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:837)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1638)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:837)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1638)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:837)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1638)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:837)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1638)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:837)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1638)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:837)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1638)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:837)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1638)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:837)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1638)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:837)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1638)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:837)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1638)
        ...
Comment 1 Jerome Lanneluc CLA 2003-02-25 09:40:50 EST
I renamed the file manually. To reproduce, attempt to rename OldSearchTests to 
something else.
Comment 2 Olivier Thomann CLA 2003-02-25 15:23:24 EST
This is due to the code in testPotentialSubclassesOfObject() method. There is a
sequence starting with:
		new StringBuffer().append(
		"path: /Compiler/lib/classes.zip|java/applet/Applet.class\n").append( 
		"path: /Compiler/lib/classes.zip|java/awt/AWTError.class\n").append( 
		"path: /Compiler/lib/classes.zip|java/awt/AWTEvent.class\n").append( 
		"path: /Compiler/lib/classes.zip|java/awt/AWTEventMulticaster.class\n").append( 
		"path: /Compiler/lib/classes.zip|java/awt/AWTException.class\n").append( 
		"path: /Compiler/lib/classes.zip|java/awt/BorderLayout.class\n").append( 
		"path: /Compiler/lib/classes.zip|java/awt/Button.class\n").append( 
		"path: /Compiler/lib/classes.zip|java/awt/Canvas.class\n").append( 
		"path: /Compiler/lib/classes.zip|java/awt/CardLayout.class\n").append( 
		"path: /Compiler/lib/classes.zip|java/awt/Checkbox.class\n").append( 
.....
The stack depth is reached before the whole statement has been converted.
Comment 3 Olivier Thomann CLA 2003-02-25 16:57:38 EST
The stackoverflow doesn't seem to come from the conversion itself. During the
conversion the scanner is used to scan the identifier. The stackoverflow seems
to be thrown during the initialization of the ArrayIndexOutOfBoundException.
This exception is caught locally in the scanner, but it cannot be initialized
properly. I don't think there is much we can do about it. It could be
interesting to see if it runs fine using another VMs.
Comment 4 Jerome Lanneluc CLA 2003-02-26 06:31:41 EST
The stack overflows in the constructor of ArrayIndexOutOfBoundsException only 
because of the previous recursion which took almost all space on the stack.

Would it be possible to not use recursion in this case?
Comment 5 Jerome Lanneluc CLA 2003-02-26 06:41:37 EST
A workaround is to increase the java thread stack size using -Xss256K (default 
being 128K)
Comment 6 Olivier Thomann CLA 2003-02-26 09:13:53 EST
No. Even if I remove the recursion in the creation of the tree, it won't be 
possible to walk the tree using the visitor. This is simply a limitation. javac 
cannot compile this source. It blows up with a stackoverflow. So the increasing 
the stack size seems to be the only solution.
I would close as WONTFIX.
Comment 7 Jerome Lanneluc CLA 2003-02-26 10:20:51 EST
OK, please close.
Comment 8 Olivier Thomann CLA 2003-02-26 10:28:55 EST
If the tree is too deep, there is no much we can do about it.