You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mikhail Fursov (JIRA)" <ji...@apache.org> on 2007/04/12 10:37:32 UTC

[jira] Created: (HARMONY-3632) [drlvm][kernel] Drlvm does not allow to call public constructor of 'private static' inner class from within another class

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


[jira] Resolved: (HARMONY-3632) [drlvm][kernel] Drlvm does not allow to call public constructor of 'private static' inner class from within another class

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3632?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Varlamov resolved HARMONY-3632.
--------------------------------------

    Resolution: Won't Fix
      Assignee: Alexey Varlamov

Ok, we can resolve this issue WONTFIX.
As a side note, a comment in JODA-time sources looks elusive, it should be "to honor the JLS" instead of 
"for Apache Harmony JVM" - but that is on their conscience ;)

> [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: App-Oriented Bug Reports, DRLVM, Non-bug differences from RI
>            Reporter: Mikhail Fursov
>         Assigned To: Alexey Varlamov
>
> 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.


[jira] Reopened: (HARMONY-3632) [drlvm][kernel] Drlvm does not allow to call public constructor of 'private static' inner class from within another class

Posted by "Mikhail Fursov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3632?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mikhail Fursov reopened HARMONY-3632:
-------------------------------------


I tried to run ArgoUML (v0.24) today and go this error:

W:\projects\argouml>argouml.bat
[org.netbeans.mdr.Logger] INFORMATIONAL *********** Exception occurred ************ at Mon Apr 16 20:00:33 NOVST 2007
java.lang.IllegalAccessError: from org/netbeans/mdr/handlers/gen/PackageGenerator to [Lorg/netbeans/lib/jmi/util/ClassFileGener
ator$MethodInfo;
        at org.netbeans.lib.jmi.util.ClassFileGenerator.generateClassFile(ClassFileGenerator.java:162)
        at org.netbeans.mdr.handlers.gen.HandlerGenerator.generateHandler(HandlerGenerator.java:90)
        at org.netbeans.mdr.handlers.BaseObjectHandler.getHandlerClass(BaseObjectHandler.java:108)
        at org.netbeans.mdr.NBMDRepositoryImpl.getHandler(NBMDRepositoryImpl.java:631)
        at org.netbeans.mdr.NBMDRepositoryImpl.getHandler(NBMDRepositoryImpl.java:613)
        at org.netbeans.mdr.NBMDRepositoryImpl.getExtent(NBMDRepositoryImpl.java:314)
        at org.netbeans.mdr.NBMDRepositoryImpl.installFakeMof(NBMDRepositoryImpl.java:1332)
        at org.netbeans.mdr.NBMDRepositoryImpl.boot(NBMDRepositoryImpl.java:1315)
        at org.netbeans.mdr.NBMDRepositoryImpl.initCheck(NBMDRepositoryImpl.java:749)
        at org.netbeans.mdr.NBMDRepositoryImpl.getExtent(NBMDRepositoryImpl.java:298)
        at org.argouml.model.mdr.MDRModelImplementation.<init>(MDRModelImplementation.java:254)
        at java.lang.reflect.VMReflection.newClassInstance(VMReflection.java)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:298)
        at java.lang.Class.newInstance(Class.java:719)
        at org.argouml.model.Model.<clinit>(Model.java:124)
        at org.argouml.application.Main.main(Main.java:250)
Uncaught exception in main:
java.lang.ExceptionInInitializerError
        at org.argouml.application.Main.main(Main.java:250)
Caused by: org.netbeans.mdr.util.DebugException: Missing storage files or different storage version.
        at org.netbeans.mdr.storagemodel.MdrStorage.initializeIndexes(MdrStorage.java:507)
        at org.netbeans.mdr.storagemodel.MdrStorage.rollback(MdrStorage.java:554)
        at org.netbeans.mdr.util.TransactionMutex.end(TransactionMutex.java:73)
        at org.netbeans.mdr.util.MultipleReadersMutex.leave(MultipleReadersMutex.java:173)
        at org.netbeans.mdr.NBMDRepositoryImpl.endTrans(NBMDRepositoryImpl.java:248)
        at org.netbeans.mdr.NBMDRepositoryImpl.boot(NBMDRepositoryImpl.java:1322)
        at org.netbeans.mdr.NBMDRepositoryImpl.initCheck(NBMDRepositoryImpl.java:749)
        at org.netbeans.mdr.NBMDRepositoryImpl.getExtent(NBMDRepositoryImpl.java:298)
        at org.argouml.model.mdr.MDRModelImplementation.<init>(MDRModelImplementation.java:254)
        at java.lang.reflect.VMReflection.newClassInstance(VMReflection.java)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:298)
        at java.lang.Class.newInstance(Class.java:719)
        at org.argouml.model.Model.<clinit>(Model.java:124)
        ... 1 more


