Bug 74934 - ArrayIndexOutOfBoundsException with float literal
Summary: ArrayIndexOutOfBoundsException with float literal
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M2   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-24 05:06 EDT by David Audel CLA
Modified: 2004-09-24 10:28 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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