Class FieldClassifier

java.lang.Object
org.ek9lang.compiler.phase5.FieldClassifier

final class FieldClassifier extends Object
Classifies fields in an aggregate as service-type (abstract/interface) or data-type (concrete). Also tracks which fields are used in 'by' delegation.

Service-type fields are those whose type is an abstract/behavior contract:

  • A trait (SymbolGenus.CLASS_TRAIT) - behavior contract
  • An abstract class (isMarkedAbstract()) - behavior contract
  • An abstract function (SymbolGenus.FUNCTION_TRAIT) - behavior contract

Data-type fields are concrete types:

  • Records (SymbolGenus.RECORD) - pure data
  • Text constructs (SymbolGenus.TEXT) - pure data
  • Concrete classes (String, Dimension, user-defined) - values with behavior
  • Concrete functions - specific implementation, not a contract

For parameterized types (List, Dict, Optional), the classification is based on the type argument, not the container. For example:

  • List of Repository (trait) → SERVICE (holds behavior contracts)
  • List of String (concrete) → DATA (holds concrete values)
  • Dict of String, UserRecord (record) → DATA (value type determines)

This classification helps detect the construct misuse anti-patterns:

  • E11022: Class with many service fields and no data = should be component
  • E11024: Class with 'by' delegation + many service fields = hybrid, should split
  • Constructor Details

    • FieldClassifier

      FieldClassifier()
  • Method Details