Search code examples
javadefaultaccess-specifier

Is it possible to configure default access spec (package private) to public?


Is there a compiler flag that can make that happen, or is that default "cemented" in the language?


Solution

  • No, there is no standard compiler flag to change that aspect of the language. The only way that I know of to circumvent access limitations is via reflection (and setAccessible method), and that depends on the SecurityManager allowing access.