Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 49325 invoked from network); 24 May 2007 05:23:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 May 2007 05:23:37 -0000 Received: (qmail 15486 invoked by uid 500); 24 May 2007 05:23:42 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 15462 invoked by uid 500); 24 May 2007 05:23:42 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 15453 invoked by uid 99); 24 May 2007 05:23:42 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 May 2007 22:23:42 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 May 2007 22:23:36 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 4F3EF71403F for ; Wed, 23 May 2007 22:23:16 -0700 (PDT) Message-ID: <31506718.1179984196322.JavaMail.jira@brutus> Date: Wed, 23 May 2007 22:23:16 -0700 (PDT) From: "Xiao-Feng Li (JIRA)" To: commits@harmony.apache.org Subject: [jira] Commented: (HARMONY-3917) [drlvm][test]gc.WeakReferenceTest & gc.PhantomReferenceTest in drlvm smoke test expect more than Java API spec requires In-Reply-To: <9163492.1179729796353.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-3917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12498484 ] Xiao-Feng Li commented on HARMONY-3917: --------------------------------------- Vladimir, your patch ex.update.patch is committed. Thanks. > [drlvm][test]gc.WeakReferenceTest & gc.PhantomReferenceTest in drlvm smoke test expect more than Java API spec requires > ----------------------------------------------------------------------------------------------------------------------- > > Key: HARMONY-3917 > URL: https://issues.apache.org/jira/browse/HARMONY-3917 > Project: Harmony > Issue Type: Bug > Components: DRLVM > Environment: Win/Linux 32/64 > Reporter: Li-Gang Wang > Attachments: 01_weakref.patch, ex.update.patch > > > The two test cases metioned in title have the following code segment: > public static void main(String[] args) throws Exception { > ReferenceQueue queue = new ReferenceQueue(); > Object referent = new WeakReferenceTest(); > Reference ref = new WeakReference(referent, queue); > if (ref.get() != referent) { > System.out.println("FAIL: can't get weak referent"); > return; > } > // drop strong reference > referent = null; > System.gc(); > > // run finalization to be sure that the reference is enqueued > System.runFinalization(); > > Reference enqueued; > enqueued = queue.poll(); > if (enqueued == null) { > System.out.println("FAIL: reference was not enqueued"); > return; > } > if (ref.get() != null) { > System.out.println("FAIL: reference was not cleared."); > return; > } > if (enqueued.get() != null) { > System.out.println("FAIL: reference was not cleared."); > return; > } > System.out.println("PASS"); > } > They assume the weak reference has been enqueued after System.gc() and System.runFinalization() are called. In fact in spec the first API does not guarantee that every unused object in heap is recycled, and the second API does not guarantee every weak reference is enqueued if its referent becomes weakly reachable. This issue has been discussed in Harmony mailing list. Its title is > [classlib][testcase] should weakreference be queued in runFinalization()? [http://mail-archives.apache.org/mod_mbox/harmony-dev/200704.mbox/%3c9623c9a50704121937w56c8f045t35fba03ac80f2d59@mail.gmail.com%3e] > Because of their wrong assumption, they may fail intermittently. I suggest them to be rewritten according to the spec. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.