Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 22787 invoked from network); 10 Nov 2006 15:43:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Nov 2006 15:43:02 -0000 Received: (qmail 9590 invoked by uid 500); 10 Nov 2006 15:43:13 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 9554 invoked by uid 500); 10 Nov 2006 15:43:13 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 9543 invoked by uid 99); 10 Nov 2006 15:43:13 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Nov 2006 07:43:13 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= 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; Fri, 10 Nov 2006 07:43:02 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 009B27142FC for ; Fri, 10 Nov 2006 07:42:42 -0800 (PST) Message-ID: <26275877.1163173361997.JavaMail.jira@brutus> Date: Fri, 10 Nov 2006 07:42:41 -0800 (PST) From: "Alexei Zakharov (JIRA)" To: harmony-commits@incubator.apache.org Subject: [jira] Assigned: (HARMONY-1309) [luni][tests] incorrect test for reflection access control In-Reply-To: <7046673.1156846110703.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 [ http://issues.apache.org/jira/browse/HARMONY-1309?page=all ] Alexei Zakharov reassigned HARMONY-1309: ---------------------------------------- Assignee: Alexei Zakharov > [luni][tests] incorrect test for reflection access control > ---------------------------------------------------------- > > Key: HARMONY-1309 > URL: http://issues.apache.org/jira/browse/HARMONY-1309 > Project: Harmony > Issue Type: Bug > Components: Classlib > Reporter: Alexey Varlamov > Assigned To: Alexei Zakharov > Priority: Minor > Attachments: test-refl-acc.patch, test-refl-acc.patch > > > There is a test[1] in classlib, which verifies that reflection access > from enclosing class to a private member of a nested class results in > IllegalAccessException. > However, this is against the language specification (para 6.6.1 of the JLS3): > "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." > Moreover, the following test reveals inconsistency between standard > access control and reflective one: > --------------------------------- > class NestedAccessTest { > static class A { > private static int x = 123; > } > public static void main(String... s) throws Throwable{ > System.out.println(A.x); > System.out.println(A.class.getDeclaredField("x").get(null)); > } > } > -------------------------------- > >java -showversion NestedAccessTest > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode) > 123 > Exception in thread "main" java.lang.IllegalAccessException: Class > NestedAccessTest can not access a member of class NestedAccessTest$A > with modifiers "private static" > at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65) > at java.lang.reflect.Field.doSecurityCheck(Field.java:954) > at java.lang.reflect.Field.getFieldAccessor(Field.java:895) > at java.lang.reflect.Field.get(Field.java:357) > at NestedAccessTest.main(NestedAccessTest.java:7) > ---------------------------------- > Besides, this is an acknowledged bug of RI [2], and is ranked TOP#6. > [1] name="test_getLjava_lang_Object"/> > [2] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4071957 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira