Review request: TEST_BUG: test/java/lang/ClassLoader/defineClass/DefineClassByteBuffer.java fails

Alan Bateman Alan.Bateman at oracle.com
Wed Jun 16 14:19:52 UTC 2010


Mandy Chung wrote:
> 6961502: TEST_BUG: 
> test/java/lang/ClassLoader/defineClass/DefineClassByteBuffer.java fails
>
> Webrev at:
>   http://cr.openjdk.java.net/~mchung/6961502/webrev.00/
>
> This test intends to test various cases of passing 
> java.nio.ByteBuffers to defineClass().  However, it never tests what 
> it is intended for.   In othervm mode, the system class loader, the 
> parent of DummyClassLoader, successfully finds TestClass and defines 
> it before it gets to the DummyClassLoader to do the job.
>
> This test fails in samevm mode since jtreg URLClassLoader to load 
> classes for the test.classes directory is not in the 
> DummyClassLoader's delegation hierarchy.
>
> Thanks
> Mandy
Good catch! The changes looks okay to me but I have a few comments:

1. Would it be better to set "defined" when called with a class name of 
"TestClass"?
2. It might be nicer to have an accessor method for defined [eg: if 
(cld[i].defineCalled() ].
3. It might be nicer to use flip to flip the buffer.
4. While you are there, it might be good to eliminate the raw types 
(change Class to Class<?> etc.)

-Alan.



More information about the core-libs-dev mailing list