SpineEventEngine / core-java

The Java implementation of the framework core
https://spine.io
Apache License 2.0
36 stars 12 forks source link

Do not allow passing wrong entity state kind #1548

Open alexander-yevsyukov opened 5 months ago

alexander-yevsyukov commented 5 months ago

Now it is possible to declare an entity class with an entity state of a wrong kind. For example, it is possible to create a Projection with a message implementing EntityState which has the following option declaration:

option (.entity) = { kind: PROCESS_MANAGER visibility: QUERY };

Although, it does not do any harm, it's obviously a programming error. This is not what the developer intended. Moreover, keeping such errors unnoticed prevents us from introducing specific interfaces for entity states for projections, process managers, and aggregates.

Suggested actions

armiol commented 5 months ago

@alexander-yevsyukov I would go with pp. 3 and 4.

Points no.1 and no.2 do not lead to a compilation failure, which we ideally want. And they may be both expensive and restrictive in terms of GraalVM compatibility.