harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiao-Feng Li (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-6020) [DRLVM] Cyclical class dependency causes a failure not seen in RI
Date Sun, 04 Jan 2009 06:46:44 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-6020?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660536#action_12660536
] 

Xiao-Feng Li commented on HARMONY-6020:
---------------------------------------

When we look at this class definition:

 class Parent {
    private static final Child[] childCache = new Child[5];

    public static Child createChild(){
        return childCache[0];
    }
 }

It is clear that, the semantics expectation is, childCache should be assigned a value when
class Parent is ready (i.e., initialized). And this value should be assigned to childCache
before anybody can access any Parent's method, e.g., createChild(). This is the semantics
expectation. I guess we need to ensure this semantics.

Can we simply let this Child clinit() execute in this way: When it tries to call Parent.createChild()
and finds Parent is under initialization, it simply returns null to ROOT without really invoking
createChild(). 

According to the JVM spec 2.17.4, it requires any static method invocation must happen after
the class is "initialized." The problem is, how to deal with the situation when a static method
is invoked when the owning class is under initialization. 

Thanks,
xiaofeng


> [DRLVM] Cyclical class dependency causes a failure not seen in RI
> -----------------------------------------------------------------
>
>                 Key: HARMONY-6020
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6020
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>    Affects Versions: 5.0M8
>         Environment: Win Vista 32-bit
>            Reporter: Nathan Beyer
>            Assignee: Chunrong Lai
>         Attachments: cycle-project.zip
>
>
> If two classes have a cyclical dependency, some unexpected results may occur, which are
not seen on RI (Sun 6u10).

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