Difference between revisions of "Dead Code: Broken Override"

From OWASP
Jump to: navigation, search
 
Line 43: Line 43:
  
 
[[Category:Implementation]]
 
[[Category:Implementation]]
 +
 +
[[Category:Java]]
  
 
[[Category:Code Snippet]]
 
[[Category:Code Snippet]]

Revision as of 18:00, 19 July 2006

This is a Vulnerability. To view all vulnerabilities, please see the Vulnerability Category page.

This article includes content generously donated to OWASP by MicroFocus Logo.png

Abstract

This method fails to override a similar method in its superclass because their parameter lists do not match.

Description

This method declaration looks like an attempt to override a method in a superclass, but the parameter lists do not match, so the superclass method is not overridden.

Examples

The class DeepFoundation is meant to override the method getArea() in its parent class, but the parameter lists are out of sync.

	public class Foundation
	{
	  public int getArea() {
		...
	  }
	}
	
	class DeepFoundation extends Foundation
	{
	  public int getArea(int a) {
		...
	  }
	}

Related Threats

Related Attacks

Related Vulnerabilities

Related Countermeasures

Categories