On Fri, 31 Mar 2023 01:19:05 GMT, Jaikiran Pai <j...@openjdk.org> wrote:

>> `newInstance("jdk.net.AIXSocketOptions")` will try to invoke the default 
>> constructor  `AIXSocketOptions() {}`. When we make it as private constructor 
>> PlatformSocketOptions instance will try to find jdk.net.AIXSocketOptions and 
>> within the time span it won't be able to find hence throws error (`Cannot 
>> get VM for test: java.net.SocketTimeoutException: Accept timed out`)
>
> Hello Varada, 
> I went back and looked at how this class instance gets instantiated. The code 
> uses reflection to do it:
> 
> 
> private static PlatformSocketOptions newInstance(String cn) {
>   Class<PlatformSocketOptions> c;
>   try {
>       c = (Class<PlatformSocketOptions>)Class.forName(cn);
>       return c.getConstructor(new Class<?>[] { }).newInstance();
> 
> so yes, this expects a `public` constructor and that explains why the 
> existing `LinuxSocketOptions` has a public constructor.
> 
> What you have right now, in this class, looks fine to me then.

Thank you @jaikiran for the review

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13240#discussion_r1154131541

Reply via email to