Outside classes accessing package-private methods
Posted
by Jake
on Stack Overflow
See other posts from Stack Overflow
or by Jake
Published on 2010-05-21T06:25:28Z
Indexed on
2010/05/21
10:30 UTC
Read the original article
Hit count: 518
Suppose I have a class in my package org.jake
and it has a method with default access (no modifier). Then the method is visible inside the package only.
However, when someone receives the jar of my framework, what is to stop them from writing a new class, declaring its package as org.jake
, and using my supposedly invisible method?
In other words, is there anything I can do to prevent them from doing that?
© Stack Overflow or respective owner