Class not declared abstract

CachéQuality release 
1.0.0
Id 
OS0049
Rule type 
Severity 

Info

Info
SQALE characteristic 
  • Changeability
    • Data
Tags 
coding-guidelines, convention
Remediation function 
Constant/issue
Remediation cost 
5min

A class with empty methods and/or the methods are declared abstract, should be abstract:

Classes with only empty class declarations, as in:

    Class MyUtilityClass
    {
    ClassMethod m1() { }
    ClassMethod m2() [ abstract ] { /* ... */ }
    }

are often "utility classes", which have no other purpose than to offer a set of methods for other classes to use.

Such classes can be made abstract; if they are not, it is possible to instantiate them using:

    #dim foo as MyUtilityClass
    set foo = ##class(MyUtilityClass).%New()

In order to prevent this, you can declare the class as abstract:

    Class MyUtilityClass [ Abstract ]
    {
        // etc
    }