The Lorg/netbeans/lib/jmi/util/ClassFileGenerator$MethodInfo; class has 'protected' access modifier and is not static!
I can't create minimized testcase for this issue because SUN's javac refuses to compile such sources.

Both SUN and BEA runs this test OK.
I propose reconsidering default DRLVM behaviour to be compatible with BEA and SUN in this feature.


> [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: App-Oriented Bug Reports, DRLVM, Non-bug differences from RI
>            Reporter: Mikhail Fursov
>         Assigned To: Alexey Varlamov
>
> 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.


[jira] Commented: (HARMONY-3632) [drlvm][kernel] Drlvm does not allow to call public constructor of 'private static' inner class from within another class

Posted by "Pavel Pervov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-3632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12548649 ] 

Pavel Pervov commented on HARMONY-3632:
---------------------------------------

1) By J2SE specification Class is not reflection "member" (see here http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/Member.html) in terms of inheritance. So, accessing private inner class through _reflection_ may be treated as a valid operation.
2) Class's constructor is declared public. So, no problems with the JLS.
3) Javac gives the error because of that JLS citation.

So, here we have a kind of ambiguity in reading the spec (or contradicting specs).

> [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: App-Oriented Bug Reports, DRLVM, Non-bug differences from RI
>            Reporter: Mikhail Fursov
>            Assignee: Alexey Varlamov
>
> 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.


[jira] Commented: (HARMONY-3632) [drlvm][kernel] Drlvm does not allow to call public constructor of 'private static' inner class from within another class

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (HARMONY-3632) [drlvm][kernel] Drlvm does not allow to call public constructor of 'private static' inner class from within another class

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-3632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12548673 ] 

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

1) There is no inheritance issue, as we're considering access within a package to a private nested class. Anyway specs for the reflection accessor methods such as Class.newInstance(), Method.invoke() etc always operate with accessibility in terms of JLS. And I believe reflection should behave consistently with normal access.
2) The quote is incomplete so may be confusing, sorry about that. Here is the missing part (which precedes the first quote):
"A member (class, interface, field, or method) of a reference (class, interface, or array) type or a constructor of a class type is accessible only if the type is accessible and the member or constructor is declared to permit access:" 
3) javac enforces the rule right above, so everything is correct.

So I see no contradiction here.

> [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: App-Oriented Bug Reports, DRLVM, Non-bug differences from RI
>            Reporter: Mikhail Fursov
>            Assignee: Alexey Varlamov
>
> 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.


[jira] Closed: (HARMONY-3632) [drlvm][kernel] Drlvm does not allow to call public constructor of 'private static' inner class from within another class

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3632?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Varlamov closed HARMONY-3632.
------------------------------------

    Resolution: Won't Fix

The last issue is a real bug but in other area, see HARMONY-5257. The original resolution for original issue is WONTFIX.

> [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: App-Oriented Bug Reports, DRLVM, Non-bug differences from RI
>            Reporter: Mikhail Fursov
>            Assignee: Alexey Varlamov
>
> 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.


[jira] Updated: (HARMONY-3632) [drlvm][kernel] Drlvm does not allow to call public constructor of 'private static' inner class from within another class

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3632?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Varlamov updated HARMONY-3632:
-------------------------------------

    Component/s: Non-bug differences from RI
                 App-Oriented Bug Reports

> [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: App-Oriented Bug Reports, DRLVM, Non-bug differences from RI
>            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.


[jira] Commented: (HARMONY-3632) [drlvm][kernel] Drlvm does not allow to call public constructor of 'private static' inner class from within another class

Posted by "Mikhail Fursov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-3632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12488601 ] 

Mikhail Fursov commented on HARMONY-3632:
-----------------------------------------

the issue was reported to joda-time developers:
http://sourceforge.net/tracker/index.php?func=detail&aid=1699760&group_id=97367&atid=617889

> [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: App-Oriented Bug Reports, DRLVM, Non-bug differences from RI
>            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.


[jira] Commented: (HARMONY-3632) [drlvm][kernel] Drlvm does not allow to call public constructor of 'private static' inner class from within another class

Posted by "Mikhail Fursov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-3632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12488925 ] 

Mikhail Fursov commented on HARMONY-3632:
-----------------------------------------

fixed by joda-time developers:
http://joda-time.svn.sourceforge.net/viewvc/joda-time/trunk/JodaTime/src/test/org/joda/time/TestDateTimeFieldType.java?r1=891&r2=1208

> [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: App-Oriented Bug Reports, DRLVM, Non-bug differences from RI
>            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.