JDK-4759494 : divide by zero warning desirable when generating constant-value.html
  • Type: Enhancement
  • Status: Closed
  • Resolution: Fixed
  • Component: tools
  • Sub-Component: javac
  • Priority: P5
  • Affected Version: 1.4.2
  • OS: solaris_9
  • CPU: sparc
  • Submit Date: 2002-10-08
  • Updated Date: 2017-05-16
  • Resolved Date: 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 Availabitlity 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
2004-07-17

PUBLIC COMMENTS -
2004-07-17

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
2002-10-18