JavaDoc for java.io.FileDescriptor.FileDescriptor() says:
Constructs an (invalid) FileDescriptor object.
If there is no purpose for the constructor, why is it’s access level not declared to be package-private?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This constructor is public because it is used outside of
java.io.Classes using
new FileDescriptor()in JRE 7u4 Linux x86:There is a
sun.misc.SharedSecretsmethod that allows the programmer to change the state of aFileDescriptorto a valid one (this snippet found injava.io.FileDescriptor):This means that any code that can access
SharedSecrets(I.E. the JRE itself) can also create its own validFileDescriptor, and should therefore be allowed to accessFileDescriptor(). However, there is no way to restrict the access of a constructor to only JRE classes, so it is public.