RFR 8135188: RunFinalizationTest.java Exception java.lang.Error: Test failure: Object was not finalized

Martin Buchholz martinrb at google.com
Fri Oct 9 17:40:38 UTC 2015


If it ever happens that an object with a non-trivial finalizer is optimized
away, that would be a serious JDK bug, so I would remove the constructor
code for MyObject (what are you protecting against?).  See my sample code
in previous msg.

WeakReference<?> ref = new WeakReference<Object>(new Object() {
             protected void finalize() { finalizeDone.countDown(); }});

  43         public MyObject() {
  44             /* Make sure object allocation/deallocation is not
optimized out */
  45             wasInitialized = true;
  46         }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20151009/d2d9fc63/attachment.html>


More information about the serviceability-dev mailing list