-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
1.1.4
-
x86
-
windows_nt
Name: tb29552 Date: 08/08/97
Sample Program
public class ExceptionDemo {
public static void main(String argv[])
{
int i = 0;
int j = 16;
for ( j = 16; j >= 0; j-- )
{
i *= 2;
try {
i = 16/i;
} catch(Exception e) {
System.out.println("This doesn't Work!"); // line 12
}
}
}
}
The Problem
If you set a break point at line 12 and stop at that location in the debugger,
you can't examine the Exception e.
Diagnosis
This is because the compiler doesn't generate a local variable table entry
for the exception object. Note that if the exception object is ever referenced
within the catch block, than the compiler does produce the variable table
entry - and the debugger can read it.
Here is a javap dump of the variable table information for this application:
D:\javabugs>javap -l ExceptionDemo
Compiled from ExceptionDemo.java
public synchronized class ExceptionDemo extends java.lang.Object
/* ACC_SUPER bit set */
{
public static void main(java.lang.String[]);
public ExceptionDemo();
}
Line numbers for method void main(java.lang.String[])
line 4: 0
line 5: 2
line 6: 5
line 8: 11
line 9: 15
line 10: 15
line 9: 20
line 11: 23
line 12: 24
line 9: 32
line 6: 35
line 2: 42
Local variables for method void main(java.lang.String[])
java.lang.String[] argv pc=0, length=43, slot=0
int j pc=5, length=38, slot=2
int i pc=2, length=41, slot=1
Line numbers for method ExceptionDemo()
line 1: 0
Local variables for method ExceptionDemo()
ExceptionDemo this pc=0, length=5, slot=0
======================================================================
- relates to
-
JDK-4056542 Compiler generates invalid local variable entries
-
- Closed
-