No Class-wide Constructs Policy (OOP01)
Level \(\rightarrow\) Advisory
- Category
- Safety:
\(\checkmark\)
- Cyber:
\(\checkmark\)
- Goal
- Maintainability:
\(\checkmark\)
- Reliability:
\(\checkmark\)
- Portability:
- Performance:
- Security:
\(\checkmark\)
Remediation \(\rightarrow\) N/A
Verification Method \(\rightarrow\) Compiler restrictions
Mutually Exclusive \(\rightarrow\) OOP02
Reference
N/A
Description
In this approach, tagged types are allowed and type extension (inheritance) is allowed, but there are no class-wide constructs.
This restriction ensures there are no class-wide objects or formal parameters, nor access types designating class-wide types.
In this approach there are no possible dynamic dispatching calls because such calls can only occur when a class-wide value is passed as the parameter to a primitive operation of a tagged type.
Applicable Vulnerability within ISO TR 24772-2
6.43 Redispatching [PPH]
Applicable Common Weakness Enumeration
N/A
Noncompliant Code Example
X : Object'Class := Some_Object;
Compliant Code Example
X : Object := Some_Object;
Notes
The compiler will detect violations with the standard Ada restriction
No_Dispatch
applied.