-
Bug
-
Resolution: Won't Fix
-
P5
-
None
-
1.1, 1.2.0
-
x86, sparc
-
solaris_2.5, windows_nt
Name: mc57594 Date: 02/12/97
The following program produces different results depending
on what exit code is passed in:
public
class tt {
static foo Foo = null;
static public void main(String argv[]) {
System.runFinalizersOnExit(true);
new foo(1);
Foo = new foo(2);
System.exit(Integer.parseInt(argv[0]));
}
}
class foo {
int ii;
foo(int i) {
ii = i;
System.out.println("foo(" + i + ") called");
}
protected void finalize() {
System.out.println("finalize called on " + ii);
}
}
D:\temp>java tt 0
foo(1) called
foo(2) called
finalize called on 1
finalize called on 2
D:\temp>java tt 1
foo(1) called
foo(2) called
If this is intentional, then it should be documented. It would
be nice if the finalization code was run, no matter what the
exit value is.
company - Object Design, Inc. , email - ###@###.###
======================================================================
- duplicates
-
JDK-4064029 object finalizer is not invoked when System.exit() is called
- Closed
- relates to
-
JDK-4422506 JDI: System.runFinalizersOnExit(true): Unable to hit breakpoint in finalize()
- Closed