Skip to main content

More restrict access to methods or fields

No replies
xmachac2
Offline
Joined: 2003-09-23

I'm not from English spoken country so excuse my English language.

For designing libraries or frameworks I would like to have more restrict access to methods or fields then public, protected or public. I feature for public modifier of method array with classes (and their subclasses) which can invoke this method.

E.g.

public [MyClass1, MyClass2] void changeState() {
}

or

public grant MyClass1, MyClass2 void changeState() {
}

If modifier is missing then method has unlimited access like without this feature.
I don't know how much it would be binary incompatible to implement this to new JVM. But it would precede many mistakes in using complex APIs (because compatibility is for old APIs too late, perhaps in J3SE).