Bug 285845

Summary: ArrayIndexOfBoundException on lookup.MethodBinding.collectMissingTypes
Product: [Eclipse Project] JDT Reporter: Alex FAU <alexandre.fau>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, Olivier_Thomann, srikanth_sankaran, stephan.herrmann
Version: 3.4.1   
Target Milestone: 3.6 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Alex FAU CLA 2009-08-06 07:26:35 EDT
Hi,

When I try to use ASTParser.createAST I have an exception :
java.lang.ArrayIndexOutOfBoundsException: 1
	at org.eclipse.jdt.internal.compiler.lookup.MethodBinding.collectMissingTypes(MethodBinding.java:314)
	at org.eclipse.jdt.internal.compiler.ClassFile.generateMethodInfoAttribute(ClassFile.java:6299)
	at org.eclipse.jdt.internal.compiler.ClassFile.addProblemMethod(ClassFile.java:949)
	at org.eclipse.jdt.internal.compiler.ClassFile.createProblemType(ClassFile.java:195)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:500)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:581)
	at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode(CompilationUnitDeclaration.java:345)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:871)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:518)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:880)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:656)

Looking at the code that throw the exception :
for (int i = 0, max = this.typeVariables.length; i < max; i++) {
			TypeVariableBinding variable = this.typeVariables[i];
			missingTypes = variable.superclass().collectMissingTypes(missingTypes);
			ReferenceBinding[] interfaces = variable.superInterfaces();
			for (int j = 0, length = interfaces.length; j < length; j++) {
				missingTypes = interfaces[i].collectMissingTypes(missingTypes);
			}
		}

Looks like the interfaces[i] must be interfaces[j] ...

@lex
Comment 1 Srikanth Sankaran CLA 2009-08-06 07:58:32 EDT
Seems to have been fixed in 3.5M3, version 1.104
of MethodBinding.java
Comment 2 Alex FAU CLA 2009-08-06 11:08:59 EDT
Hi,

FYI It is also fixed in 3.4.2.

@
Comment 3 Stephan Herrmann CLA 2009-08-07 17:31:29 EDT
So, it's a dupe of bug 247666
(fix is in MethodBinding.java version 1.105, to be precise ;-)
Comment 4 Olivier Thomann CLA 2009-08-08 19:14:08 EDT

*** This bug has been marked as a duplicate of bug 247666 ***
Comment 5 Ayushman Jain CLA 2009-09-15 02:58:07 EDT
Verified for 3.6M2 using build I20090914-1800