Community
Participate
Working Groups
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) ...
I renamed the file manually. To reproduce, attempt to rename OldSearchTests to something else.
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.
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.
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?
A workaround is to increase the java thread stack size using -Xss256K (default being 128K)
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.
OK, please close.
If the tree is too deep, there is no much we can do about it.