From 19087fc54b7e67adc2268e7b351377b638810ef0 Mon Sep 17 00:00:00 2001 From: Nazir Muhammad Zafar Iqbal Date: Sun, 2 Apr 2023 16:48:06 +0200 Subject: [PATCH 01/98] Added the messages.xml and findbugs.xml components for my second checker. --- spotbugs/etc/findbugs.xml | 11 ++++++++++ spotbugs/etc/messages.xml | 44 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/spotbugs/etc/findbugs.xml b/spotbugs/etc/findbugs.xml index e9be54de7d9..2a50dc960ab 100644 --- a/spotbugs/etc/findbugs.xml +++ b/spotbugs/etc/findbugs.xml @@ -669,6 +669,11 @@ reports="PERM_SUPER_NOT_CALLED_IN_GETPERMISSIONS"/> + + + + + + +
+ + Hiding and overriding differ in the determination of which method is invoked from a call site. + For overriding, the method invoked is determined at runtime on the basis of the specific object instance + in hand. + For hiding, the method invoked is determined at compile time on the basis of the specific qualified name + or method invocation expression used at the call site. + Although the Java language provides unambiguous rules for determining which method is invoked, + the results of these rules are often unexpected. + Additionally, programmers sometimes expect method overriding in cases where the language provides + method hiding. Consequently, + programs must never declare a class method that hides a method declared in a superclass or superinterface. +

+ ]]> +
+
-
]]>
- - Find class methods hiding a method from superclass or superinterface - The method '{1}' in class '{2}' hides a method '{3}' in class '{4}'. + Detects the methods hiding a method from superclass + The method '{1}' in class '{2}' hides a method '{3}' in class '{4}'. Call the static method by class name or fully qualified name to eradicate the problem.
@@ -8821,10 +8819,11 @@ Using floating-point variables should not be used as loop counters, as they are Additionally, programmers sometimes expect method overriding in cases where the language provides method hiding. Consequently, programs must never declare a class method that hides a method declared in a superclass or superinterface. -

]]> +

+ See SEI CERT rule MET07-J. Never declare a class method that hides a method declared in a superclass or superinterface. + ]]>
-