harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Ivanov (JIRA)" <j...@apache.org>
Subject [jira] Assigned: (HARMONY-4305) [buildtest][vts] Test vm/jvms/classLLI/loading/loading08/loading08.xml is incorrect and should be redesigned or removed
Date Wed, 04 Jul 2007 04:34:04 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-4305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Vladimir Ivanov reassigned HARMONY-4305:
----------------------------------------

    Assignee: Vladimir Ivanov

> [buildtest][vts] Test vm/jvms/classLLI/loading/loading08/loading08.xml is incorrect and
should be redesigned or removed
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4305
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4305
>             Project: Harmony
>          Issue Type: Bug
>          Components: build - test - ci
>            Reporter: Vera Petrashkova
>            Assignee: Vladimir Ivanov
>
> According to the vm/jvms/classLLI/loading/loading08/loading08.xml test description
>     "Ensures that class loading occurs only once"
> it should verify that class actually is loading only once
> This test 
> 1) defines class loading08ClassLoader which extends ClassLoader and uses it to load loadingClassTest
class twice;
> 2) invokes Class.forName(String, boolean , ClassLoader)  twice and then 
> verify that the value of "result" field from loading08ClassLoader equals 1. 
> The value of "result" variable is increased by loadClass(String) method when
> used class name equals to the "etalon" name, then this method calls super.loadClass()
method.
> See source files: 
> ------src/test/vm/jvms/classLLI/loading/loading08/loading08p.j---------
> 	.throws java/lang/Exception
> 	.limit stack 2
> 	.limit locals 3
> . . .
> ;
> ;	check that classLoader.loadClass(String) was invoked only once.
> ;
> 	aload_2
> 	getfield org/apache/harmony/vts/test/vm/jvms/classLLI/loading/loading08/loading08pClassLoader.result
I   <<<<
> 	bipush 1
> 	if_icmpeq lOkCounter
> 	bipush 111
> 	ireturn
> lOkCounter:
> 	bipush 104
> 	ireturn 
> .end method
> .method private callClass(Lorg/apache/harmony/vts/test/vm/jvms/classLLI/loading/loading08/loading08pClassLoader;)Ljava/lang/Integer;
> 	.throws java/lang/IllegalAccessException
> 	.throws java/lang/reflect/InvocationTargetException
> 	.throws java/lang/ClassNotFoundException
> 	.limit stack 3
> 	.limit locals 2
> 	ldc "org.apache.harmony.vts.test.vm.jvms.classLLI.loading.loading08.loading08pClassTest"
> 	iconst_1
> 	aload_1
> 	invokestatic java/lang/Class/forName(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;
<<<<<<
> 	invokevirtual java/lang/Class/getDeclaredMethods()[Ljava/lang/reflect/Method;
> 	iconst_0
> 	aaload
> 	aconst_null
> 	iconst_0
> 	anewarray java/lang/Object
> 	invokevirtual java/lang/reflect/Method/invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
> 	checkcast java/lang/Integer
> 	areturn
> .end method
> ----------------
> -----src/test/vm/jvms/classLLI/loading/loading08/loading08pClassLoader.jj-------
> .method public loadClass(Ljava/lang/String;)Ljava/lang/Class;
> .throws java/lang/ClassNotFoundException
> .limit stack 3
> .limit locals 2
> 	aload_1
> 	ldc "org.apache.harmony.vts.test.vm.jvms.classLLI.loading.loading08.loading08pClassTest"
> 	invokevirtual java/lang/String/equals(Ljava/lang/Object;)Z
> 	ifeq lClassTest
> 	aload_0
> 	dup
> 	getfield org/apache/harmony/vts/test/vm/jvms/classLLI/loading/loading08/loading08pClassLoader/result
I
> 	iconst_1
> 	iadd
> 	putfield org/apache/harmony/vts/test/vm/jvms/classLLI/loading/loading08/loading08pClassLoader/result
I
> lClassTest:
> 	aload_0
> 	aload_1
> 	invokespecial java/lang/ClassLoader/loadClass(Ljava/lang/String;)Ljava/lang/Class;
> 	areturn
> .end method
> --------------------
> This test is based on the wrong assumption that if Class.forName(String, boolean, ClassLoader)
twice for the same 
> class then this method does not use ClassLoader.loadClass(String) in the second case.
> It looks like the RI behavior corresponds with the mentioned assumption.
> But Harmony invokes ClassLoder.loadClass(String) every time when
> Class.forName(String, boolean , ClassLoader) is run.
> So it is not clear how many times the used class was loaded actually.
> Harmony behavior is not comparison with J2SE API specification of Class.forName.
> This specification does not mention such restriction.
> Specification of ClassLoader.loadClass method defines the order of class loading: 
> "
> The default implementation of this method searches for classes in the following
> order: 
> 1. Invoke findLoadedClass(String) to check if the class has already been 
>    loaded. 
> 2. Invoke the loadClass method on the parent class loader. If the parent is 
>    null the class loader built-in to the virtual machine is used, instead. 
> 3. Invoke the findClass(String) method to find the class. 
> "
> This test fails on HARMONY and returns code 111.
> It should be redesigned or removed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message