Skip to content

[apex][plsql][java] Deprecate overly specific base rule classes #971

@oowekyala

Description

@oowekyala

I think base rule classes other than AbstractJavaRule should disappear, for the following reasons:

  • Java's single inheritance makes them very inflexible. If Java had mixins, then they could be justified better, but they're just committing the developer to a rule type, and adding us some binary compatibility debts we're compelled to support
  • They usually only contain a few methods to shorten some operations on the nodes their subclasses operate on, so that it doesn't mean anything to refer to one of the subclasses by the abstract classes' type. I mean, what does it mean to be an AbstractOptimizationRule ? There's no added API, no significant or useful shared behaviour. No abstraction in short -> classification mistake
  • They usually share code with only a few rules (eg 3 for AbstractOptimizationRule), even though the behaviour could be better factorised and abstracted if they were eg on the relevant AST nodes, or symbol table classes. It could then be used by every rule, and provide a useful and maintainable api, instead of a bunch of hacky shortcuts. See eg AbstractSunSecureRule, and its absurdly specific methods...
  • Finally, all other arguments from the classic inheritance vs composition debate hold for these base classes.

I think all these base rule classes should be deprecated and their code moved out to the AST or symbol table if it can be useful

Metadata

Metadata

Assignees

Labels

is:deprecationThe main focus is deprecating public APIs or rules, eg to make them internal, or removing them

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions