Review request: TEST_BUG: test/java/lang/ClassLoader/defineClass/DefineClassByteBuffer.java fails
mandy.chung at oracle.com
Wed Jun 16 09:36:37 PDT 2010
Alan Bateman wrote:
> Mandy Chung wrote:
>> 6961502: TEST_BUG:
>> test/java/lang/ClassLoader/defineClass/DefineClassByteBuffer.java fails
>> Webrev at:
>> 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.
> 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"?
I removed the "defined" variable and instead check if its class loader
matches what is expected. I also found that the TestClass is loaded by
the system class loader in othervm mode and I fixed that as well.
> 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.)
I cleaned up the test and the revised webrev is at:
More information about the core-libs-dev