We've fixed a bug in the schema editor where it would enter a loop through a few layers of indirection. The core loop of this was:
We load the constraints for a type B as a consequence of the user double clicking on it in the type browser.
We load B's supertypes.
B has a supertype A.
We load the inheritables for A.
As a part of loading the inheritables for A, we load its owned attribute types.
A has an owned attribute, we'll call it name. B is a subtype of A, so it inherits name as well, becoming an owner type of name.
We load the owner types for name, of which B is one.
GOTO 2.
What are the changes implemented in this PR?
We've introduced the use of some AtomicBooleans, keeping track of what states are and aren't loaded. This also prevents us unnecessarily reloading data.
Before deciding to load a state, we check whether we've already loaded it. If we haven't, we add the fact that we have by flipping the relevant boolean. When any transaction is opened or a write transaction is performed, we flip all the booleans back to false to reflect the fact that our data is out of date.
What is the goal of this PR?
We've fixed a bug in the schema editor where it would enter a loop through a few layers of indirection. The core loop of this was:
B
as a consequence of the user double clicking on it in the type browser.B
's supertypes.B
has a supertypeA
.A
.A
, we load its owned attribute types.A
has an owned attribute, we'll call itname
.B
is a subtype ofA
, so it inheritsname
as well, becoming an owner type ofname
.name
, of whichB
is one.What are the changes implemented in this PR?
We've introduced the use of some
AtomicBoolean
s, keeping track of what states are and aren't loaded. This also prevents us unnecessarily reloading data.Before deciding to load a state, we check whether we've already loaded it. If we haven't, we add the fact that we have by flipping the relevant boolean. When any transaction is opened or a write transaction is performed, we flip all the booleans back to false to reflect the fact that our data is out of date.