RFR(S): 8248910: NPE when freeing the memory for a slice from a buffer
Yangfei (Felix)
felix.yang at huawei.com
Tue Aug 18 12:05:50 UTC 2020
Hi,
> -----Original Message-----
> From: Alan Bateman [mailto:Alan.Bateman at oracle.com]
> Sent: Tuesday, August 18, 2020 7:14 PM
> To: Yangfei (Felix) <felix.yang at huawei.com>; nio-dev at openjdk.java.net
> Subject: Re: RFR(S): 8248910: NPE when freeing the memory for a slice from
> a buffer
>
> On 18/08/2020 09:13, Yangfei (Felix) wrote:
> > :
> > We spend some time looking into how Randoop works.
> > Overall, this tool checks for public method in the specified class file and
> composes test cases from these methods.
> > It calls the java compiler to compile the test cases and run them. One of
> the auto-generated test case looks like:
> >
> > import org.junit.FixMethodOrder;
> > import org.junit.Test;
> > import org.junit.runners.MethodSorters;
> >
> > @FixMethodOrder(MethodSorters.NAME_ASCENDING)
> > public class RandoopTemporarySeqTest285 {
> >
> > public static boolean debug = false;
> >
> > @Test
> > public void theSequence285() throws Throwable {
> > if (debug)
> > System.out.format("%n%s%n",
> "RandoopTemporarySeqTest285.theSequence285");
> > java.nio.ByteBuffer byteBuffer2 =
> sun.nio.ch.Util.getTemporaryAlignedDirectBuffer((int) (short) 100, (int) ' ');
> > sun.nio.ch.Util.releaseTemporaryDirectBuffer(byteBuffer2);
> > org.junit.Assert.assertNotNull(byteBuffer2);
> > }
> > }
> >
> > So it looks to me like it is using the internal buffer cache directly.
> >
> Are you going to submit a bug to Randoop on this? It's way too fragile to have
> tools generating code that depend on JDK internal APIs. Also this will stop
> working once the java.base is full encapsulated and/or the class changes.
I think it's not a matter of this tool. It's because we feed an inappropriate class to it.
Like: $java -cp randoop-all-4.2.4.jar randoop.main.Main gentests --testclass sun.nio.ch.Util
If JDK internal APIs are not intended for random usage like that, I am OK to close this issue.
Thanks,
Felix
More information about the nio-dev
mailing list