To illustrate my issue, I created a minimal, fictional example project which consists of three classes, Service
, Transaction
and Product
. P
package org.example;
public class Service {
public Service(Transaction transaction) {
int buyerId = transaction.getProduct().getId();
}
}
Type Product
is in a separate package domain
package org.example.domain;
public class Product {
// [...]
public int getId() {
return this.id;
}
}
For the sake of this example, assume that I want to avoid Service
to depend on anything in package domain
.
I can ensure this using this query:
MATCH
(c {name:"Service"})-[:DEPENDS_ON]->(d)
WHERE
d.fqn STARTS WITH "org.example.domain"
RETURN
c.fqn, d.fqn
This returns a non-empty result, i.e. the constraint is violated - because jQAssistant creates a :DEPENDS_ON
relationship between Service
and Product
in this case, which feels counter-intuitive, because there is neither an import nor a direct reference to org.example.domain.Product
in Service
.
This leads me to the following questions:
- Is this behavior intentional or not?
- Is there a way to differentiate between "direct" dependencies where the dependency is imported and used inside the parent type and "indirect" dependencies as illustrated in my example?