...
Wiki Markup |
---|
Technically, a private method cannot be hidden or overridden. There is no requirement that private methods with the same signature in the subclass and the superclass bear any relationship in terms of having the same return type or {{throws}} clause, the necessary conditions for hiding \[[JLS 2005|AA. Bibliography#JLS 05]\]. Consequently, hiding cannot occur when the methods have different return types or {{throws}} clauses. |
Exceptions
MET11MET07-EX0: Occasionally an API provides hidden methods. Invoking those methods is not a violation of this rule, provided that all invocations of hidden methods use qualified names or method invocation expressions that explicitly indicate which specific method is invoked. If the displayAccountStatus()
is a hidden method, for example, the following implementation of the choose()
method is an acceptable alternative:
...
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
MET11 MET07-J | low | unlikely | medium | P2 | L3 |
Automated Detection
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="e4aff0ceee5c98be-0174f3cc-4101442c-925ea391-9da3af77ee001b816558622e"><ac:plain-text-body><![CDATA[ | [[Bloch 2005 | AA. Bibliography#Bloch 05]] | Puzzle 48: All I Get Is Static | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="06149de1ca8ff5cb-b13d7cc2-4da84fbe-9aaebf9c-432b7a8f93433db55d2797bd"><ac:plain-text-body><![CDATA[ | [[JLS 2005 | AA. Bibliography#JLS 05]] | ["8.4.8.2 Hiding (by Class Methods)" | http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.4.8.2] | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="bca0d2b1721bcd11-726c6b33-47714302-8f7a87af-e0e58620948261f4c9c7ac6f"><ac:plain-text-body><![CDATA[ | [[Tutorials 2008 | AA. Bibliography#Tutorials 08]] | [Overriding and Hiding Methods | http://java.sun.com/docs/books/tutorial/java/IandI/override.html] | ]]></ac:plain-text-body></ac:structured-macro> |
...