Bug 74934

Summary: ArrayIndexOutOfBoundsException with float literal
Product: [Eclipse Project] JDT Reporter: David Audel <david_audel>
Component: CoreAssignee: David Audel <david_audel>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann
Version: 3.0   
Target Milestone: 3.1 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description David Audel CLA 2004-09-24 05:06:12 EDT
build I200409231635

1) create the following type
public class X {
  float f = 0x
}
2) try to save the file

An ArrayIndexOutOfBoundsException  occurs

java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 2
	at org.eclipse.jdt.internal.compiler.ast.IntLiteral.computeConstant
(Unknown Source)
	at org.eclipse.jdt.internal.compiler.ast.Literal.resolveType(Unknown 
Source)
	at org.eclipse.jdt.internal.compiler.ast.IntLiteral.resolveType
(Unknown Source)
	at org.eclipse.jdt.internal.compiler.ast.FieldDeclaration.resolve
(Unknown Source)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(Unknown Source)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(Unknown Source)
	at 
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve
(Unknown Source)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(Unknown 
Source)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(Unknown 
Source)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(Unknown Source)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(Unknown Source)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST
(Unknown Source)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(Unknown 
Source)
	at 
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartLis
tenerGroup.calculateASTandInform(Unknown Source)
	at 
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run
(Unknown Source)
	at org.eclipse.core.internal.jobs.Worker.run(Unknown Source)
Comment 1 David Audel CLA 2004-09-24 05:32:48 EDT
The problem seems to be inside Scanner. For "0x" scanNumber() return an 
IntegerLiteral instead of throw an InvalidInputException(INVALID_HEXA).
Comment 2 Philipe Mulet CLA 2004-09-24 06:03:39 EDT
The problem occurs in any compliance mode (i.e. not only in 1.5 mode); and was 
introduced by adding support for hex float literals.
This scenario breaks our support in the scanner.

Note: PublicScanner must be fixed in same way.

Likely candidate for rebuilding M2
Comment 3 David Audel CLA 2004-09-24 07:48:35 EDT
Fixed and test added

ScannerTest test019()->test021()
Comment 4 Olivier Thomann CLA 2004-09-24 10:28:46 EDT
Verified using 200409240800