JDK-4759494 : divide by zero warning desirable when generating constant-value.html
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 1.4.2
  • Priority: P5
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2002-10-08
  • Updated: 2017-05-16
  • Resolved: 2005-04-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b33Fixed
Description
for the following case
=======================

public class divzero
{
        public static final int i = 20/0;
}


if i is assigned 20/10, 0r any other valid constant expression, the constant 
folding is done and value is generated in the constant-value.html in the Javadoc 
output.

But when the constant expression involves a divide by zero, the Javadoc quietly 
ignores the constant value. While this condition is handled right in Javadoc, a 
warning could be helpful. It could be argued that the Compiler for the same code 
doesnt emit a warning, but here, the user gets to SEE the Html output and a 
value is missing. So it is better to inform the user about this 'skip' of 
Constant value generation with the cause.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
17-07-2004

PUBLIC COMMENTS -
17-07-2004

EVALUATION Note that an expression that divides by zero is not a constant expression according to the JLS, contrary to the description of this bug report. We plan to add such a warning to javac, which will therefore be produced by javadoc when appropriate. ###@###.### 2002-10-18
18-10-2002