harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Beliaev (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3917) [drlvm][test]gc.WeakReferenceTest & gc.PhantomReferenceTest in drlvm smoke test expect more than Java API spec requires
Date Fri, 28 Dec 2007 15:06:43 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-3917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12554800
] 

Vladimir Beliaev commented on HARMONY-3917:
-------------------------------------------

This JIRA should be classified as build-test-ci with [buildtest][smoke] prefix.

> [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.


Mime
View raw message