Jtest logo




Contents  Previous  Next  Index

OOP.IIN


Implement interfaces non-trivially or "abstract"

Description

This rule flags any interface that is implemented trivially or not explicitly declared to be "abstract".

Use "abstract" methods in base classes rather than those with default no-op implementations. The Java compiler will force subclass authors to implement "abstract" methods, thereby avoiding problems that would have occurred if they forgot to do so when they should have.

Example

 package OOP;
 
 abstract public class IIN implements B {
     public void f () {
         int i = 9;
         i = 10;
     }
 
     public void g () {}
     abstract public void h ();
 }
 
 interface B {
     public void f ();
     public void g ();
     public void h ();
 }

Repair

The proper body for the offending method might not have been added, or this method might have been declared unintentionally. In either case, the method should be declared to be "abstract".

Reference

http://g.oswego.edu/dl/html/javaCodingStd.html


Contents  Previous  Next  Index

ParaSoft logo
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft