Find Usages not returning expected result for entity

I think I just found a bug in the modeler (ticket already filed). I was doing some refactoring and triggered the "Find usages" function on an entity. To my surprise the results did not contain a microflow where the entity was obviously used. In my case a list of this entity was retrieved by association and then iterated in a loop. Both actions are currently not considered a "usage" by the modeler. I've created some screenshots of my sample project. I just want people to be aware of this so you don't miss anything important while refactoring. I've tested this on 5.21.4 and on 5.6. Best regards, Georg
2 answers

I agree that it can be surprising but this is not a bug. The Modeler only sees a usage if you explicitly select Entity2. In your example, the entity Entity2 is visualized twice but they are both showing derived information. If you change the association Entity2_Entity1 to point to AnotherEntity then both visualizations will suddenly change to AnotherEntity.

So, while it is not a bug, I can understand that it surprises you. Can you give a reason why it is problematic that these "usages" do not show up?

Update: Bart asks what happens if you delete Entity2. If you delete Entity2, you will not get an error about Entity2 being undefined. You will get an error about the association Entity2_Entity1 being undefined!

I thought about it some more and I realize now that it is the difference between languages with local variable type inference and without. Let's switch to traditional programming languages instead. In Java there is no type inference for local variables and the microflow translated to Java would look like this:

Entity1 entity1 = RetrieveFirstFromDatabase(Entity1.class);
List<Entity2> entity2List = entity1.GetEntity2_Entity1();
for (Entity2 e: entity2List)

Here, Entity2 is used twice. However, in my favorite programming language C# there is type inference for local variables and the code looks like this:

var entity1 = RetrieveFirstFromDatabase<Entity1>();
var entity2List = entity1.GetEntity2_Entity1();
foreach (var e in entity2List)

There are no explicit usages of Entity2. Also, when I ask Visual Studio to 'Find usages' of the class Entity2 it finds none in this code fragment.

The Modeler also does type inference for local variables: you do not have to tell the Modeler what the type of the retrieve over association is; it is inferred. You also do not have to tell the Modeler what the type of the loop iterator is; it is inferred as well.

I think we can all be happy that the Modeler does not require us to specify all these types, but I would still like to hear about a use case where it is important to find these inferred usages of Entity2.


Depending on how you define "usage" you could argue this is not a bug. In that case you would expect a warning for an object/list/something not being used in this microflow, does this warning occur?

edit: I personally agree with Georg here.