Summary: | Compiler should support new hexadecimal floating-point literals | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Olivier Thomann <Olivier_Thomann> | ||||||||||
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||||||
Severity: | normal | ||||||||||||
Priority: | P3 | CC: | andre_weinand, philippe_mulet | ||||||||||
Version: | 3.0 | ||||||||||||
Target Milestone: | 3.1 M3 | ||||||||||||
Hardware: | PC | ||||||||||||
OS: | Windows XP | ||||||||||||
Whiteboard: | |||||||||||||
Attachments: |
|
Description
Olivier Thomann
2004-09-16 17:29:59 EDT
Created attachment 14584 [details]
Apply on HEAD
Here is a zipped file that contains a patch for the scanner, problem reporter,
IProblem and messages.properties.
It seems to work fine. I will write more tests.
The problem remains that the compiler requires 1.5 libraries in order to
compute the new floating-point literal constants.
Created attachment 14586 [details]
Apply on FloatLiteral and DoubleLiteral
Apply the two patches on FloatLiteral and DoubleLiteral. It is a hack to
compute the float or double constant when the compiler runs on 1.4 libraries.
I forgot to change the FloatLiteral class. Replace: try { computedValue = Float.valueOf(String.valueOf(source)); } catch (NumberFormatException e) { computedValue = getFloatingPoint(); } with: try { computedValue = Float.valueOf(String.valueOf(source)); } catch (NumberFormatException e) { try { computedValue = getFloatingPoint(); } catch(NumberFormatException e1) { return; } } First draft released. We will review the constant computation in case the libraries used to compile are < 1.5. I will add scanner tests to be sure that the new float and double literals are propertly scanned. This change requires changes in the ToolFactory. We have indeed three modes: - compliance 1.5 and source < 1.5: => This is one token - compliance 1.4 and source < 1.5: => This is mode than one token - compliance 1.5 and source 1.5: => This is one token Fixed and released in HEAD. Regression tests added. Verified in I200409231635. Reopening to include patches for improved handling of hex floating point literals. Created attachment 14808 [details]
Patch to o.e.jdt.core project
The patch replaces Util.getFloatingPoint(char[]) with
FloatUtil.valueOfHexDoubleLiteral(char[]) and
FloatUtil.valueOfHexFloatLiteral(char[]). These new methods handle all the
corner cases, including rounding, overflow, and gradual underflow.
Created attachment 14809 [details]
Patch to o.e.jdt.core.tests.compiler
Patch adds a new test, InternalHexFloatTest, to test the new internal FloatUtil
class's methods.
Reopening to include patches for improved handling of hex floating point literals. Fixed and released in HEAD. Regression tests added. Verified for 3.1M3 with build I20041101 |