...
The access modifier of an overriding or hiding method must provide at least as much access as the overridden or hidden method (The Java Language Specification, §8.4.8.3, "Requirements in Overriding and Hiding" [JLS 2015]). The following table lists the allowed accesses:.
Overridden/Hidden Method Modifier | Overriding/Hiding Method Modifier |
---|---|
|
|
|
|
default | default or |
| Cannot be overridden |
...
This compliant solution declares the doLogic()
method final to prevent malicious overriding:
...