Bug 6431

Summary: ArrayIndexOutOfBoundsException in the SourceIndexer requestor
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P1    
Version: 2.0   
Target Milestone: 2.0 M1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Olivier Thomann CLA 2001-11-29 11:46:58 EST
I compiled the following code and I got the stack trace below.
Version used: Latest contents of JDTCORE HEAD on build 1127.

[package p;

public class A {

	protected void foo() {
	}
	
	protected A a;
	
	public class F {
	public class D {
	public class B {
		
		public void bar() {
			foo();
			class C {
				void bar() {
					foo();
				}
			}
			new C().bar();
		}
		
		public Object bar2() {
			foo();
			return (new A() {
				Object foo2() {
					foo();
					return null;
				}
			}).foo2();
		}

	}
	}
	}
}]

java.lang.ArrayIndexOutOfBoundsException: 5
	at 
org.eclipse.jdt.internal.core.search.indexing.SourceIndexerRequestor.popTypeName
(SourceIndexerRequestor.java:243)
	at 
org.eclipse.jdt.internal.core.search.indexing.SourceIndexerRequestor.exitClass(S
ourceIndexerRequestor.java:204)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest
or(SourceElementParser.java:926)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser$LocalDeclarationVisitor.vi
sit(SourceElementParser.java:63)
	at 
org.eclipse.jdt.internal.compiler.ast.LocalTypeDeclaration.traverse(LocalTypeDec
laration.java:23)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.visitIfNeeded(SourceElemen
tParser.java:1199)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest
or(SourceElementParser.java:746)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest
or(SourceElementParser.java:915)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest
or(SourceElementParser.java:919)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest
or(SourceElementParser.java:919)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest
or(SourceElementParser.java:919)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest
or(SourceElementParser.java:581)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.endParse(SourceElementPars
er.java:328)
	at 
org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java(Compiled 
Code))
	at 
org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:6651)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit(Sourc
eElementParser.java:971)
	at 
org.eclipse.jdt.internal.core.search.indexing.SourceIndexer.indexFile(SourceInde
xer.java:66)
	at 
org.eclipse.jdt.internal.core.search.indexing.AbstractIndexer.index(AbstractInde
xer.java(Compiled Code))
	at 
org.eclipse.jdt.internal.core.index.impl.Index.add(Index.java(Compiled Code))
	at 
org.eclipse.jdt.internal.core.search.indexing.AddCompilationUnitToIndex.execute(
AddCompilationUnitToIndex.java:54)
	at 
org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java:2
66)
	at java.lang.Thread.run(Thread.java:498)
java.lang.ArrayIndexOutOfBoundsException: 5
	at 
org.eclipse.jdt.internal.core.search.indexing.SourceIndexerRequestor.popTypeName
(SourceIndexerRequestor.java:243)
	at 
org.eclipse.jdt.internal.core.search.indexing.SourceIndexerRequestor.exitClass(S
ourceIndexerRequestor.java:204)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest
or(SourceElementParser.java:926)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser$LocalDeclarationVisitor.vi
sit(SourceElementParser.java:59)
	at 
org.eclipse.jdt.internal.compiler.ast.AnonymousLocalTypeDeclaration.traverse(Ano
nymousLocalTypeDeclaration.java:124)
	at 
org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.traverse(Qua
lifiedAllocationExpression.java:259)
	at 
org.eclipse.jdt.internal.compiler.ast.MessageSend.traverse(MessageSend.java:254)
	at 
org.eclipse.jdt.internal.compiler.ast.ReturnStatement.traverse(ReturnStatement.j
ava:237)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.visitIfNeeded(SourceElemen
tParser.java:1199)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest
or(SourceElementParser.java:746)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest
or(SourceElementParser.java:915)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest
or(SourceElementParser.java:919)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest
or(SourceElementParser.java:919)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest
or(SourceElementParser.java:919)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest
or(SourceElementParser.java:581)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.endParse(SourceElementPars
er.java:328)
	at 
org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java(Compiled 
Code))
	at 
org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:6651)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit(Sourc
eElementParser.java:971)
	at 
org.eclipse.jdt.internal.core.search.indexing.SourceIndexer.indexFile(SourceInde
xer.java:66)
	at 
org.eclipse.jdt.internal.core.search.indexing.AbstractIndexer.index(AbstractInde
xer.java(Compiled Code))
	at 
org.eclipse.jdt.internal.core.index.impl.Index.add(Index.java(Compiled Code))
	at 
org.eclipse.jdt.internal.core.search.indexing.AddCompilationUnitToIndex.execute(
AddCompilationUnitToIndex.java:54)
	at 
org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java:2
66)
	at java.lang.Thread.run(Thread.java:498)
Comment 1 Philipe Mulet CLA 2001-11-29 11:51:49 EST
Fix is:

public void popTypeName(){
	try {
	enclosingTypeNames[--depth] = null;
	} catch (ArrayIndexOutOfBoundsException e) {
		e.printStackTrace();
	}
}
Comment 2 Philipe Mulet CLA 2001-11-29 11:55:00 EST
Fixed