Hi,
Indeed, clientTypes only returns explicit dependencies like: invocation, access,
inheritance. It does not (yet) include structuresWithDeclaredType,
behavioursWithDeclaredType or dependencies induced by annotations. We should likely extend
the meaning of clientTypes, but that might be a bit difficult to do given that the current
implementation depends on the generic MooseQuery.
In the meantime, please simply concatenate structuresWithDeclaredType in your concrete
queries. Furthermore, you might also want to take into account all incoming dependencies
to any subclass of your interface as they are potentially dependencies to the interface as
well (this applies for methods that are included in the interface).
Cheers,
Doru
On Sep 11, 2016, at 4:42 PM, Fuhrmanator
<fuhrmanator+forumworldst(a)gmail.com> wrote:
[Apologies to the moderator(s) for trying to post this via email with the
wrong address. ]
I have Moose 6.0 and I've used jdt2famix 1.0.2 to generate an MSE file. I'm
trying to use Moose to reason about clients of Java interfaces. I would like
to find any classes that depend on an interface by any means. I thought
using clientTypes was the right thing, except it doesn't work the way I
expect in a simple case.
For the interface in my example, clientTypes only returns the class that is
an implementation of the interface (which makes sense, as they depend on it)
but not the client class that uses it via a private static reference (which,
to me, doesn't make sense).
For more information, I am able find the client of the interface via
structuresWithDeclaredType, so I'm pretty sure it's not information missing
in the MSE file (not a jdt2famix bug).
Based on the simple example below, shouldn't clientTypes for ITest return
ClassAClient and ConcreteImplementationA rather than just
ConcreteImplementationA?
// ITest.java
public interface ITest {
}
// ConcreteImplementationA.java
public class ConcreteImplementationA implements ITest {
}
// ClassAClient.java
public class ClassAClient {
private static ITest theTest;
public static void main(String arg[]) {
theTest = new ConcreteImplementationA();
}
}
--
View this message in context:
http://forum.world.st/Java-interfaces-and-clientTypes-tp4915115.html
Sent from the Moose mailing list archive at
Nabble.com.
_______________________________________________
Moose-dev mailing list
Moose-dev(a)list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev
--
www.tudorgirba.com
www.feenk.com
"Quality cannot be an afterthought."