harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Varlamov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3632) [drlvm][kernel] Drlvm does not allow to call public constructor of 'private static' inner class from within another class
Date Thu, 12 Apr 2007 12:31:32 GMT

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

Alexey Varlamov commented on HARMONY-3632:
------------------------------------------

Reading the Java Language Specification v3, para 6.6.1: 
"if the member or constructor is declared private, then access is
permitted if and only if it occurs within the body of the top level class (ยง7.6)
that encloses the declaration of the member or constructor."

Which means the DRLVM behaves correctly and other VMs/JREs are not.
J9 is on the same side with RI, btw.

Another prove is, try adding smth like "new A.B();" into Hello.main() and compile. javac aborts
compilation saying:
Hello.java:9: A.B has private access in A
        System.out.println(new A.B());
                                ^

I suggest to file a bug against Joda.

> [drlvm][kernel] Drlvm does not allow to call public constructor of 'private static' inner
class from within another class
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3632
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3632
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Mikhail Fursov
>
> Here is the test that passes with SUN or BEA but fails with DRLVM
> import java.lang.reflect.*;
> public class Hello {
>     public static void main(String[] args) throws Exception {
>         Class cls = A.class.getDeclaredClasses()[0];
>         Constructor con = cls.getDeclaredConstructors()[0];
>         Object[] params = new Object[0];
>         con.newInstance(params);
>     }
> }
> class A {
>     private static class B {
>         B() {
>             System.out.println("PASSED");
>         }
>     }
> }
> This test prevents joda-time (see http://joda-time.sourceforge.net, JSR310)  tests to
be passed on DLRVM

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