Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8018897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:14:16+00:00 2026-06-04T21:14:16+00:00

I came across this class java.io.FileSystem and noticed it has many methods that I

  • 0

I came across this class java.io.FileSystem and noticed it has many methods that I currently need in my project. However the class is package-private, and so I am accessing the needed methods using reflection.

Questions:

  1. Is there any particular reason why this class is marked package private?
  2. Are there any dangers of accessing it via reflection? (Other than performance hit, that is.)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:14:18+00:00Added an answer on June 4, 2026 at 9:14 pm
    1. This class is package private because SUN (and by extension, Oracle) believe that the methods of this platform-dependent class are likely to undergo significant change in the future, and therefore must not be accessible directly. All implementations of this abstract class are in native code; Java programmers should not be able to create their own.

    2. The biggest danger of using a hidden class through reflection is not the performance, but a very real possibility that its methods or even the entire class would disappear in the next upgrade of the JDK, no matter how minor. Non-public APIs are, well, non-public; changing them is fair game even in a maintenance release, so you have only yourself to blame if your program stops working after what seemed like a routine JDK update.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was doing a project in a Java book and came across this code
I came across this recommendation for reading the C++ report magazine. However, when I
I was going through some random java code and came across this peice of
While reading some Java source, I came across this line: ((Closeable) some_obj).close(); some_obj is
I came across this questions on one of the online Java Tests. The options
I came across a few articles like this one , which suggest that some
I'm learning OO stuff, and came across this: class n{ private function f($v){ return
I was doing a Junit tutorial and I came across this normalize function that
I came across a term 'primordial' objects.After searching I got that a primordial class
I came across a situation that I had in another project that I'm not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.