harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavel Pervov <pmcfi...@gmail.com>
Subject Re: HDK ClassLoader behavior differs from RI
Date Wed, 05 Aug 2009 12:21:37 GMT
Ah. I've misread your original post.
Harmony VM attempts to load outer class on some stage of processing
inner class. This is not neccessary classloading issue. It may be
reflection itself.

2009/8/5, Mohanraj Loganathan <mohanraj.l@gmail.com>:
> I am getting the different output with HDK and RI with the following
> scenario
>
> Step1: Compile TestInnerClass.java [1]  by including junit.jar in the
> classpath.
> Step2: Through reflection call the innerclass
> TestInnerClass$ExceptingEntryPoint  main method (refer [2]) without
> including the junit.jar in the classpath
>
> HDK: throws NoClassDefFoundError: junit/framework/TestCase
> RI:  prints "I am printing from TestInnerClass$ExceptingEntryPoint"
>
> Any thougts on this.
>
> P.S: One of the ANT unit-testcase implements this scenario due to which 4
> tests are failing.
>
> [1] TestInnerClass .java
>
> import junit.framework.TestCase;
> public class TestInnerClass extends TestCase{
>     public static class ExceptingEntryPoint {
>         public static void main(String[] argv) {
>             System.out.println("I am printing from
> TestInnerClass$ExceptingEntryPoint");
>         }
>     }
> }
>
>
> [2] Testcase: ClassLoadTest.java
>
> import java.lang.reflect.Method;
> public class ClassLoadTest {
>     public void callMain() throws Exception{
>         String classname = "TestInnerClass$ExceptingEntryPoint";
>         Class target = Class.forName(classname, true,
> this.getClass().getClassLoader());
>         Method main = target.getMethod("main", new Class[]
> {String[].class});
>         main.invoke(null, (Object[])new String[] {null});
>     }
>
>     public static void main(String[] args) throws Exception{
>         new ClassLoadTest().callMain();
>     }
> }
>
> Thanks and Regards,
> Mohan
>

Mime
View raw message