Wiki Markup |
---|
Increasing the accessibility of overridden or hidden methods permits a malicious subclass to offer wider access to the restricted method than was originally intended. |
Wiki Markup |
---|
According to the Java Language Specification The access modifier of an overriding or hiding method must provide at least as much access as the overridden or hidden method \[[JLS 2005|AA. Bibliography#JLS 05]\], Section 8.4.8.3, "Requirements in Overriding and Hiding". |
The access modifier of an overriding or hiding method must provide at least as much access as the overridden or hidden method, or a compile-time error occurs.
The following are the allowed
The following are the allowed accesses: |
Overridden/hidden method modifier | Overriding/hiding method modifier |
---|---|
|
|
|
|
default | default or |
| Cannot be overridden |
...