JDK-5014349 : Annotation float value seems double
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 1.4.2,5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_98,windows_2000
  • CPU: x86
  • Submitted: 2004-03-16
  • Updated: 2017-08-07
  • Resolved: 2017-08-07
Related Reports
Duplicate :  
Relates :  
Description

Name: rmT116609			Date: 03/16/2004


FULL PRODUCT VERSION :
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Windows Millennium [Version 4.90.3000]

A DESCRIPTION OF THE PROBLEM :
My Annotation flort value seems double in Javadoc.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javadoc -source 1.5 X.java


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Annotation Type X

@F(value=1.23456789f)
public @interface X
ACTUAL -
Annotation Type X

@F(value=1.2345678806304932f)
public @interface X

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.lang.annotation.*;

@F(1.23456789f)
public @interface X {
	float value();
}

@Documented
@interface F {
	float value();
}

---------- END SOURCE ----------
(Incident Review ID: 243762) 
======================================================================

Comments
The expected behavior, the display of @F(value=1.2345679f) in the generated javadoc, is present with the new doclet implemention in JDK 9. Closing as not reproducible.
07-08-2017

PUBLIC COMMENTS -
10-06-2004

EVALUATION In FieldDocImpl.constantValueExpression, the float is indeed "doubled" (converted to a double) in the course of formatting it to a string. I believe that the expected result is actually @F(value=1.2345679f) (note the missing 8) due to the precision limitations of float. That is, 1.2345679f and 1.23456789f represent the same float value. ###@###.### 2004-03-16
16-03-2004