harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r538169 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H1748/ src/test/regression/H1748/BadIntfImpl.j src/test/regression/H1748/IntfAccessTest.java src/test/regression/H1748/run.test.xml vm/vmcore/src/class_support/C_Interface.cpp
Date Tue, 15 May 2007 13:09:11 GMT
Author: varlax
Date: Tue May 15 06:09:10 2007
New Revision: 538169

URL: http://svn.apache.org/viewvc?view=rev&rev=538169
Log:
Applied HARMONY-1748 [drlvm][jit] IllegalAccessError is not thrown when running test on Jitrino.OPT
Added reg test

Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H1748/
    harmony/enhanced/drlvm/trunk/src/test/regression/H1748/BadIntfImpl.j
    harmony/enhanced/drlvm/trunk/src/test/regression/H1748/IntfAccessTest.java
    harmony/enhanced/drlvm/trunk/src/test/regression/H1748/run.test.xml
Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H1748/BadIntfImpl.j
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H1748/BadIntfImpl.j?view=auto&rev=538169
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H1748/BadIntfImpl.j (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H1748/BadIntfImpl.j Tue May 15 06:09:10
2007
@@ -0,0 +1,15 @@
+.class public org/apache/harmony/drlvm/tests/regression/h1748/BadIntfImpl
+.super java/lang/Object
+.implements org/apache/harmony/drlvm/tests/regression/h1748/Intf
+
+;
+; standard initializer
+.method public <init>()V
+   aload_0
+   invokespecial java/lang/Object/<init>()V
+   return
+.end method
+
+.method protected test()V ; implement interface method as protected
+  return
+.end method

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H1748/IntfAccessTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H1748/IntfAccessTest.java?view=auto&rev=538169
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H1748/IntfAccessTest.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H1748/IntfAccessTest.java Tue May 15
06:09:10 2007
@@ -0,0 +1,23 @@
+package org.apache.harmony.drlvm.tests.regression.h1748;
+
+import junit.framework.TestCase;
+
+public class IntfAccessTest extends TestCase{
+
+    public void test() {
+		try {
+		 	Intf i = new BadIntfImpl();
+			i.test();
+			fail("Test failed, IllegalAccessError is not thrown");
+		} catch (IllegalAccessError ok) {
+		 	System.out.println("Test passed");
+			ok.printStackTrace();
+		}
+    }
+}
+
+
+interface Intf {
+
+	void test();
+}

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H1748/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H1748/run.test.xml?view=auto&rev=538169
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H1748/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H1748/run.test.xml Tue May 15 06:09:10
2007
@@ -0,0 +1,9 @@
+<project name="RUN HARMONY-1748 Regression Test">
+    <target name="run-test">
+        <run-junit-test 
+             test="org.apache.harmony.drlvm.tests.regression.h1748.IntfAccessTest"
+             vmarg="-Xem:opt">
+        </run-junit-test>
+    </target>
+</project>
+

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp?view=diff&rev=538169&r1=538168&r2=538169
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp Tue May 15 06:09:10
2007
@@ -2262,6 +2262,11 @@
     for(; ch;  ch = ch->get_super_class()) {
         m = ch->lookup_method(name, desc);
         if (m != NULL) {
+            // IllegalAccessError will be thrown if implementation of
+            // interface method is not public
+            if (method->get_class()->is_interface() && !m->is_public())
{
+                return NULL;
+            }
             // The method m can only override mh/method
             // if m's class can access mh/method (JLS 6.6.5).
             if(m->get_class()->can_access_member(method)) {



Mime
View raw message