harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r601300 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H5257/ src/test/regression/H5257/pkg/ vm/jitrino/src/jet/ vm/vmcore/include/ vm/vmcore/src/class_support/
Date Wed, 05 Dec 2007 11:34:08 GMT
Author: varlax
Date: Wed Dec  5 03:33:55 2007
New Revision: 601300

URL: http://svn.apache.org/viewvc?rev=601300&view=rev
Log:
Fixed HARMONY-5257 [drlvm][class_support] wrong IllegalAccessError for array of protected
inner classes
+ fixed wrong assertion in JET code

Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H5257/
    harmony/enhanced/drlvm/trunk/src/test/regression/H5257/ProtectedInnerAccessTest.java 
 (with props)
    harmony/enhanced/drlvm/trunk/src/test/regression/H5257/pkg/
    harmony/enhanced/drlvm/trunk/src/test/regression/H5257/pkg/Holder.java   (with props)
Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_obj.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H5257/ProtectedInnerAccessTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H5257/ProtectedInnerAccessTest.java?rev=601300&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H5257/ProtectedInnerAccessTest.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H5257/ProtectedInnerAccessTest.java Wed
Dec  5 03:33:55 2007
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.drlvm.tests.regression.h5257;
+
+import junit.framework.TestCase;
+import org.apache.harmony.drlvm.tests.regression.h5257.pkg.Holder;
+
+public class ProtectedInnerAccessTest extends TestCase {
+
+    public void test1() {
+        assertNotNull(Accessor.getObj());
+    }
+    public void test2() {
+        assertNotNull(Accessor.getArray());
+    }
+    public void test3() {
+        assertNotNull(Accessor.castArray(Accessor.getArray()));
+    }
+
+    static class Accessor extends Holder {
+    static Object getObj() {
+        return new I();
+    }
+
+    static Object[] getArray() {
+        return new I[0];
+    }
+
+    static Object castArray(Object arr) {
+        return (I[])arr;
+    }
+}
+}
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H5257/ProtectedInnerAccessTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H5257/pkg/Holder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H5257/pkg/Holder.java?rev=601300&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H5257/pkg/Holder.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H5257/pkg/Holder.java Wed Dec  5 03:33:55
2007
@@ -0,0 +1,26 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.drlvm.tests.regression.h5257.pkg;
+
+public class Holder {
+
+    protected static class I {
+        public I(){}
+    }
+}
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H5257/pkg/Holder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_obj.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_obj.cpp?rev=601300&r1=601299&r2=601300&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_obj.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_obj.cpp Wed Dec  5 03:33:55 2007
@@ -190,7 +190,7 @@
     if (resolve) {
         Class_Handle klass = resolve_class(m_compileHandle, enclClass, cpIdx);
         if (klass == NULL) {
-            assert(!lazy);
+            // resolution has failed
             gen_call_throw(ci_helper_linkerr, rt_helper_throw_linking_exc, 0, enclClass,
cpIdx, opcode);
         }
         static const CallSig cs(CCONV_HELPERS, jobj, jobj);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h?rev=601300&r1=601299&r2=601300&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h Wed Dec  5 03:33:55 2007
@@ -1239,6 +1239,15 @@
         return m_num_dimensions;
     }
 
+    /** 
+     * Gets the base class of the array (for non-primitive arrays only).
+     * @return Class describing the base type of an array
+     * represented by this class.*/
+    Class* get_array_base_class() const {
+        assert(is_array());
+        return m_array_base_class;
+    }
+
     /** Gets the class of the array element.
      * @return Class describing the element of an array
      * represented by this class.*/

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp?rev=601300&r1=601299&r2=601300&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp Wed Dec  5 03:33:55
2007
@@ -343,6 +343,12 @@
         // in the same runtime package. 
         if(m_package == inner_clss->m_package)
             return true;
+
+        // array type has the same access as base type
+        if (inner_clss->is_array()) {
+            inner_clss = inner_clss->get_array_base_class();
+        }
+        
         // Otherwise, when other_clss is not in the same package, 
         // inner_clss must be a superclass of other_clss.
         for(Class *decl_other_clss = this; decl_other_clss != NULL;)



Mime
View raw message