From dev-return-37854-apmail-harmony-dev-archive=harmony.apache.org@harmony.apache.org Thu Aug 06 07:22:57 2009 Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 30465 invoked from network); 6 Aug 2009 07:22:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Aug 2009 07:22:57 -0000 Received: (qmail 95126 invoked by uid 500); 6 Aug 2009 07:23:04 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 95050 invoked by uid 500); 6 Aug 2009 07:23:03 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 95039 invoked by uid 99); 6 Aug 2009 07:23:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Aug 2009 07:23:03 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mohanraj.l@gmail.com designates 209.85.219.212 as permitted sender) Received: from [209.85.219.212] (HELO mail-ew0-f212.google.com) (209.85.219.212) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Aug 2009 07:22:55 +0000 Received: by ewy8 with SMTP id 8so144497ewy.36 for ; Thu, 06 Aug 2009 00:22:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=I1gIxi5/7stqfxvOoTE/vRXYfDMD7z2VNIQAswktz4g=; b=KZFat+BM5ZoxrKjAuRwNjt7On1DWCN9UvkPFzfEVSnvRSoQGZ6W/5h3tie3ERCQ3pO sJcKYOis0OXubUy+JKGDnuMqNf5BZ/ngcvH+Y4zjpJ3SAH2w6Ur+qhfopPDOjQhsBV6S vyZY9/+8AKftxCyQbOahc3n3xSQzcFSi0gnGk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=n5AhhKyAhtDV7zZz1ycj8H2Z+1VEkU3/9gjUupKKzUUAhhXLdkE2a1pLc45Gt6DmWj WFz1Vm4DIDYpbduc03XS9/tABCLbI/9HuC/EKHFDMTzsYTMYP+ZMpo2Jho3AeSmxKBhL z2G42EFlZieJ02gOO+X/xeCmuMsD7Cw3bxhkg= MIME-Version: 1.0 Received: by 10.210.10.11 with SMTP id 11mr9363856ebj.5.1249543354457; Thu, 06 Aug 2009 00:22:34 -0700 (PDT) In-Reply-To: References: <6bb42ff70908050245j18e3af85x66569e1cd04a8253@mail.gmail.com> Date: Thu, 6 Aug 2009 12:52:34 +0530 Message-ID: <6bb42ff70908060022g7f5bab04me1eb432919024888@mail.gmail.com> Subject: Re: HDK ClassLoader behavior differs from RI From: Mohanraj Loganathan To: dev@harmony.apache.org Content-Type: multipart/alternative; boundary=0015174be078c62120047073fb05 X-Virus-Checked: Checked by ClamAV on apache.org --0015174be078c62120047073fb05 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Thanks Alexy and Pavel. I created a jira for the same --> https://issues.apache.org/jira/browse/HARMONY-6297 Thanks and Regards, Mohan On Thu, Aug 6, 2009 at 10:05 AM, Alexey Varlamov < alexey.v.varlamov@gmail.com> wrote: > 2009/8/5 Pavel Pervov : > > 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. > > Looking at the stack trace, it is indeed: > java.lang.NoClassDefFoundError: junit/framework/TestCase > [...] > at java.lang.ClassLoader.loadClass(ClassLoader.java:319) > at java.lang.VMClassRegistry.getEnclosingClass(VMClassRegistry.java) > at java.lang.Class.getEnclosingClass(Class.java:1065) > at > java.lang.reflect.ReflectExporter.hasSameTopLevelClass(ReflectExporter.java:176) > at > java.lang.reflect.ReflectExporter.allowAccess(ReflectExporter.java:103) > at > java.lang.reflect.ReflectExporter.checkMemberAccess(ReflectExporter.java:86) > at java.lang.reflect.Method.invoke(Method.java:311) > at ClassLoadTest.callMain(ClassLoadTest.java:9) > at ClassLoadTest.main(ClassLoadTest.java:13) > > It should be possible to add a workaround here, please file this issue to > JIRA. > > -- > Regards, > Alexey > > > > > 2009/8/5, Mohanraj Loganathan : > >> 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 > >> > > > -- Mohan --0015174be078c62120047073fb05--